diff --git a/lib/actions/user-actions.js b/lib/actions/user-actions.js --- a/lib/actions/user-actions.js +++ b/lib/actions/user-actions.js @@ -457,6 +457,7 @@ function useIdentityPasswordRegister(): ( username: string, password: string, + fid: ?string, ) => Promise { const client = React.useContext(IdentityClientContext); const identityClient = client?.identityClient; @@ -470,6 +471,7 @@ walletAddress: string, siweMessage: string, siweSignature: string, + fid: ?string, ) => Promise { const client = React.useContext(IdentityClientContext); const identityClient = client?.identityClient; 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 @@ -129,3 +129,10 @@ +message: string, +signature: string, }; + +export type IdentityWalletRegisterInput = { + +address: string, + +message: string, + +signature: string, + +fid?: ?string, +}; diff --git a/native/account/registration/registration-server-call.js b/native/account/registration/registration-server-call.js --- a/native/account/registration/registration-server-call.js +++ b/native/account/registration/registration-server-call.js @@ -80,12 +80,16 @@ const { setFID } = fidContext; const identityRegisterUsernameAccount = React.useCallback( - async (accountSelection: UsernameAccountSelection) => { + async ( + accountSelection: UsernameAccountSelection, + farcasterID: ?string, + ) => { const identityRegisterPromise = (async () => { try { const result = await callIdentityPasswordRegister( accountSelection.username, accountSelection.password, + farcasterID, ); await setNativeCredentials({ username: accountSelection.username, @@ -208,7 +212,10 @@ keyserverURL, ); } else if (accountSelection.accountType === 'username') { - await identityRegisterUsernameAccount(accountSelection); + await identityRegisterUsernameAccount( + accountSelection, + farcasterID, + ); } else if (!usingCommServicesAccessToken) { try { await legacySiweServerCall(accountSelection, { @@ -227,6 +234,7 @@ address: accountSelection.address, message: accountSelection.message, signature: accountSelection.signature, + fid: farcasterID, }); } catch (e) { Alert.alert( diff --git a/native/account/siwe-hooks.js b/native/account/siwe-hooks.js --- a/native/account/siwe-hooks.js +++ b/native/account/siwe-hooks.js @@ -14,7 +14,10 @@ LogInStartingPayload, LogInExtraInfo, } from 'lib/types/account-types.js'; -import type { SIWEResult } from 'lib/types/siwe-types.js'; +import type { + SIWEResult, + IdentityWalletRegisterInput, +} from 'lib/types/siwe-types.js'; import { useLegacyAshoatKeyserverCall } from 'lib/utils/action-utils.js'; import type { CallSingleKeyserverEndpointOptions } from 'lib/utils/call-single-keyserver-endpoint.js'; import { useDispatchActionPromise } from 'lib/utils/redux-promise-utils.js'; @@ -113,12 +116,17 @@ ); } -function useIdentityWalletRegisterCall(): SIWEResult => Promise { +function useIdentityWalletRegisterCall(): IdentityWalletRegisterInput => Promise { const identityWalletRegister = useIdentityWalletRegister(); const dispatchActionPromise = useDispatchActionPromise(); return React.useCallback( - async ({ address, message, signature }) => { - const siwePromise = identityWalletRegister(address, message, signature); + async ({ address, message, signature, fid }) => { + const siwePromise = identityWalletRegister( + address, + message, + signature, + fid, + ); void dispatchActionPromise(identityRegisterActionTypes, siwePromise); await siwePromise; 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 @@ -296,7 +296,11 @@ oneTimeKeys.notificationsOneTimeKeys, ); }, - registerPasswordUser: async (username: string, password: string) => { + registerPasswordUser: async ( + username: string, + password: string, + fid: ?string, + ) => { await commCoreModule.initializeCryptoAccount(); const [ { blobPayload, signature, primaryIdentityPublicKeys }, @@ -318,7 +322,7 @@ prekeys.notifPrekeySignature, getOneTimeKeyValues(contentOneTimeKeys), getOneTimeKeyValues(notificationsOneTimeKeys), - '', + fid ?? '', ); const { userID, accessToken: token } = JSON.parse(registrationResult); const identityAuthResult = { accessToken: token, userID, username }; @@ -373,6 +377,7 @@ walletAddress: string, siweMessage: string, siweSignature: string, + fid: ?string, ) => { await commCoreModule.initializeCryptoAccount(); const [ @@ -395,7 +400,7 @@ prekeys.notifPrekeySignature, getOneTimeKeyValues(contentOneTimeKeys), getOneTimeKeyValues(notificationsOneTimeKeys), - '', + fid ?? '', ); const { userID, accessToken: token } = JSON.parse(registrationResult); const identityAuthResult = {