Skip to content

refactor(passkey): replace canonify with canonicalize - #503

Merged
drichar merged 3 commits into
mainfrom
chore/examples-canonicalize
Nov 24, 2026
Merged

drichar merged 3 commits into
mainfrom
chore/examples-canonicalize

Conversation

@drichar

@drichar drichar commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

Replaces the canonify package with canonicalize in the passkey adapter, the SIWA examples and the signing-data guide. canonify is now deprecated on npm in favor of canonicalize, which is actively maintained, ships its own types, and rejects input RFC 8785 doesn't allow (NaN, Infinity, lone surrogates, circular references) instead of serializing it.

Changes

  • Passkey adapter: signData uses canonicalize to check that SIWA data is already in canonical form. The check now runs inside the decode try block, so input canonicalize rejects fails with Bad JSON (4609) rather than a bare Error.
  • Examples: all seven examples (Next, Nuxt, React, Solid, Svelte, Vanilla TS, Vue) import canonicalize instead of canonify.
  • Docs: the install command and code samples in the signing-data guide now use canonicalize.

Behavior change

The passkey adapter now rejects SIWA data that contains an escaped lone surrogate (e.g. "\ud800"), with error 4609. canonify serialized it, so such data could pass the canonical-form check before. RFC 8785 doesn't allow lone surrogates. A new test covers this case.

The canonify package is being retired in favor of canonicalize.
Updates the SIWA examples and the signing-data guide.
The canonify package is being retired in favor of canonicalize. The
SIWA canonical-form check now runs inside the decode try block, so
data canonicalize rejects (an escaped lone surrogate, which RFC 8785
does not allow) fails with Bad JSON (4609) instead of a bare Error.
# Conflicts:
#	examples/next/package.json
#	examples/nuxt/package.json
#	examples/react/package.json
#	examples/solid/package.json
#	examples/svelte/package.json
#	examples/vanilla-ts/package.json
#	examples/vue/package.json
#	pnpm-lock.yaml
@drichar
drichar merged commit cef10da into main Nov 24, 2026
1 check passed
@drichar
drichar deleted the chore/examples-canonicalize branch November 24, 2026 15:26
@txnlab-release-bot

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 5.4.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant