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 @@ -201,7 +201,7 @@ registerUser: async (username: string, password: string) => { await commCoreModule.initializeCryptoAccount(); const [ - { blobPayload, signature }, + { blobPayload, signature, primaryIdentityPublicKeys }, { contentOneTimeKeys, notificationsOneTimeKeys }, prekeys, ] = await Promise.all([ @@ -224,15 +224,23 @@ const { userID, accessToken: token } = JSON.parse(registrationResult); const identityAuthResult = { accessToken: token, userID, username }; - return assertWithValidator( + const validatedResult = assertWithValidator( identityAuthResult, identityAuthResultValidator, ); + + await commCoreModule.setCommServicesAuthMetadata( + validatedResult.userID, + primaryIdentityPublicKeys.ed25519, + validatedResult.accessToken, + ); + + return validatedResult; }, logInPasswordUser: async (username: string, password: string) => { await commCoreModule.initializeCryptoAccount(); const [ - { blobPayload, signature }, + { blobPayload, signature, primaryIdentityPublicKeys }, { contentOneTimeKeys, notificationsOneTimeKeys }, prekeys, ] = await Promise.all([ @@ -255,10 +263,18 @@ const { userID, accessToken: token } = JSON.parse(loginResult); const identityAuthResult = { accessToken: token, userID, username }; - return assertWithValidator( + const validatedResult = assertWithValidator( identityAuthResult, identityAuthResultValidator, ); + + await commCoreModule.setCommServicesAuthMetadata( + validatedResult.userID, + primaryIdentityPublicKeys.ed25519, + validatedResult.accessToken, + ); + + return validatedResult; }, logInWalletUser: async ( walletAddress: string, @@ -267,7 +283,7 @@ ) => { await commCoreModule.initializeCryptoAccount(); const [ - { blobPayload, signature }, + { blobPayload, signature, primaryIdentityPublicKeys }, { contentOneTimeKeys, notificationsOneTimeKeys }, prekeys, ] = await Promise.all([ @@ -294,10 +310,18 @@ username: walletAddress, }; - return assertWithValidator( + const validatedResult = assertWithValidator( identityAuthResult, identityAuthResultValidator, ); + + await commCoreModule.setCommServicesAuthMetadata( + validatedResult.userID, + primaryIdentityPublicKeys.ed25519, + validatedResult.accessToken, + ); + + return validatedResult; }, generateNonce: commRustModule.generateNonce, }),