Skip to content

chore(deps): remove deprecated arctic and move @oslojs/crypto hashing to @noble/hashes - #4761

Open
danielmlr wants to merge 2 commits into
mainfrom
daniel/auth-noble-hashes
Open

danielmlr wants to merge 2 commits into
mainfrom
daniel/auth-noble-hashes

Conversation

@danielmlr

Copy link
Copy Markdown
Contributor

What does this PR do?

Removes the deprecated arctic package and moves SHA-256 and HMAC hashing outside the passkey code from the deprecated @oslojs/crypto to @noble/hashes. arctic was only used to make random codes in the device flow and the authorization code flow, and generateToken() from @emdash-cms/auth makes the same 32 random bytes. @noble/hashes is synchronous, so the token helpers in @emdash-cms/auth keep their signatures. The constant-time compare is now a small local function.

The hashes come out the same, so existing API tokens, invites, magic links, encryption keys and plugin storage indexes keep working. The Cloudflare dev optimizeDeps list follows the new imports.

Passkeys still use the oslo packages, so those stay for now. This removes arctic and @oslojs/jwt from what emdash installs, and every oslo package from @emdash-cms/plugin-cli.

Part of #3550

Type of change

  • Bug fix
  • Feature (requires an accepted feature plan or RFC)
  • Refactor (no behavior change)
  • Translation
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Your connection to this change

  • I use EmDash and ran into the problem this PR addresses
  • I maintain a tool, dependency, or service that EmDash uses, and this change concerns that integration
  • A Maintainer approved this specific change before I opened the PR

I'm a Maintainer, and I took this on while triaging #3550.

Checklist

  • I have read CONTRIBUTING.md
  • pnpm typecheck passes
  • pnpm lint passes
  • pnpm test passes (or targeted tests for my change)
  • pnpm format has been run
  • I have added/updated tests for my changes (if applicable)
  • User-visible strings in the admin UI are wrapped for translation (if applicable). Do not include messages.po changes except in translation PRs — a workflow extracts catalogs on merge to main. (n/a: no admin UI change)
  • I have added and reviewed the user-facing changeset (if this PR changes a published package)
  • New features link to their merged design PR: https://github.com/emdash-cms/emdash/pull/... (n/a: dependency change)
  • I have included screenshots below if this PR changes the UI (n/a: no UI change)

AI assistance disclosure

  • This PR includes AI-generated code or text — model/tool: Claude Code (Claude Opus 5.5)

Screenshots / test output

New tests pin the SHA-256 output of token hashes, the encryption key ID, a hashed plugin index name and a context-bound passkey challenge. They passed on main before the switch and still pass, along with the existing PKCE, site transfer and plugin multihash vectors. On workerd, the site transfer test checks the @noble/hashes fallback against one of those vectors. That fallback's internal name changes from oslo to noble; it isn't exported.

On the Cloudflare starter template with a cold Vite cache, dev bypass, an API token request, the device flow and both passkey option routes work, and Vite doesn't have to add @noble/hashes or an oslo package after startup. Without the new optimizeDeps entries, the same requests cause two re-optimize and reload cycles.

Token hashes, encryption key IDs, hashed plugin index names and
context-bound passkey challenges are all derived from SHA-256 and kept
in the database. Fixed vectors make any change to how they are computed
fail loudly instead of silently orphaning existing rows.
…h @noble/hashes

arctic and @oslojs/crypto are deprecated on npm and print warnings on
every install. arctic was only used for generateCodeVerifier(), which
is the same 32 random base64url bytes as generateToken() in
@emdash-cms/auth. SHA-256 and HMAC move to @noble/hashes, which is
synchronous, so the public token helpers in @emdash-cms/auth keep their
signatures. The passkey code still uses @oslojs/crypto and
@oslojs/webauthn and is left for a separate change.

The Cloudflare dev optimizeDeps list follows the new imports so the
first authenticated request does not trigger a re-optimize and reload.
@changeset-bot

changeset-bot Bot commented Nov 8, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 66fe122

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
emdash Patch
@emdash-cms/auth Patch
@emdash-cms/plugin-cli Patch
@emdash-cms/cloudflare Patch
@emdash-cms/plugin-test Patch
@emdash-cms/sandbox-workerd Patch
@emdash-cms/auth-atproto Patch
@emdash-cms/admin Patch
@emdash-cms/blocks Patch
create-emdash Patch
@emdash-cms/gutenberg-to-portable-text Patch
@emdash-cms/x402 Patch
@emdash-cms/plugin-embeds Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@emdashbot emdashbot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The approach is sound. Replacing the deprecated arctic and moving SHA-256 and HMAC from @oslojs/crypto to @noble/hashes clears the install deprecation warnings (#3550) with low risk. Both reviewers approved and neither raised any findings. Hash inputs and encodings are unchanged, and generateToken() keeps the same format and entropy as before. The local constant-time comparison works on fixed-length HMAC digests. Passkey code still uses the oslo packages, and the dependency manifests, Vite optimizeDeps entries, new fixed-vector tests and changeset all look correct. Review was static; tests and builds were not run.


Reviewed by anthropic/claude-opus-5-5 and openai/gpt-6.1-sol.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://daniel-auth-noble-hashes.try.emdashcms.com, https://daniel-auth-noble-hashes-emdash-playground.emdash-cms.workers.dev (commit 66fe122)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://7120367b.try.emdashcms.com, https://7120367b-emdash-playground.emdash-cms.workers.dev 66fe122 2026-11-08T02:11:52.618Z Visit the dashboard ↗

@pkg-pr-new

pkg-pr-new Bot commented Nov 8, 2026

Copy link
Copy Markdown

Open in StackBlitz

@emdash-cms/admin

npm i https://pkg.pr.new/@emdash-cms/admin@4761

@emdash-cms/auth

npm i https://pkg.pr.new/@emdash-cms/auth@4761

@emdash-cms/auth-atproto

npm i https://pkg.pr.new/@emdash-cms/auth-atproto@4761

@emdash-cms/blocks

npm i https://pkg.pr.new/@emdash-cms/blocks@4761

@emdash-cms/cloudflare

npm i https://pkg.pr.new/@emdash-cms/cloudflare@4761

@emdash-cms/contentful-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/contentful-to-portable-text@4761

emdash

npm i https://pkg.pr.new/emdash@4761

create-emdash

npm i https://pkg.pr.new/create-emdash@4761

@emdash-cms/gutenberg-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/gutenberg-to-portable-text@4761

@emdash-cms/plugin-cli

npm i https://pkg.pr.new/@emdash-cms/plugin-cli@4761

@emdash-cms/plugin-test

npm i https://pkg.pr.new/@emdash-cms/plugin-test@4761

@emdash-cms/plugin-types

npm i https://pkg.pr.new/@emdash-cms/plugin-types@4761

@emdash-cms/registry-client

npm i https://pkg.pr.new/@emdash-cms/registry-client@4761

@emdash-cms/registry-lexicons

npm i https://pkg.pr.new/@emdash-cms/registry-lexicons@4761

@emdash-cms/registry-loader

npm i https://pkg.pr.new/@emdash-cms/registry-loader@4761

@emdash-cms/registry-moderation

npm i https://pkg.pr.new/@emdash-cms/registry-moderation@4761

@emdash-cms/registry-verification

npm i https://pkg.pr.new/@emdash-cms/registry-verification@4761

upgrade-emdash

npm i https://pkg.pr.new/upgrade-emdash@4761

@emdash-cms/sandbox-workerd

npm i https://pkg.pr.new/@emdash-cms/sandbox-workerd@4761

@emdash-cms/x402

npm i https://pkg.pr.new/@emdash-cms/x402@4761

@emdash-cms/plugin-ai-moderation

npm i https://pkg.pr.new/@emdash-cms/plugin-ai-moderation@4761

@emdash-cms/plugin-ai-search

npm i https://pkg.pr.new/@emdash-cms/plugin-ai-search@4761

@emdash-cms/plugin-atproto

npm i https://pkg.pr.new/@emdash-cms/plugin-atproto@4761

@emdash-cms/plugin-audit-log

npm i https://pkg.pr.new/@emdash-cms/plugin-audit-log@4761

@emdash-cms/plugin-color

npm i https://pkg.pr.new/@emdash-cms/plugin-color@4761

@emdash-cms/plugin-embeds

npm i https://pkg.pr.new/@emdash-cms/plugin-embeds@4761

@emdash-cms/plugin-field-kit

npm i https://pkg.pr.new/@emdash-cms/plugin-field-kit@4761

@emdash-cms/plugin-forms

npm i https://pkg.pr.new/@emdash-cms/plugin-forms@4761

@emdash-cms/plugin-webhook-notifier

npm i https://pkg.pr.new/@emdash-cms/plugin-webhook-notifier@4761

commit: 66fe122

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant