Class PublicKeyCredential<A extends AuthenticatorResponse,B extends ClientExtensionOutputs>
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
PublicKeyCredential.PublicKeyCredentialBuilder<A extends AuthenticatorResponse,
B extends ClientExtensionOutputs> -
Method Summary
Modifier and TypeMethodDescriptionstatic <A extends AuthenticatorResponse,
B extends ClientExtensionOutputs>
PublicKeyCredential.PublicKeyCredentialBuilder<A,B>.MandatoryStages builder()
boolean
Deprecated.EXPERIMENTAL: This feature is from a not yet mature standard; it could change as the standard matures.A map containing extension identifier → client extension output entries produced by the extension’s client extension processing.@NonNull ByteArray
getId()
The raw Credential ID of this credential, corresponding to therawId
attribute in the WebAuthn API.The authenticator's response to the client’s request to either create a public key credential, or generate an authentication assertion.@NonNull PublicKeyCredentialType
getType()
ThePublicKeyCredential
's type value is the string "public-key".int
hashCode()
Parse aPublicKeyCredential
object from JSON.Parse aPublicKeyCredential
object from JSON.toString()
-
Method Details
-
getAuthenticatorAttachment
Deprecated.EXPERIMENTAL: This feature is from a not yet mature standard; it could change as the standard matures.The authenticator attachment modality in effect at the time the credential was created or used.If parsed from JSON, this will be present if and only if the input was a valid value of
AuthenticatorAttachment
.The same value will also be available via
RegistrationResult.getAuthenticatorAttachment()
orAssertionResult.getAuthenticatorAttachment()
on the result fromRelyingParty.finishRegistration(FinishRegistrationOptions)
orRelyingParty.finishAssertion(FinishAssertionOptions)
. -
builder
public static <A extends AuthenticatorResponse,B extends ClientExtensionOutputs> PublicKeyCredential.PublicKeyCredentialBuilder<A,B>.MandatoryStages builder() -
parseRegistrationResponseJson
public static PublicKeyCredential<AuthenticatorAttestationResponse,ClientRegistrationExtensionOutputs> parseRegistrationResponseJson(String json) throws IOException Parse aPublicKeyCredential
object from JSON.The
json
should be of the following format:{ "id": "(resp.id)", "response": { "attestationObject": "(Base64Url encoded resp.attestationObject)", "clientDataJSON": "(Base64Url encoded resp.clientDataJSON)" }, "clientExtensionResults": { (resp.getClientExtensionResults()) }, "type": "public-key" }
- resp:
- The PublicKeyCredential object returned from a registration ceremony.
- id:
- The string value of
resp.id
- response.attestationObject:
- The value of
resp.attestationObject
, Base64Url encoded as a string - response.clientDataJSON:
- The value of
resp.clientDataJSON
, Base64Url encoded as a string - clientExtensionResults:
- The return value of
resp.getClientExtensionResults()
- type:
- The literal string value
"public-key"
- Parameters:
json
- a JSON string of the above format- Throws:
IOException
- if thejson
is invalid or cannot be decoded as aPublicKeyCredential
-
parseAssertionResponseJson
public static PublicKeyCredential<AuthenticatorAssertionResponse,ClientAssertionExtensionOutputs> parseAssertionResponseJson(String json) throws IOException Parse aPublicKeyCredential
object from JSON.The
json
should be of the following format:{ "id": "(resp.id)", "response": { "authenticatorData": "(Base64Url encoded resp.authenticatorData)", "signature": "(Base64Url encoded resp.signature)", "clientDataJSON": "(Base64Url encoded resp.clientDataJSON)", "userHandle": "(null, undefined or Base64Url encoded resp.userHandle)" }, "clientExtensionResults": { (resp.getClientExtensionResults()) }, "type": "public-key" }
- resp:
- The PublicKeyCredential object returned from an authentication ceremony.
- id:
- The string value of
resp.id
- response.authenticatorData:
- The value of
resp.authenticatorData
, Base64Url encoded as a string - response.signature:
- The value of
resp.signature
, Base64Url encoded as a string - response.clientDataJSON:
- The value of
resp.clientDataJSON
, Base64Url encoded as a string - response.userHandle:
- The value of
resp.userHandle
Base64Url encoded as a string if present, otherwisenull
orundefined
- clientExtensionResults:
- The return value of
resp.getClientExtensionResults()
- type:
- The literal string value
"public-key"
- Parameters:
json
- a JSON string of the above format- Throws:
IOException
- if thejson
is invalid or cannot be decoded as aPublicKeyCredential
-
toBuilder
-
getId
The raw Credential ID of this credential, corresponding to therawId
attribute in the WebAuthn API. -
getResponse
The authenticator's response to the client’s request to either create a public key credential, or generate an authentication assertion.If the
PublicKeyCredential
was created in response tonavigator.credentials.create()
, this attribute’s value will be anAuthenticatorAttestationResponse
, otherwise, thePublicKeyCredential
was created in response tonavigator.credentials.get()
, and this attribute’s value will be anAuthenticatorAssertionResponse
. -
getClientExtensionResults
A map containing extension identifier → client extension output entries produced by the extension’s client extension processing. -
getType
ThePublicKeyCredential
's type value is the string "public-key". -
equals
-
hashCode
public int hashCode() -
toString
-