Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6551 support #655

Closed
wants to merge 7 commits into from
Closed

6551 support #655

wants to merge 7 commits into from

Conversation

Aman035
Copy link
Member

@Aman035 Aman035 commented Aug 18, 2023

No description provided.

@github-actions
Copy link

In constants.ts:

  • There are syntax errors in the code. The missing closing braces in several enums and objects should be added.

In crypto.ts:

  • In the encryptPGPKey function, there is a missing closing parenthesis after the getEip191Signature function call.

In metaTypes.ts:

  • There is a missing closing parenthesis after the getEip191Signature function call.

  • The export statements for the REPLY_MESSAGE_META, COMPOSITE_MESSAGE_META, and PAYMENT_MESSAGE_META types are commented out. These types should be uncommented if they are necessary.

In createUser.ts:

  • There is a missing closing parenthesis after the getEip191Signature function call.

  • There is a missing closing parenthesis after the encryptV2 function call.

  • The switch statement in the encryptPGPKey function is missing a closing brace.

  • The switch statement in the preparePGPPublicKey function is missing a closing brace.

  • The verifyProfileKeys function is missing a closing brace.

  • There is a missing closing brace at the end of the createUser.ts file.

  • There is a missing closing parenthesis after the errorProgressHook function call.

  • The validateOptions function is missing a closing brace.

  • There is a syntax error in the validateOptions function. The closing parenthesis after the "At least one from account or signer is necessary!" error message should be removed.

All looks good.

@github-actions
Copy link

File: packages/restapi/package.json

{
"name": "@pushprotocol/restapi",
"version": "1.4.9",
"type": "commonjs",
"publishConfig": {
"registry": "https://registry.npmjs.org/"
},
"peerDependencies": {
"ethers": "^5.6.8"
},
"dependencies": {
"@ambire/signature-validator": "^1.3.1",
"@livepeer/webrtmp-sdk": "^0.2.3",
"@metamask/eth-sig-util": "^5.0.2",
"@tokenbound/sdk": "^0.3.4",
"buffer": "^6.0.3",
"crypto-js": "^4.1.1",
"immer": "^10.0.2",
"livepeer": "^2.5.8",
"openpgp": "^5.5.0",
"simple-peer": "^9.11.1",
"video-stream-merger": "^4.0.1"
},
"scripts": {
"test": "TS_NODE_PROJECT='./tsconfig.mocha.json' NODE_OPTIONS='--loader ts-node/esm' mocha -r ts-node/register 'tests/**/*.test.ts' --timeout 120000 --require tests/root.ts --serial"
},
"devDependencies": {
"@types/chai": "^4.3.4",
"@types/chai-as-promised": "^7.1.5",
"@types/crypto-js": "^4.1.1",
"@types/mocha": "^10.0.1",
"chai": "^4.3.7",
"chai-as-promised": "^7.1.1",
"mocha": "^10.2.0",
"mocha-typescript": "^1.1.17",
"ts-node": "^10.9.1",
"typescript": "^5.0.2"
}
}

All looks good.


File: packages/restapi/src/lib/constants.ts

/**

  • SUPPORTED ENVIRONMENTS
    /
    export enum ENV {
    PROD = 'prod',
    STAGING = 'staging',
    DEV = 'dev',
    /
    *
    • This is for local development only
      */
      LOCAL = 'local',
      }

/**

  • SUPPORTED ENCRYPTIONS FOR PUSH PROFILE
    */
    export enum ENCRYPTION_TYPE {
    PGP_V1 = 'x25519-xsalsa20-poly1305',
    PGP_V2 = 'aes256GcmHkdfSha256',
    PGP_V3 = 'eip191-aes256-gcm-hkdf-sha256',
    NFTPGP_V1 = 'pgpv1:nft',
    NFTPGP_V2 = 'pgpv2:nft',
    }

/**

  • SUPPORTED MESSAGE TYPES FOR PUSH CHAT
    /
    export enum MessageType {
    TEXT = 'Text',
    IMAGE = 'Image',
    FILE = 'File',
    MEDIA_EMBED = 'MediaEmbed',
    META = 'Meta',
    REACTION = 'Reaction',
    /
    *
    • @deprecated - Use MediaEmbed Instead
      */
      GIF = 'GIF',
      // TODO
      // AUDIO = 'Audio',
      // VIDEO = 'Video',
      // PAYMENT = 'Payment',
      // REPLY = 'Reply',
      // COMPOSITE = 'Composite',
      }

const Constants = {
ENV,
ENCRYPTION_TYPE,
PAGINATION: {
INITIAL_PAGE: 1,
LIMIT: 10,
LIMIT_MIN: 1,
LIMIT_MAX: 50,
},
DEFAULT_CHAIN_ID: 5,
DEV_CHAIN_ID: 99999,
NON_ETH_CHAINS: [137, 80001, 56, 97, 10, 420, 1442, 1101],
ETH_CHAINS: [1, 5],
ENC_TYPE_V1: 'x25519-xsalsa20-poly1305',
ENC_TYPE_V2: 'aes256GcmHkdfSha256',
ENC_TYPE_V3: 'eip191-aes256-gcm-hkdf-sha256',
ENC_TYPE_V4: 'pgpv1:nft',
ENC_TYPE_V5: 'pgpv2:nft',
};

export default Constants;

All looks good.


File: packages/restapi/src/lib/helpers/crypto.ts

...
...
const decrypted: ArrayBuffer = await crypto.subtle.decrypt(
aesGcmParams,
key,
hexToBytes(encryptedData.ciphertext)
);
return new Uint8Array(decrypted);
};

export const encryptPGPKey = async (
encryptionType: string,
privateKey: string,
wallet: walletType,
additionalMeta?: {
NFTPGP_V1?: {
password: string;
};
}
): Promise => {
let encryptedPrivateKey: encryptedPrivateKeyType;
switch (encryptionType) {
case Constants.ENC_TYPE_V1: {
let walletPublicKey: string;
if (wallet?.signer?.privateKey) {
// get metamask specific encryption public key
walletPublicKey = getEncryptionPublicKey(
wallet?.signer?.privateKey.substring(2)
);
} else {
// wallet popup will happen to get encryption public key
walletPublicKey = await getPublicKey(wallet);
}
encryptedPrivateKey = encryptV1(
privateKey,
walletPublicKey,
encryptionType
);
break;
}
case Constants.ENC_TYPE_V2: {
const input = bytesToHex(await getRandomValues(new Uint8Array(32)));
const enableProfileMessage = 'Enable Push Chat Profile \n' + input;
const { verificationProof: secret } = await getEip712Signature(
wallet,
enableProfileMessage,
true
);
const enc = new TextEncoder();
const encodedPrivateKey = enc.encode(privateKey);
encryptedPrivateKey = await encryptV2(
encodedPrivateKey,
hexToBytes(secret || '')
);
encryptedPrivateKey.version = encryptionType;
encryptedPrivateKey.preKey = input;
break;
}
case Constants.ENC_TYPE_V3:
case Constants.ENC

@github-actions
Copy link

File: packages/restapi/package.json

  1. Missing closing curly brace for the "peerDependencies" object.
  2. Missing closing curly brace for the "dependencies" object.
  3. Missing closing curly brace for the "scripts" object.
  4. Missing closing curly brace for the "devDependencies" object.

File: packages/restapi/src/lib/constants.ts

  1. There is a comment /* ... */ that is not properly terminated.

File: packages/restapi/src/lib/helpers/crypto.ts

  1. Missing closing parenthesis in the function 'encryptPGPKey' after the inner switch statement.

File: packages/restapi/src/lib/user/auth.updateUser.ts

  1. Missing closing parenthesis in the function 'authUpdate' after the outer try-catch statement.

File: packages/restapi/src/lib/user/createUser.ts

  1. This file is missing. Please make sure it exists in the correct location.

File: packages/restapi/yarn.lock

  1. This file is missing. Please make sure it exists in the correct location.

All looks good.

@github-actions
Copy link

File: packages/restapi/package.json

{
"name": "@pushprotocol/restapi",
"version": "1.4.9",
"type": "commonjs",
"publishConfig": {
"registry": "https://registry.npmjs.org/"
},
"peerDependencies": {
"ethers": "^5.6.8"
},
"dependencies": {
"@ambire/signature-validator": "^1.3.1",
"@livepeer/webrtmp-sdk": "^0.2.3",
"@metamask/eth-sig-util": "^5.0.2",
"@tokenbound/sdk": "^0.3.4",
"buffer": "^6.0.3",
"crypto-js": "^4.1.1",
"immer": "^10.0.2",
"livepeer": "^2.5.8",
"openpgp": "^5.5.0",
"simple-peer": "^9.11.1",
"video-stream-merger": "^4.0.1"
},
"scripts": {
"test": "TS_NODE_PROJECT='./tsconfig.mocha.json' NODE_OPTIONS='--loader ts-node/esm' mocha -r ts-node/register 'tests/**/*.test.ts' --timeout 120000 --require tests/root.ts --serial"
},
"devDependencies": {
"@types/chai": "^4.3.4",
"@types/chai-as-promised": "^7.1.5",
"@types/crypto-js": "^4.1.1",
"@types/mocha": "^10.0.1",
"chai": "^4.3.7",
"chai-as-promised": "^7.1.1",
"mocha": "^10.2.0",
"mocha-typescript": "^1.1.17",
"ts-node": "^10.9.1",
"typescript": "^5.0.2"
}
}

File: packages/restapi/src/lib/constants.ts

All looks good.

File: packages/restapi/src/lib/helpers/crypto.ts

Line 32: Missing closing brace '}' for the 'switch' statement.

Line 38: Missing closing braces '}' and ')' for the 'switch' statement and the 'case Constants.ENC_TYPE_V2'.

Line 51: Missing closing brace '}' for the 'switch' statement.

Line 53: Missing closing paren ')' for the 'if' statement.

Line 58: Missing closing brace '}' for the 'switch' statement.

Line 60: Missing closing paren ')' for the 'if' statement.

Line 64: Missing closing brace '}' for the 'switch' statement.

Line 76: Missing closing brace '}' for the 'switch' statement.

Line 85: Missing closing brace '}' for the 'switch' statement.

Line 87: Missing closing brace '}' for the 'switch' statement.

Line 88: Missing closing brace '}' for the 'export default Constants;' statement.

File: packages/restapi/src/lib/user/auth.updateUser.ts

All looks good.

File: packages/restapi/src/lib/user/createUser.ts

File is missing.

File: packages/restapi/src/lib/user/createUserWithProfile.ts

All looks good.

File: packages/restapi/yarn.lock

All looks good.

@Aman035 Aman035 closed this Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant