Page MenuHomePhabricator

D11082.diff
No OneTemporary

D11082.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
@@ -67,6 +67,11 @@
userID: string,
) => Promise<UserDevicesOlmOutboundKeys[]>;
+generateNonce: () => Promise<string>;
+ +registerWalletUser?: (
+ walletAddress: string,
+ siweMessage: string,
+ siweSignature: string,
+ ) => Promise<IdentityAuthResult>;
+logInWalletUser: (
walletAddress: string,
siweMessage: string,
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
@@ -260,6 +260,45 @@
identityAuthResultValidator,
);
},
+ registerWalletUser: async (
+ walletAddress: string,
+ siweMessage: string,
+ siweSignature: string,
+ ) => {
+ await commCoreModule.initializeCryptoAccount();
+ const [
+ { blobPayload, signature },
+ { contentOneTimeKeys, notificationsOneTimeKeys },
+ prekeys,
+ ] = await Promise.all([
+ commCoreModule.getUserPublicKey(),
+ commCoreModule.getOneTimeKeys(ONE_TIME_KEYS_NUMBER),
+ commCoreModule.validateAndGetPrekeys(),
+ ]);
+ const registrationResult = await commRustModule.registerWalletUser(
+ siweMessage,
+ siweSignature,
+ blobPayload,
+ signature,
+ prekeys.contentPrekey,
+ prekeys.contentPrekeySignature,
+ prekeys.notifPrekey,
+ prekeys.notifPrekeySignature,
+ getOneTimeKeyValues(contentOneTimeKeys),
+ getOneTimeKeyValues(notificationsOneTimeKeys),
+ );
+ const { userID, accessToken: token } = JSON.parse(registrationResult);
+ const identityAuthResult = {
+ accessToken: token,
+ userID,
+ username: walletAddress,
+ };
+
+ return assertWithValidator(
+ identityAuthResult,
+ identityAuthResultValidator,
+ );
+ },
logInWalletUser: async (
walletAddress: string,
siweMessage: string,

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 25, 9:21 AM (21 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2579165
Default Alt Text
D11082.diff (2 KB)

Event Timeline