AuthenticatorAttestationResponse: getAuthenticatorData() 方法

Baseline 2023
新推出

自 ⁨2023 年 10 月⁩ 以来,此功能已在最新设备和浏览器版本中得到支持。此功能可能无法在旧设备或浏览器上运行。

安全上下文: 此功能仅在安全上下文(HTTPS)中可用,且支持此功能的浏览器数量有限。

AuthenticatorAttestationResponse 接口的 getAuthenticatorData() 方法返回一个 ArrayBuffer,其中包含 AuthenticatorAttestationResponse.attestationObject 属性中的身份验证器数据。

这是一个方便函数,用于轻松访问身份验证器数据,而无需编写额外的解析代码从 attestationObject 中提取它。

语法

js
getAuthenticatorData()

参数

无。

返回值

一个 ArrayBuffer,其 ArrayBuffer.byteLength 至少为 37 字节,其中包含 身份验证器数据 中解释的数据结构。

这将等同于 AuthenticatorAttestationResponse.attestationObject 属性中包含的身份验证器数据。

示例

有关详细示例,请参阅 创建公钥凭证

规范

规范
Web Authentication:访问公钥凭证的 API - 第 3 级
# dom-authenticatorattestationresponse-getauthenticatordata

浏览器兼容性