Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions __tests__/passkey/passkeySigner.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import {
consumePasskeySigningCancelled,
PasskeyCancelledError,
PasskeyXpubMismatchError,
PasskeyMetadataMissingError,
PasskeyBusyError,
} from '../../src/passkey/passkeySigner';
/* eslint-enable import/first, import/order */
Expand Down Expand Up @@ -121,13 +122,16 @@ describe('makePasskeyTxSigner', () => {
expect(err.storedLabel).toBe(STORED_LABEL);
});

test('throws PasskeyXpubMismatchError when no xpub is stored at all', async () => {
test('throws PasskeyMetadataMissingError (not mismatch) when no xpub is stored at all', async () => {
// A missing stored xpub is corrupted/incomplete metadata, NOT a wrong passkey — it must be
// diagnosed distinctly (reset, not "use the other passkey").
STORE.getWalletMeta.mockReturnValue(makeMeta({ xpub: undefined }));

const signer = makePasskeyTxSigner();
const err = await signer(fakeTx, fakeStorage).catch((e) => e);

expect(err).toBeInstanceOf(PasskeyXpubMismatchError);
expect(err).toBeInstanceOf(PasskeyMetadataMissingError);
expect(err).not.toBeInstanceOf(PasskeyXpubMismatchError);
expect(transactionUtils.signTxInputs).not.toHaveBeenCalled();
});

Expand Down
Loading