clientDataJSON

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The clientDataJSON object is an ArrayBuffer containing a JSON String of the various browser data that was used for the WebAuthn create() or get() call. It is included in both an AuthenticatorAttestationResponse and an AuthenticatorAssertionResponse within a PublicKeyCredential. The reason for storing the data as a ArrayBuffer rather than a String or an actual JavaScript object is that the object is effectively signed over by the authenticator, and if the order of the properties of the JavaScript object were not preserved then the signature verification would fail.

Syntax

TBD

Properties

After the clientDataJSON is converted from an ArrayBuffer to a JavaScript object, it will have the following properties:

clientDataJSON.type
TBD
clientDataJSON.challenge
TBD
clientDataJSON.origin
TBD
clientDataJSON.tokenBindingId Optional
TBD
clientDataJSON.clientExtensions Optional
TBD
clientDataJSON.authenticatorExtensions Optional
TBD

Examples

function arrayBufferToStr(buf) {
    return String.fromCharCode.apply(null, new Uint8Array(buf));
}

// pk is a PublicKeyCredential that is the result of a create() or get() Promise
var clientDataStr = arrayBufferToStr(pk.clientDataJSON);
var clientDataObj = JSON.parse(clientDataStr);

console.log (clientDataObj.type); // "webauthn.create" or "webauthn.get"
console.log (clientDataObj.challenge); // base64 encoded String containing the original challenge
console.log (clientDataObj.origin); // the window.origin

Specifications

Specification Status Comment
Web Authentication Level 1 Working Draft Initial definition.

Browser compatibility

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support Nightly build Nightly build No support No support No support
Feature Android Webview Chrome for Android Firefox Mobile (Gecko) Firefox OS IE Phone Opera Mobile Safari Mobile
Basic support No support Nightly build No support No support No support No support No support

Document Tags and Contributors

 Contributors to this page: apowers313
 Last updated by: apowers313,