Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32970275
D9074.1768303505.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D9074.1768303505.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, Jan 13, 11:25 AM (56 m, 25 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5926086
Default Alt Text
D9074.1768303505.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