Page MenuHomePhorge

D13232.1768503195.diff
No OneTemporary

Size
3 KB
Referenced Files
None
Subscribers
None

D13232.1768503195.diff

diff --git a/lib/types/identity-service-types.js b/lib/types/identity-service-types.js
--- a/lib/types/identity-service-types.js
+++ b/lib/types/identity-service-types.js
@@ -168,6 +168,19 @@
siweMessage: string,
siweSignature: string,
) => Promise<IdentityAuthResult>;
+ // Users cannot restore backup from web
+ +restorePasswordUser?: (
+ username: string,
+ deviceList: SignedDeviceList,
+ signedNonce: SignedNonce,
+ ) => Promise<IdentityAuthResult>;
+ // Users cannot restore backup from web
+ +restoreWalletUser?: (
+ walletAddress: string,
+ siweMessage: string,
+ siweSignature: string,
+ deviceList: SignedDeviceList,
+ ) => Promise<IdentityAuthResult>;
// on native, publishing prekeys to Identity is called directly from C++,
// there is no need to expose it to JS
+publishWebPrekeys?: (prekeys: SignedPrekeys) => Promise<void>;
diff --git a/native/identity-service/identity-service-context-provider.react.js b/native/identity-service/identity-service-context-provider.react.js
--- a/native/identity-service/identity-service-context-provider.react.js
+++ b/native/identity-service/identity-service-context-provider.react.js
@@ -507,6 +507,77 @@
primaryIdentityPublicKeys.ed25519,
);
},
+ restorePasswordUser: async (
+ username: string,
+ deviceList: SignedDeviceList,
+ signedNonce: SignedNonce,
+ ) => {
+ await commCoreModule.initializeCryptoAccount();
+ const [
+ { blobPayload, signature, primaryIdentityPublicKeys },
+ { contentOneTimeKeys, notificationsOneTimeKeys },
+ prekeys,
+ ] = await Promise.all([
+ commCoreModule.getUserPublicKey(),
+ commCoreModule.getOneTimeKeys(ONE_TIME_KEYS_NUMBER),
+ commCoreModule.validateAndGetPrekeys(),
+ ]);
+ const { nonce, nonceSignature } = signedNonce;
+ const restoreResult = await commRustModule.restorePasswordUser(
+ username,
+ nonce,
+ nonceSignature,
+ blobPayload,
+ signature,
+ prekeys.contentPrekey,
+ prekeys.contentPrekeySignature,
+ prekeys.notifPrekey,
+ prekeys.notifPrekeySignature,
+ getOneTimeKeyValues(contentOneTimeKeys),
+ getOneTimeKeyValues(notificationsOneTimeKeys),
+ JSON.stringify(deviceList),
+ );
+
+ return await processAuthResult(
+ restoreResult,
+ primaryIdentityPublicKeys.ed25519,
+ );
+ },
+ restoreWalletUser: async (
+ walletAddress: string,
+ siweMessage: string,
+ siweSignature: string,
+ deviceList: SignedDeviceList,
+ ) => {
+ await commCoreModule.initializeCryptoAccount();
+ const [
+ { blobPayload, signature, primaryIdentityPublicKeys },
+ { contentOneTimeKeys, notificationsOneTimeKeys },
+ prekeys,
+ ] = await Promise.all([
+ commCoreModule.getUserPublicKey(),
+ commCoreModule.getOneTimeKeys(ONE_TIME_KEYS_NUMBER),
+ commCoreModule.validateAndGetPrekeys(),
+ ]);
+ const restoreResult = await commRustModule.restoreWalletUser(
+ siweMessage,
+ siweSignature,
+ blobPayload,
+ signature,
+ prekeys.contentPrekey,
+ prekeys.contentPrekeySignature,
+ prekeys.notifPrekey,
+ prekeys.notifPrekeySignature,
+ getOneTimeKeyValues(contentOneTimeKeys),
+ getOneTimeKeyValues(notificationsOneTimeKeys),
+ JSON.stringify(deviceList),
+ );
+
+ return await processAuthResult(
+ restoreResult,
+ primaryIdentityPublicKeys.ed25519,
+ );
+ },
uploadKeysForRegisteredDeviceAndLogIn: async (
userID: string,
nonceChallengeResponse: SignedNonce,

File Metadata

Mime Type
text/plain
Expires
Thu, Jan 15, 6:53 PM (18 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5939507
Default Alt Text
D13232.1768503195.diff (3 KB)

Event Timeline