W3cubDocs

/Web APIs

AuthenticatorAttestationResponse: getPublicKey() method

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

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
getPublicKey 85 85 119 No 71 16 No 85 119 60 16 14.0

© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/AuthenticatorAttestationResponse/getPublicKey