AuthenticatorAttestationResponse: attestationObject 屬性

Baseline 已廣泛支援

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

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

AuthenticatorAttestationResponse 介面的 attestationObject 屬性返回一個 ArrayBuffer,其中包含新的公鑰,以及使用裝置製造時儲存在身份驗證器中的私鑰對整個 attestationObject 的簽名。

作為 CredentialsContainer.create() 呼叫的一部分,身份驗證器將為該金鑰對建立一個新的金鑰對以及一個 attestationObject。生成此證明簽名的私鑰對應的公鑰是眾所周知的;但是,對於不同的生態系統(例如 Android 或 TPM 證明),存在各種眾所周知的證明公鑰鏈。

解碼 CBOR 編碼的 ArrayBuffer 後,生成的 JavaScript 物件將包含以下屬性:

authData

操作的 身份驗證器資料。請注意,在 AuthenticatorAssertionResponse 中,authenticatorData 作為 JavaScript 物件中的一個屬性公開(參見 AuthenticatorAssertionResponse.authenticatorData),而在 AuthenticatorAttestationResponse 中,authenticatorDataCBOR 對映中的一個屬性。

AuthenticatorAttestationResponseAuthenticatorAssertionResponse 都使用相同的 AuthenticatorAssertionResponse.authenticatorData 欄位。在證明中使用時,它包含一個可選欄位 attestedCredentialData。在 AuthenticatorAssertionResponse 中使用時,不包含此欄位。attestedCredentialData 欄位包含 credentialIdcredentialPublicKey

fmt

一個指示證明語句格式的文字字串。WebAuthn 規範定義了多種格式;但是,其他規範也可以定義格式並在 IANA 登錄檔中註冊。WebAuthn 定義的格式包括:

  • "packed"
  • "tpm"
  • "android-key"
  • "android-safetynet"
  • "fido-u2f"
  • "none"
attStmt

一個由 "fmt" 定義格式的證明語句。目前,請參閱 WebAuthn 規範瞭解每種格式的詳細資訊

示例

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

規範

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

瀏覽器相容性

另見

  • CredentialsContainer.create():用於建立帶有加密 challenge 的宣告的方法,該宣告由身份驗證器簽名,簽名包含在 attStmt 中,並使用指定的 attestation 傳輸選項。