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

浏览器兼容性

另见