安全上下文
此特征只可用于
安全上下文
(HTTPS),在某些或所有
支持浏览器
.
rawId
只读特性在
PublicKeyCredential
interface is an
ArrayBuffer
object containing the identifier of the credentials.
PublicKeyCredential.id
特性为
base64url encoded
version of this identifier.
注意:
This property may only be used in top-level contexts and will not be available in an
<iframe>
例如。
rawId = publicKeyCredential.rawId
A
ArrayBuffer
containing the identifier of the credentials. This identifier is expected to be globally unique and is appointed for the current
PublicKeyCredential
and its associated
AuthenticatorAssertionResponse
.
var options = {
challenge: new Uint8Array(26) /* from the server */,
rp: {
name: "Example CORP",
id : "login.example.com"
},
user: {
id: new Uint8Array(26), /* To be changed for each user */
name: "jdoe@example.com",
displayName: "John Doe",
},
pubKeyCredParams: [
{
type: "public-key",
alg: -7
}
]
};
navigator.credentials.create({ publickey: options })
.then(function (pubKeyCredential) {
var rawId = pubKeyCredential.rawId;
// Do something with rawId
}).catch(function (err) {
// Deal with any error
});
| 规范 | 状态 | 注释 |
|---|---|---|
|
Web Authentication: An API for accessing Public Key Credentials Level 1
The definition of 'rawId' in that specification. |
推荐 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
rawId
|
Chrome
67
|
Edge 18 |
Firefox
60
|
IE No | Opera No | Safari 13 | WebView Android 70 | Chrome Android 70 |
Firefox Android
60
|
Opera Android No | Safari iOS 13.3 | Samsung Internet Android No |
完整支持
不支持
见实现注意事项。
用户必须明确启用此特征。
PublicKeyCredential