AuthenticatorAttestationResponse: getPublicKey() method
Baseline
Widely available
*
This feature is well established and works across many devices and browser versions. It’s been available across browsers since October 2023.
* Some parts of this feature may have varying levels of support.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
The getPublicKey() method of the AuthenticatorAttestationResponse interface returns an ArrayBuffer containing the DER SubjectPublicKeyInfo of the new credential (see Subject Public Key Info), or null if this is not available.
This is a convenience function, created to allow easy access to the public key. This key will need to be stored in order to verify future authentication operations (i.e., using navigator.credentials.get()).
Syntax
getPublicKey()
Parameters
None.
Return value
An ArrayBuffer containing the DER SubjectPublicKeyInfo of the new credential (see Subject Public Key Info), or null if this is not available.
Examples
See Creating a public key credential for a detailed example.
Specifications
| Specification |
|---|
| Web Authentication: An API for accessing Public Key Credentials - Level 3> # dom-authenticatorattestationresponse-getpublickey> |