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

Change signature of `decodeClientDataJSON` to accept `Base64URLString` as paramater #525

Closed carlos-menezes closed 9 months ago

carlos-menezes commented 9 months ago

Describe the issue

At the moment, decodeClientDataJSON accepts a string as a parameter. In order to communicate effectively what kind of string it expects to receive, we should change the type to Base64URLString, as that's the type of clientDataJSON in AuthenticatorAssertionResponseJSON.

const credential = await startAuthentication(optionsJson);

if (!credential) {
  return null;
}

const decodedClientData = decodeClientDataJSON(credential.response.clientDataJSON) // `clientDataJSON` is of type Base64URLString`
MasterKale commented 9 months ago

Thanks for the suggestion to improve the developer ergonomics of decodeClientDataJSON(). The change has been made and will be available in the next release of @simplewebauthn/server@TBD (since this isn't a big enough change to warrant a release it'll have to wait till the next time I publish an update.)

MasterKale commented 7 months ago

@carlos-menezes This change is now available in the recently-published @simplewebauthn/server@10.0.0 ✌️