From 46e119ee8032def40dfc863ba96eee13e3537ebf Mon Sep 17 00:00:00 2001 From: Aman Gupta Date: Wed, 6 Mar 2024 14:09:52 +0530 Subject: [PATCH] fix: mark push-create-02 as deprecated (#1147) * fix: mark push-create-02 as deprecated * fix: hook deprecated but still allow calling --- packages/restapi/src/lib/helpers/crypto.ts | 14 -------------- packages/restapi/src/lib/progressHook.ts | 3 +++ packages/restapi/src/lib/user/createUser.ts | 21 ++++++++++++--------- 3 files changed, 15 insertions(+), 23 deletions(-) diff --git a/packages/restapi/src/lib/helpers/crypto.ts b/packages/restapi/src/lib/helpers/crypto.ts index 6330dddc5..7ed3e7557 100644 --- a/packages/restapi/src/lib/helpers/crypto.ts +++ b/packages/restapi/src/lib/helpers/crypto.ts @@ -476,20 +476,6 @@ export const preparePGPPublicKey = async ( case Constants.ENC_TYPE_V3: case Constants.ENC_TYPE_V4: { const verificationProof = 'DEPRECATED'; - - /** - * @deprecated - * PUSH CHAT PROFILE CREATION DOES NOT SIGN PGP PUBLIC KEY - * VERIFICATION PROOF SIGNATURE SHOULD BE USED FOR VERIFICATION OF PUSH PROFILE KEYS - */ - - // const createProfileMessage = - // 'Create Push Profile \n' + generateHash(publicKey); - // const { verificationProof } = await getEip191Signature( - // wallet, - // createProfileMessage - // ); - // TODO - Change JSON Structure to string ie equivalent to ENC_TYPE_V1 ( would be done after PUSH Node changes ) chatPublicKey = JSON.stringify({ key: publicKey, diff --git a/packages/restapi/src/lib/progressHook.ts b/packages/restapi/src/lib/progressHook.ts index 0a1f2fd5c..675106177 100644 --- a/packages/restapi/src/lib/progressHook.ts +++ b/packages/restapi/src/lib/progressHook.ts @@ -15,6 +15,9 @@ const PROGRESSHOOK: Record< 'This step is only done for first time users and might take a few seconds. PGP keys are getting generated to provide you with secure yet seamless web3 communication', level: 'INFO', }, + /** + * @deprecated + */ 'PUSH-CREATE-02': { progressId: 'PUSH-CREATE-02', progressTitle: 'Signing Generated Profile', diff --git a/packages/restapi/src/lib/user/createUser.ts b/packages/restapi/src/lib/user/createUser.ts index 9e04da1e0..2583ac78e 100644 --- a/packages/restapi/src/lib/user/createUser.ts +++ b/packages/restapi/src/lib/user/createUser.ts @@ -36,20 +36,23 @@ export type CreateUserProps = { }; }; progressHook?: (progress: ProgressHookType) => void; - origin? : string | null + origin?: string | null; }; interface ICreateUser extends IUser { decryptedPrivateKey?: string; } +export const create = async ( + options: CreateUserProps +): Promise => { + return await createUserCore(options, PGPHelper); +}; -export const create = async (options:CreateUserProps):Promise=>{ - return await createUserCore(options, PGPHelper) -} - -export const createUserCore = async ( options: CreateUserProps, - pgpHelper: IPGPHelper): Promise => { +export const createUserCore = async ( + options: CreateUserProps, + pgpHelper: IPGPHelper +): Promise => { const passPrefix = '$0Pc'; //password prefix to ensure password validation const { env = Constants.ENV.PROD, @@ -62,7 +65,7 @@ export const createUserCore = async ( options: CreateUserProps, }, }, progressHook, - origin + origin, } = options || {}; try { @@ -129,7 +132,7 @@ export const createUserCore = async ( options: CreateUserProps, publicKey: publicKey, encryptedPrivateKey: JSON.stringify(encryptedPrivateKey), env, - origin: origin + origin: origin, }; const createdUser: ICreateUser = await createUserService(body);