diff --git a/lib/types/siwe-types.js b/lib/types/siwe-types.js --- a/lib/types/siwe-types.js +++ b/lib/types/siwe-types.js @@ -155,7 +155,7 @@ +siweIssuedAt: string, }; -export type SIWEBackupSecrets = { +export type SignedMessage = { +message: string, +signature: string, }; diff --git a/native/account/registration/registration-terms.react.js b/native/account/registration/registration-terms.react.js --- a/native/account/registration/registration-terms.react.js +++ b/native/account/registration/registration-terms.react.js @@ -4,7 +4,7 @@ import * as React from 'react'; import { Text, View, Image, Linking } from 'react-native'; -import type { SIWEBackupSecrets } from 'lib/types/siwe-types.js'; +import type { SignedMessage } from 'lib/types/siwe-types.js'; import type { AuthNavigationProp } from './auth-navigator.react.js'; import { RegistrationContext } from './registration-context.js'; @@ -30,7 +30,7 @@ +farcasterID: ?string, +accountSelection: AccountSelection, +avatarData: ?AvatarData, - +siweBackupSecrets?: ?SIWEBackupSecrets, + +siweBackupSecrets?: ?SignedMessage, +farcasterAvatarURL: ?string, }, }; diff --git a/native/account/registration/registration-types.js b/native/account/registration/registration-types.js --- a/native/account/registration/registration-types.js +++ b/native/account/registration/registration-types.js @@ -5,7 +5,7 @@ ClientAvatar, } from 'lib/types/avatar-types.js'; import type { NativeMediaSelection } from 'lib/types/media-types.js'; -import type { SIWEResult, SIWEBackupSecrets } from 'lib/types/siwe-types.js'; +import type { SIWEResult, SignedMessage } from 'lib/types/siwe-types.js'; export type CoolOrNerdMode = 'cool' | 'nerd'; @@ -43,7 +43,7 @@ +farcasterID: ?string, +accountSelection: AccountSelection, +avatarData: ?AvatarData, - +siweBackupSecrets?: ?SIWEBackupSecrets, + +siweBackupSecrets?: ?SignedMessage, +farcasterAvatarURL: ?string, +clearCachedSelections: () => void, +onNonceExpired: () => mixed, @@ -58,7 +58,7 @@ +avatarData?: ?AvatarData, +ethereumAccount?: ?EthereumAccountSelection, +farcasterID?: string, - +siweBackupSecrets?: ?SIWEBackupSecrets, + +siweBackupSecrets?: ?SignedMessage, +farcasterAvatarURL?: ?string, }; diff --git a/native/account/restore-backup-screen.react.js b/native/account/restore-backup-screen.react.js --- a/native/account/restore-backup-screen.react.js +++ b/native/account/restore-backup-screen.react.js @@ -4,6 +4,7 @@ import { Text, View } from 'react-native'; import * as Progress from 'react-native-progress'; +import type { SignedMessage } from 'lib/types/siwe-types.js'; import { getMessageForException } from 'lib/utils/errors.js'; import AuthContainer from './auth-components/auth-container.react.js'; @@ -35,9 +36,8 @@ } | { +type: 'siwe', - +secret: string, - +message: string, - +signature: string, + +socialProof: SignedMessage, + +backup: SignedMessage, }, }; @@ -60,14 +60,11 @@ } else { await restore( userIdentifier, - credentials.secret, - credentials.message, - credentials.signature, + credentials.backup.signature, + credentials.socialProof.message, + credentials.socialProof.signature, ); - await commCoreModule.setSIWEBackupSecrets({ - message: credentials.message, - signature: credentials.signature, - }); + await commCoreModule.setSIWEBackupSecrets(credentials.backup); } } catch (e) { const messageForException = getMessageForException(e); diff --git a/native/backup/restore-siwe-backup.react.js b/native/backup/restore-siwe-backup.react.js --- a/native/backup/restore-siwe-backup.react.js +++ b/native/backup/restore-siwe-backup.react.js @@ -45,9 +45,14 @@ userIdentifier, credentials: { type: 'siwe', - secret: result.signature, - message, - signature, + socialProof: { + message, + signature, + }, + backup: { + message: result.message, + signature: result.signature, + }, }, }); }, diff --git a/native/schema/CommCoreModuleSchema.js b/native/schema/CommCoreModuleSchema.js --- a/native/schema/CommCoreModuleSchema.js +++ b/native/schema/CommCoreModuleSchema.js @@ -16,7 +16,7 @@ OutboundSessionCreationResult, } from 'lib/types/crypto-types.js'; import type { ClientDBMessageInfo } from 'lib/types/message-types.js'; -import type { SIWEBackupSecrets } from 'lib/types/siwe-types.js'; +import type { SignedMessage } from 'lib/types/siwe-types.js'; import type { InboundP2PMessage, OutboundP2PMessage, @@ -231,10 +231,8 @@ sessionVersion: number, overwrite: boolean, ) => Promise; - +setSIWEBackupSecrets: ( - siweBackupSecrets: SIWEBackupSecrets, - ) => Promise; - +getSIWEBackupSecrets: () => Promise; + +setSIWEBackupSecrets: (siweBackupSecrets: SignedMessage) => Promise; + +getSIWEBackupSecrets: () => Promise; +processDBStoreOperations: ( operations: ClientDBStoreOperations, ) => Promise;