Repository navigation
fix(wdk): keep signed-in wallets on sign-up and allow reusing a stored passkey - #1058
Merged
Merged
Conversation
…login signUp wrote a placeholder entry for every existing wallet of the login and deleted them when the wallet selector returned create-new (or kept only those with a device on abort-signup). A wallet already signed in on this device lost its session. Only add and clean up placeholders for wallets without a session, matching stored entries regardless of address casing.
Passkey sign-up always created a new WebAuthn credential, so a second wallet for a passkey user got a separate login. With credentialId the signer is built from the stored credential (with the credential id in its metadata, so other devices can load it from the witness) and the stored record now points at the new wallet.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
A passkey's image hash includes its public key's metadata. Signers built from a stored credential always set embedMetadata to false, so for a public key with metadata the signature proved a different image hash and its witness was indexed under it. Derive the flag from the public key, for sign-up with a stored passkey and for login with a credential id.
taylanpince
approved these changes
Nov 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two
signUpfixes in@0xsequence/wallet-wdk, needed to create a second wallet for a login that already has one signed in on this device. wallet-webapp-v3 uses this to move users off wallets set up by an older SDK (0xsequence/wallet-webapp-v3#393) and carries both changes as a pnpm patch on 3.1.3 until they're released.Changes
Keep signed-in wallets when signing up again with the same login (
d345317e0)signUpwrote a placeholder entry for every existing wallet of the login. It then deleted them when the wallet selector returnedcreate-new, or kept only those with a device onabort-signup.Sign up with a stored passkey (
28210bcd7)credentialIdargument on passkey sign-up: the signer is built from the stored credential, with the credential id in its metadata so other devices can load it from the witness. The stored credential record then points at the new wallet.Embed a stored passkey's metadata when signing with it (
ecb6c4c1c)A passkey's image hash includes its public key's metadata (the credential id) when the key has any. Signatures only carry that metadata when the signer's
embedMetadatais set, and whatever decodes a signature rebuilds the public key from what it carries.Signers built from a stored credential hardcoded
embedMetadata: false. That covers both sign-up withcredentialId(new above) and login withcredentialId(already on master). So for a public key with metadata, the signature verified but proved a different image hash. The new wallet's witness was indexed under that hash, and loading the passkey for the wallet failed with "Witness for wallet not found".The flag is now derived from the stored key:
embedMetadata: credential.publicKey.metadata !== undefined. That's the same as signing in by passkey discovery (loadFromWitness), which already takes it from the witness.No change for existing passkeys.
Passkey.createonly adds metadata when asked to, and the WDK's sign-up never asks, so passkeys created through the WDK have none. For them the flag staysfalse, and they sign exactly as before. I checked this with the real signer and encoder for both kinds of key:A stored key's metadata always matches the wallet's configuration: the credential store saves the signer's own public key, and a passkey's witness carries that same key.
All three changes have patch changesets.
Testing
test/wallets.test.ts(43 tests, including a regression for the kept session) and the newtest/passkey-reuse.test.ts(5 tests) pass. The embedded-metadata case fails without the fix, with "Witness for wallet not found".pnpm typecheck,pnpm lintand Prettier pass for the package.tests.ymlruns them.