Skip to content

feat(sdk): support signing on edge and browser runtimes - #1

Open
timo126 wants to merge 1 commit into
mainfrom
fix/sdk-webcrypto-signing-101
Open

feat(sdk): support signing on edge and browser runtimes#1
timo126 wants to merge 1 commit into
mainfrom
fix/sdk-webcrypto-signing-101

Conversation

@timo126

@timo126 timo126 commented Aug 27, 2026

Copy link
Copy Markdown
Owner

Summary

Adds portable Ed25519 settlement signing for @accensa/sdk, enabling route-attribution reports from edge and browser-compatible runtimes while preserving Node.js support.

Changes

  • Feature-detects globalThis.crypto?.subtle and attempts WebCrypto Ed25519 first.
  • Falls back to node:crypto only when WebCrypto is unavailable or does not support Ed25519.
  • Shares the RFC 8410 PKCS#8 wrapper for raw 32-byte Ed25519 seeds between signing paths.
  • Validates private keys before constructing the PKCS#8 key.
  • Keeps unsupported environments loud and actionable instead of sending unsigned reports.
  • Adds coverage for unavailable signing capability and preserves existing settlement delivery coverage.
  • Documents supported and tested runtimes: Node.js, Vercel Edge Functions, Cloudflare Workers, and Deno Deploy.

Verification

  • pnpm --filter @accensa/sdk test — 117 tests passed.
  • pnpm --filter @accensa/sdk typecheck — passed.
  • git diff --check — passed.

Compatibility

Signatures remain Ed25519 signatures over the exact UTF-8 request body and continue to use the existing X-Signature header, so the /api/hook/settle verification contract is unchanged.

Closes accensa#101

Enable settlement signing in edge and browser runtimes while retaining the Node.js fallback, and document supported runtimes.

Closes accensa#101

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(sdk): support signing on edge and browser runtimes via WebCrypto

1 participant