Page MenuHomePhorge

D13232.1768503144.diff
No OneTemporary

Size
2 KB
Referenced Files
None
Subscribers
None

D13232.1768503144.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,13 @@
siweMessage: string,
siweSignature: string,
) => Promise<IdentityAuthResult>;
+ // Users cannot restore backup from web
+ +restoreUser?: (
+ userID: string,
+ deviceList: SignedDeviceList,
+ siweMessage?: string,
+ siweSignature?: string,
+ ) => 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,42 @@
primaryIdentityPublicKeys.ed25519,
);
},
+ restoreUser: async (
+ userID: string,
+ deviceList: SignedDeviceList,
+ siweMessage?: string,
+ siweSignature?: string,
+ ) => {
+ 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.restoreUser(
+ userID,
+ 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:52 PM (2 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5939485
Default Alt Text
D13232.1768503144.diff (2 KB)

Event Timeline