Skip to content

Commit

Permalink
Migrate toJSON to instance method defs
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterKale committed Mar 2, 2022
1 parent 59ecbf3 commit 493095f
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1407,6 +1407,7 @@ that are returned to the caller when a new credential is created, or a new asser
[SameObject] readonly attribute AuthenticatorResponse response;
[SameObject] readonly attribute DOMString? authenticatorAttachment;
AuthenticationExtensionsClientOutputs getClientExtensionResults();
TBD toJSON();
};
</xmp>
<dl dfn-type="attribute" dfn-for="PublicKeyCredential">
Expand Down Expand Up @@ -1450,6 +1451,13 @@ that are returned to the caller when a new credential is created, or a new asser
[=extension identifier=][=client extension output=] entries produced by the extension's
[=client extension processing=].

: {{PublicKeyCredential/toJSON()}}
:: This operation returns a JSON-serialized representation of the instance of {{PublicKeyCredential}} suitable for submission
to a [=[RP]=] server as a payload with `application/json` mimetype. The [=client=] returns an object with the same structure
as the instance of the {{PublicKeyCredential}} with {{ArrayBuffer}} values encoded with [=base64url encoding=]. {{ArrayBuffer}}
values to be encoded are identified according to the detected type of the instance's `response` property, which will either be
{{AuthenticatorAttestationResponse}} or {{AuthenticatorAssertionResponse}}.

: <dfn>\[[type]]</dfn>
:: The {{PublicKeyCredential}} [=interface object=]'s {{Credential/[[type]]}} [=internal slot=]'s value is the string
"`public-key`".
Expand Down Expand Up @@ -2399,18 +2407,6 @@ Upon invocation, the [=client=] takes the provided options and returns an identi

</div>

### Serialize Registration and Authentication ceremony responses - PublicKeyCredential's `toJSON()` Method ### {#sctn-toJSON}

<div link-for-hint="WebAuthentication/toJSON">

[=[WRPS]=] use this method to convert the instance of {{PublicKeyCredential}} returned from {{CredentialsContainer/create()|navigator.credentials.create()}} or {{CredentialsContainer/get()|navigator.credentials.get()}} to a JSON-serialized representations suitable for submission to a [=[RP]=] server as a payload with `application/json` mimetype.

This method is intended to make WebAuthn API consumption tenable without requiring the use of third-party libraries.

Upon invocation, the [=client=] returns an object with the same structure as the instance of the {{PublicKeyCredential}} with {{ArrayBuffer}} values encoded with [=base64url encoding=]. {{ArrayBuffer}} values to be encoded are identified according to the detected type of the instance's `response` property, which will either be {{AuthenticatorAttestationResponse}} or {{AuthenticatorAssertionResponse}}.

</div>

## Authenticator Responses (interface <dfn interface>AuthenticatorResponse</dfn>) ## {#iface-authenticatorresponse}

[=Authenticators=] respond to [=[RP]=] requests by returning an object derived from the
Expand Down

0 comments on commit 493095f

Please sign in to comment.