]> git.proxmox.com Git - rustc.git/blob - vendor/web-sys/webidls/enabled/U2F.webidl
New upstream version 1.71.1+dfsg1
[rustc.git] / vendor / web-sys / webidls / enabled / U2F.webidl
1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/.
5 *
6 * The origin of this IDL file is a combination of the FIDO U2F Raw Message Formats:
7 * https://www.fidoalliance.org/specs/fido-u2f-v1.1-id-20160915/fido-u2f-raw-message-formats-v1.1-id-20160915.html
8 * and the U2F JavaScript API v1.1:
9 * https://www.fidoalliance.org/specs/fido-u2f-v1.1-id-20160915/fido-u2f-javascript-api-v1.1-id-20160915.html
10 */
11
12 interface mixin GlobalU2F {
13 [SecureContext, Throws, Pref="security.webauth.u2f"]
14 readonly attribute U2F u2f;
15 };
16
17 typedef unsigned short ErrorCode;
18 typedef sequence<Transport> Transports;
19
20 enum Transport {
21 "bt",
22 "ble",
23 "nfc",
24 "usb"
25 };
26
27 dictionary U2FClientData {
28 DOMString typ; // Spelling is from the specification
29 DOMString challenge;
30 DOMString origin;
31 // cid_pubkey for Token Binding is not implemented
32 };
33
34 dictionary RegisterRequest {
35 DOMString version;
36 DOMString challenge;
37 };
38
39 dictionary RegisterResponse {
40 DOMString version;
41 DOMString registrationData;
42 DOMString clientData;
43
44 // From Error
45 ErrorCode? errorCode;
46 DOMString? errorMessage;
47 };
48
49 dictionary RegisteredKey {
50 DOMString version;
51 DOMString keyHandle;
52 Transports? transports;
53 DOMString? appId;
54 };
55
56 dictionary SignResponse {
57 DOMString keyHandle;
58 DOMString signatureData;
59 DOMString clientData;
60
61 // From Error
62 ErrorCode? errorCode;
63 DOMString? errorMessage;
64 };
65
66 callback U2FRegisterCallback = undefined(RegisterResponse response);
67 callback U2FSignCallback = undefined(SignResponse response);
68
69 [SecureContext, Pref="security.webauth.u2f"]
70 interface U2F {
71 // These enumerations are defined in the FIDO U2F Javascript API under the
72 // interface "ErrorCode" as constant integers, and also in the U2F.cpp file.
73 // Any changes to these must occur in both locations.
74 const unsigned short OK = 0;
75 const unsigned short OTHER_ERROR = 1;
76 const unsigned short BAD_REQUEST = 2;
77 const unsigned short CONFIGURATION_UNSUPPORTED = 3;
78 const unsigned short DEVICE_INELIGIBLE = 4;
79 const unsigned short TIMEOUT = 5;
80
81 [Throws]
82 undefined register (DOMString appId,
83 sequence<RegisterRequest> registerRequests,
84 sequence<RegisteredKey> registeredKeys,
85 U2FRegisterCallback callback,
86 optional long? opt_timeoutSeconds);
87
88 [Throws]
89 undefined sign (DOMString appId,
90 DOMString challenge,
91 sequence<RegisteredKey> registeredKeys,
92 U2FSignCallback callback,
93 optional long? opt_timeoutSeconds);
94 };