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

fix: mark push-create-02 as deprecated #1147

Merged
merged 2 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions packages/restapi/src/lib/helpers/crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions packages/restapi/src/lib/progressHook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
23 changes: 12 additions & 11 deletions packages/restapi/src/lib/user/createUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<ICreateUser> => {
return await createUserCore(options, PGPHelper);
};

export const create = async (options:CreateUserProps):Promise<ICreateUser>=>{
return await createUserCore(options, PGPHelper)
}

export const createUserCore = async ( options: CreateUserProps,
pgpHelper: IPGPHelper): Promise<ICreateUser> => {
export const createUserCore = async (
options: CreateUserProps,
pgpHelper: IPGPHelper
): Promise<ICreateUser> => {
const passPrefix = '$0Pc'; //password prefix to ensure password validation
const {
env = Constants.ENV.PROD,
Expand All @@ -62,7 +65,7 @@ export const createUserCore = async ( options: CreateUserProps,
},
},
progressHook,
origin
origin,
} = options || {};

try {
Expand Down Expand Up @@ -95,8 +98,6 @@ export const createUserCore = async ( options: CreateUserProps,
progressHook?.(PROGRESSHOOK['PUSH-CREATE-01'] as ProgressHookType);
const keyPairs = await pgpHelper.generateKeyPair();

// Report Progress
progressHook?.(PROGRESSHOOK['PUSH-CREATE-02'] as ProgressHookType);
const publicKey: string = await preparePGPPublicKey(
encryptionType,
keyPairs.publicKeyArmored,
Expand Down Expand Up @@ -129,7 +130,7 @@ export const createUserCore = async ( options: CreateUserProps,
publicKey: publicKey,
encryptedPrivateKey: JSON.stringify(encryptedPrivateKey),
env,
origin: origin
origin: origin,
};
const createdUser: ICreateUser = await createUserService(body);

Expand Down
Loading