Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3369165
D9074.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D9074.diff
View Options
diff --git a/native/account/siwe-panel.react.js b/native/account/siwe-panel.react.js
--- a/native/account/siwe-panel.react.js
+++ b/native/account/siwe-panel.react.js
@@ -18,9 +18,9 @@
type BindServerCallsParams,
} from 'lib/utils/action-utils.js';
-import { commCoreModule } from '../native-modules.js';
import { useSelector } from '../redux/redux-utils.js';
import Alert from '../utils/alert.js';
+import { getContentSigningKey } from '../utils/crypto-utils.js';
import { defaultLandingURLPrefix } from '../utils/url-utils.js';
const commSIWE = `${defaultLandingURLPrefix}/siwe`;
@@ -79,10 +79,7 @@
setNonce(response);
})(),
);
- await commCoreModule.initializeCryptoAccount();
- const {
- primaryIdentityPublicKeys: { ed25519 },
- } = await commCoreModule.getUserPublicKey();
+ const ed25519 = await getContentSigningKey();
setPrimaryIdentityPublicKey(ed25519);
})();
}, [dispatchActionPromise, getSIWENonceCall]);
diff --git a/native/backup/use-client-backup.js b/native/backup/use-client-backup.js
--- a/native/backup/use-client-backup.js
+++ b/native/backup/use-client-backup.js
@@ -12,6 +12,7 @@
import { encryptBackup } from './encryption.js';
import { commCoreModule } from '../native-modules.js';
import { generateKey } from '../utils/aes-crypto-module.js';
+import { getContentSigningKey } from '../utils/crypto-utils.js';
type ClientBackup = {
+uploadBackupProtocol: (userData: UserData) => Promise<void>,
@@ -32,19 +33,17 @@
console.info('Start uploading backup...');
const backupDataKey = generateKey();
- await commCoreModule.initializeCryptoAccount();
- const {
- primaryIdentityPublicKeys: { ed25519 },
- } = await commCoreModule.getUserPublicKey();
+
+ const [ed25519, backupID] = await Promise.all([
+ getContentSigningKey(),
+ commCoreModule.generateRandomString(BACKUP_ID_LENGTH),
+ ]);
+
const userKeys: UserKeys = {
backupDataKey: uintArrayToHexString(backupDataKey),
ed25519,
};
- const backupID = await commCoreModule.generateRandomString(
- BACKUP_ID_LENGTH,
- );
-
const encryptedBackup = await encryptBackup({
backupID,
userKeys,
diff --git a/native/utils/crypto-utils.js b/native/utils/crypto-utils.js
--- a/native/utils/crypto-utils.js
+++ b/native/utils/crypto-utils.js
@@ -52,4 +52,12 @@
);
}
-export { useInitialNotificationsEncryptedMessage };
+async function getContentSigningKey(): Promise<string> {
+ await commCoreModule.initializeCryptoAccount();
+ const {
+ primaryIdentityPublicKeys: { ed25519 },
+ } = await commCoreModule.getUserPublicKey();
+ return ed25519;
+}
+
+export { useInitialNotificationsEncryptedMessage, getContentSigningKey };
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 26, 10:07 PM (21 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2586489
Default Alt Text
D9074.diff (2 KB)
Attached To
Mode
D9074: [client-backup] extract logic for getting primary identity public key
Attached
Detach File
Event Timeline
Log In to Comment