Repository navigation
refactor(passkey): replace canonify with canonicalize - #503
Merged
Merged
Conversation
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
Contributor
|
🎉 This PR is included in version 5.4.2 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
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
Replaces the
canonifypackage withcanonicalizein the passkey adapter, the SIWA examples and the signing-data guide.canonifyis now deprecated on npm in favor ofcanonicalize, 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
signDatausescanonicalizeto check that SIWA data is already in canonical form. The check now runs inside the decodetryblock, so inputcanonicalizerejects fails withBad JSON(4609) rather than a bareError.canonicalizeinstead ofcanonify.canonicalize.Behavior change
The passkey adapter now rejects SIWA data that contains an escaped lone surrogate (e.g.
"\ud800"), with error 4609.canonifyserialized it, so such data could pass the canonical-form check before. RFC 8785 doesn't allow lone surrogates. A new test covers this case.