AuthenticatorAttestationResponse: getPublicKey() method

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

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

js
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

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
getPublicKey
Chrome – Full support
Chrome 85 (Release date: 2020-08-25)
footnote Full support
Edge – Full support
Edge 85 (Release date: 2020-08-27)
footnote Full support
Firefox – Full support
Firefox 119 (Release date: 2023-10-24)
footnote Full support
Opera – Full support
Opera 71 (Release date: 2020-09-15)
footnote Full support
Safari – Partial support
Safari 16 (Release date: 2022-09-12)
footnote Partial support
footnote Supports only algorithm -7 (ES256). Does not support algorithms -8 (Ed25519) and -257 (RS256). See bug 312081.
Chrome Android – Full support
Chrome Android 85 (Release date: 2020-08-25)
footnote Full support
Firefox for Android – Full support
Firefox for Android 119 (Release date: 2023-10-24)
footnote Full support
Opera Android – Full support
Opera Android 60 (Release date: 2020-09-23)
footnote Full support
Safari on iOS – Partial support
Safari on iOS 16 (Release date: 2022-09-12)
footnote Partial support
footnote Supports only algorithm -7 (ES256). Does not support algorithms -8 (Ed25519) and -257 (RS256). See bug 312081.
Samsung Internet – Full support
Samsung Internet 14 (Release date: 2021-04-17)
footnote Full support
WebView Android – No support
WebView Android
footnote No support
WebView on iOS – Partial support
WebView on iOS 16 (Release date: 2022-09-12)
footnote Partial support
footnote Supports only algorithm -7 (ES256). Does not support algorithms -8 (Ed25519) and -257 (RS256). See bug 312081.

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Partial support
Partial support
No support
No support