安全上下文
此特征只可用于
安全上下文
(HTTPS),在某些或所有
支持浏览器
.
getTransports()
is a method of the
AuthenticatorAttestationResponse
interface that returns an
数组
containing strings describing the different transports which may be used by the authenticator.
Such transports may be USB, NFC, BLE or internal (applicable when the authenticator is not removable from the device).
注意:
An
AuthenticatorAttestationResponse
instance is available on
PublicKeyCredential.response
after calling
navigator.credentials.create()
.
注意:
This method may only be used in top-level contexts and will not be available in an
<iframe>
例如。
arrTransports = authenticatorAttestationResponse.getTransports()
None.
数组
containing the different transports supported by the authenticator or nothing if this information is not available.of the processing of the different extensions by the client. The elements of this array are supposed to be in lexicographical order. Their values may be :
"usb"
: the authenticator can be contacted via a removable USB link
"nfc"
: the authenticator may be used over
NFC (Near Field Communication)
"ble"
: the authenticator may be used over
BLE (Bluetooth Low Energy)
"internal"
: the authenticator is specifically bound to the client device (cannot be removed).
var publicKey = {
challenge: /* from the server */,
rp: {
name: "Example CORP",
id : "login.example.com"
},
user: {
id: new Uint8Array(16),
name: "jdoe@example.com",
displayName: "John Doe"
},
pubKeyCredParams: [
{
type: "public-key",
alg: -7
}
]
};
navigator.credentials.create({ publicKey })
.then(function (newCredentialInfo) {
var transports = newCredentialInfo.response.getTransports();
console.table(transports); // may be something like ["internal", "nfc", "usb"]
}).catch(function (err) {
console.error(err);
});
| 规范 | 状态 | 注释 |
|---|---|---|
|
Web Authentication: An API for accessing Public Key Credentials Level 1
The definition of 'getTransports()' in that specification. |
推荐 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
getTransports
|
Chrome No | Edge No | Firefox No | IE No | Opera No | Safari No | WebView Android No | Chrome Android No | Firefox Android No | Opera Android No | Safari iOS No | Samsung Internet Android No |
不支持
实验。期望将来行为有所改变。
AuthenticatorAttestationResponse
getTransports()