-
Notifications
You must be signed in to change notification settings - Fork 34
[PB-5655] feat(recovery): send backup public keys for validation during account #1805
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
Changes from 2 commits
59f430b
f8f3af2
933b69d
6d990bd
f025d73
b17b890
4e22e03
7ff7273
df1f44c
2ca6625
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,9 @@ import { encryptMessageWithPublicKey, hybridEncryptMessageWithPublicKey } from ' | |
| * @property {Object} keys - The user's encryption keys | ||
| * @property {string} keys.ecc - The user's ECC private key | ||
| * @property {string} keys.kyber - The user's Kyber private key | ||
| * @property {Object} [publicKeys] - The user's public keys (for backup validation) | ||
| * @property {string} [publicKeys.ecc] - The user's ECC public key | ||
| * @property {string} [publicKeys.kyber] - The user's Kyber public key | ||
| */ | ||
| export interface BackupData { | ||
| mnemonic: string; | ||
|
|
@@ -24,6 +27,10 @@ export interface BackupData { | |
| ecc: string; | ||
| kyber: string; | ||
| }; | ||
| publicKeys?: { | ||
| ecc?: string; | ||
| kyber?: string; | ||
| }; | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -49,6 +56,10 @@ export function handleExportBackupKey(translate) { | |
| ecc: user.keys?.ecc?.privateKey || user.privateKey, | ||
| kyber: user.keys?.kyber?.privateKey || '', | ||
| }, | ||
| publicKeys: { | ||
| ecc: user.keys?.ecc?.publicKey || '', | ||
| kyber: user.keys?.kyber?.publicKey || '', | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see that if for some reason the public keys are not there, empty strings will be exported.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If both ecc and kyber public keys are not present, publicKeys shouldn't be exported at all. In order to keep backward compatibility, I've changed that. |
||
| }, | ||
| }; | ||
|
|
||
| const backupContent = JSON.stringify(backupData, null, 2); | ||
|
|
@@ -84,6 +95,12 @@ export const detectBackupKeyFormat = ( | |
| ecc: parsedData.keys.ecc, | ||
| kyber: parsedData.keys.kyber, | ||
| }, | ||
| publicKeys: parsedData.publicKeys | ||
| ? { | ||
| ecc: parsedData.publicKeys.ecc, | ||
| kyber: parsedData.publicKeys.kyber, | ||
| } | ||
| : undefined, | ||
| }; | ||
| return { | ||
| type: 'new', | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if doesn't mind, change the test that are modifying to "when X, then Y" format