AuthenticatorAttestationResponse

Baseline 廣泛可用 *

此功能已成熟,並可在多種裝置和瀏覽器版本上執行。自 2021 年 9 月起,所有瀏覽器均已支援此功能。

* 此特性的某些部分可能存在不同級別的支援。

安全上下文: 此功能僅在安全上下文(HTTPS)中可用,且支援此功能的瀏覽器數量有限。

AuthenticatorAttestationResponse 介面是 Web Authentication API 的一部分,是 WebAuthn 憑證註冊的結果。它包含伺服器執行 WebAuthn 宣告所需的有關憑證的資訊,例如其憑證 ID 和公鑰。

一個 AuthenticatorAttestationResponse 物件例項可以在成功呼叫 CredentialsContainer.create() 返回的 PublicKeyCredential 物件的 response 屬性中找到。

此介面繼承自 AuthenticatorResponse

AuthenticatorResponse AuthenticatorAttestationResponse

注意: 此介面僅限於頂層上下文。在 <iframe> 元素內使用其功能不會產生任何效果。

例項屬性

也繼承了其父介面 AuthenticatorResponse 的屬性。

AuthenticatorAttestationResponse.attestationObject 只讀

一個 ArrayBuffer,包含認證器生成的新金鑰對的認證器資料和證明宣告。

AuthenticatorResponse.clientDataJSON 只讀

繼承自 AuthenticatorResponse,此屬性包含從瀏覽器傳遞給認證器以生成此憑證的資料的 JSON 相容序列化——即,當使用 publicKey 選項呼叫 CredentialsContainer.create() 時。這些資料包含來自傳遞給 create() 呼叫的選項的一些資訊,以及一些由瀏覽器控制的資訊。

例項方法

AuthenticatorAttestationResponse.getAuthenticatorData()

返回一個 ArrayBuffer,其中包含 AuthenticatorAttestationResponse.attestationObject 屬性中的認證器資料。

AuthenticatorAttestationResponse.getPublicKey()

返回一個 ArrayBuffer,其中包含新憑證的 DER SubjectPublicKeyInfo(參見 Subject Public Key Info),如果不可用則返回 null

AuthenticatorAttestationResponse.getPublicKeyAlgorithm()

返回一個數字,該數字等於一個 COSE 演算法識別符號,表示用於新憑證的加密演算法。

AuthenticatorAttestationResponse.getTransports()

返回一個字串陣列,描述了(例如 usbnfc)被認為與認證器支援的傳輸方法。如果資訊不可用,陣列可能為空。

示例

有關詳細示例,請參閱 建立公鑰憑證

規範

規範
Web Authentication:訪問公鑰憑證的 API - 第 3 級
# authenticatorattestationresponse

瀏覽器相容性

另見