Skip to content

Commit 1da33e3

Browse files
authored
Merge pull request #67 from cometh-hq/develop
fix: multichain
2 parents eb7232f + 3c07199 commit 1da33e3

File tree

2 files changed

+30
-11
lines changed

2 files changed

+30
-11
lines changed

packages/sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"name": "yoanslvy"
77
}
88
],
9-
"version": "1.0.4",
9+
"version": "1.0.5",
1010
"description": "SDK Cometh Connect 4337",
1111
"repository": "https://github.com/cometh-hq/connect-sdk-4337.git",
1212
"keywords": [

packages/sdk/src/core/signers/passkeys/passkeyService.ts

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)