File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed
packages/thirdweb/src/wallets/in-app/core/authentication Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " thirdweb " : patch
3+ ---
4+
5+ Reduce async calls before requesting webauthn credentials for ios 15
Original file line number Diff line number Diff line change @@ -137,19 +137,17 @@ export async function loginWithPasskey(options: {
137137 }
138138 const fetchWithId = getClientFetch ( options . client , options . ecosystem ) ;
139139 // 1. request challenge from server/iframe
140- const res = await fetchWithId ( getChallengePath ( "sign-in" ) ) ;
141- const challengeData = await res . json ( ) ;
140+ const [ challengeData , credentialId ] = await Promise . all ( [
141+ fetchWithId ( getChallengePath ( "sign-in" ) ) . then ( ( r ) => r . json ( ) ) ,
142+ options . storage ?. getPasskeyCredentialId ( ) ,
143+ ] ) ;
142144 if ( ! challengeData . challenge ) {
143145 throw new Error ( "No challenge received" ) ;
144146 }
145147 const challenge = challengeData . challenge ;
146- // 1.2. find the user's credentialId in local storage
147- const credentialId =
148- ( await options . storage ?. getPasskeyCredentialId ( ) ) ?? undefined ;
149-
150148 // 2. initiate login
151149 const authentication = await options . passkeyClient . authenticate ( {
152- credentialId,
150+ credentialId : credentialId ?? undefined ,
153151 challenge,
154152 rp : options . rp ,
155153 } ) ;
You can’t perform that action at this time.
0 commit comments