Bug 1799694 - Rename action/menu button class names in unified extensions. r=Itiel...
[gecko.git] / dom / webidl / U2F.webidl
blobc1e059f2d086cab835c945c8e6f03f634791e643
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  */
12 interface mixin GlobalU2F {
13   [SecureContext, Throws, Pref="security.webauth.u2f", Replaceable]
14   readonly attribute U2F u2f;
17 typedef unsigned short ErrorCode;
18 typedef sequence<Transport> Transports;
20 enum Transport {
21     "bt",
22     "ble",
23     "nfc",
24     "usb"
27 [GenerateToJSON]
28 dictionary U2FClientData {
29     DOMString             typ; // Spelling is from the specification
30     DOMString             challenge;
31     DOMString             origin;
32     // cid_pubkey for Token Binding is not implemented
35 dictionary RegisterRequest {
36     DOMString version;
37     DOMString challenge;
40 dictionary RegisterResponse {
41     DOMString version;
42     DOMString registrationData;
43     DOMString clientData;
45     // From Error
46     ErrorCode? errorCode;
47     DOMString? errorMessage;
50 dictionary RegisteredKey {
51     DOMString   version;
52     DOMString   keyHandle;
53     Transports? transports;
54     DOMString?  appId;
57 dictionary SignResponse {
58     DOMString keyHandle;
59     DOMString signatureData;
60     DOMString clientData;
62     // From Error
63     ErrorCode? errorCode;
64     DOMString? errorMessage;
67 callback U2FRegisterCallback = undefined(RegisterResponse response);
68 callback U2FSignCallback = undefined(SignResponse response);
70 [SecureContext, Pref="security.webauth.u2f",
71  Exposed=Window]
72 interface U2F {
73   // These enumerations are defined in the FIDO U2F Javascript API under the
74   // interface "ErrorCode" as constant integers, and also in the U2F.cpp file.
75   // Any changes to these must occur in both locations.
76   const unsigned short OK = 0;
77   const unsigned short OTHER_ERROR = 1;
78   const unsigned short BAD_REQUEST = 2;
79   const unsigned short CONFIGURATION_UNSUPPORTED = 3;
80   const unsigned short DEVICE_INELIGIBLE = 4;
81   const unsigned short TIMEOUT = 5;
83   // Returns a Function.  It's readonly + [LenientSetter] to keep the Google
84   // U2F polyfill from stomping on the value.
85   [LegacyLenientSetter, Pure, Cached, Throws]
86   readonly attribute object register;
88   // A way to generate the actual implementation of register()
89   [Unexposed, Throws, BinaryName="Register"]
90   undefined register_impl(DOMString appId,
91                           sequence<RegisterRequest> registerRequests,
92                           sequence<RegisteredKey> registeredKeys,
93                           U2FRegisterCallback callback,
94                           optional long? opt_timeoutSeconds);
96   // Returns a Function.  It's readonly + [LenientSetter] to keep the Google
97   // U2F polyfill from stomping on the value.
98   [LegacyLenientSetter, Pure, Cached, Throws]
99   readonly attribute object sign;
101   // A way to generate the actual implementation of sign()
102   [Unexposed, Throws, BinaryName="Sign"]
103   undefined sign_impl (DOMString appId,
104                        DOMString challenge,
105                        sequence<RegisteredKey> registeredKeys,
106                        U2FSignCallback callback,
107                        optional long? opt_timeoutSeconds);