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/.
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
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;
28 dictionary U2FClientData {
29 DOMString typ; // Spelling is from the specification
32 // cid_pubkey for Token Binding is not implemented
35 dictionary RegisterRequest {
40 dictionary RegisterResponse {
42 DOMString registrationData;
47 DOMString? errorMessage;
50 dictionary RegisteredKey {
53 Transports? transports;
57 dictionary SignResponse {
59 DOMString signatureData;
64 DOMString? errorMessage;
67 callback U2FRegisterCallback = undefined(RegisterResponse response);
68 callback U2FSignCallback = undefined(SignResponse response);
70 [SecureContext, Pref="security.webauth.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,
105 sequence<RegisteredKey> registeredKeys,
106 U2FSignCallback callback,
107 optional long? opt_timeoutSeconds);