MasterKale / SimpleWebAuthn

WebAuthn, Simplified. A collection of TypeScript-first libraries for simpler WebAuthn integration. Supports modern browsers, Node, Deno, and more.
https://simplewebauthn.dev
MIT License
1.62k stars 137 forks source link

fix/better-get-web-crypto #468

Closed MasterKale closed 1 year ago

MasterKale commented 1 year ago

This PR refines the logic inside server's getWebCrypto() to support more runtime environments. In particular it should now support CloudFlare Workers with Node polyfills enabled but still missing import('node:crypto').webcrypto (this is similar to Node v14 environments, but the CF docs don't explicitly state a target Node version and say they do support webcrypto in https://developers.cloudflare.com/workers/runtime-apis/nodejs/crypto/#webcrypto 🤷‍♂️)

Supercedes #457 (this PR also adds test coverage over this trickier method to write tests for.)

MasterKale commented 1 year ago

@sergiocarneiro This improved logic in getWebCrypto() is now available in @simplewebauthn/server@8.3.4. Give it a try and let me know if it solves the issue ✌️

MasterKale commented 1 year ago

cc @CameronWhiteside

sergiocarneiro commented 1 year ago

@MasterKale It's working ✅