AuthenticatorAttestationResponse: getPublicKey() method

فهرست فصل‌ها دانلود آرشیوناشر

MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونه‌کد

{{APIRef("Web Authentication API")}}{{securecontext_header}}

The **getPublicKey()** method of the {{domxref("AuthenticatorAttestationResponse")}} interface returns an {{jsxref("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 {{domxref("CredentialsContainer.get()","navigator.credentials.get()")}}).

Syntax

js-nolint
getPublicKey()

Parameters

None.

Return value

An {{jsxref("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

{{Specifications}}

Browser compatibility

{{Compat}}