@@ -360,17 +360,36 @@ const getPasskeySigner = async ({
360360 const webAuthnSignerForGivenChain = signingWebAuthnSigners . find (
361361 ( signer ) => + signer . chainId === chain . id
362362 ) ;
363- if ( ! webAuthnSignerForGivenChain )
363+
364+ let passkeyWithCoordinates : PasskeyLocalStorageFormat ;
365+
366+ if (
367+ signingWebAuthnSigners [ 0 ] ?. signerAddress !==
368+ safeWebAuthnSharedSignerAddress &&
369+ ! webAuthnSignerForGivenChain
370+ ) {
364371 throw new NoPasskeySignerFoundForGivenChain ( ) ;
372+ }
365373
366- const passkeyWithCoordinates : PasskeyLocalStorageFormat = {
367- id : webAuthnSignerForGivenChain . publicKeyId as Hex ,
368- pubkeyCoordinates : {
369- x : webAuthnSignerForGivenChain . publicKeyX as Hex ,
370- y : webAuthnSignerForGivenChain . publicKeyY as Hex ,
371- } ,
372- signerAddress : webAuthnSignerForGivenChain . signerAddress as Address ,
373- } ;
374+ if ( webAuthnSignerForGivenChain ) {
375+ passkeyWithCoordinates = {
376+ id : webAuthnSignerForGivenChain . publicKeyId as Hex ,
377+ pubkeyCoordinates : {
378+ x : webAuthnSignerForGivenChain . publicKeyX as Hex ,
379+ y : webAuthnSignerForGivenChain . publicKeyY as Hex ,
380+ } ,
381+ signerAddress : webAuthnSignerForGivenChain . signerAddress as Address ,
382+ } ;
383+ } else {
384+ passkeyWithCoordinates = {
385+ id : signingWebAuthnSigners [ 0 ] . publicKeyId as Hex ,
386+ pubkeyCoordinates : {
387+ x : signingWebAuthnSigners [ 0 ] . publicKeyX as Hex ,
388+ y : signingWebAuthnSigners [ 0 ] . publicKeyY as Hex ,
389+ } ,
390+ signerAddress : signingWebAuthnSigners [ 0 ] . signerAddress as Address ,
391+ } ;
392+ }
374393
375394 setPasskeyInStorage (
376395 smartAccountAddress ,
@@ -491,4 +510,4 @@ export {
491510 sign ,
492511 retrieveSmartAccountAddressFromPasskey ,
493512 retrieveSmartAccountAddressFromPasskeyId ,
494- } ;
513+ } ;
0 commit comments