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

Add base64url helpers to browser exports #401

Closed MasterKale closed 1 year ago

MasterKale commented 1 year ago

Describe the issue

Discussion in #398 about adding some kind of support for the largeBlob extension left me with the impression that it's difficult to imagine largeBlob support getting generalized into some simple API here in the library due to its flexibility. However, the thought occurred to me that it could make things easier for RP's to work with such an extension if I exported browser's Base64URL <> ArrayBuffer helper methods for use in the browser.

The thinking goes, largeBlob's write takes an ArrayBuffer during registration that needs to be encoded in some manner to survive JSON transit from server to browser. And during authentication the value of blob is the same ArrayBuffer that has to be sent back to the server. Base64URL is already the common encoding between browser and server, and server already exposes such helpers, so why not do the same for browser?

Reproduction Steps

N/A

Expected behavior

N/A

Code Samples + WebAuthn Options and Responses

N/A

Dependencies

N/A

SimpleWebAuthn Libraries

N/A

Additional context

N/A

MasterKale commented 1 year ago

These are now available in the newly published @simplewebauthn/browser@8.2.0 ✌️