2018-09-13 23:04:55 +03:00
|
|
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2016-02-09 18:43:00 +03:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* The origin of this IDL file is a combination of the FIDO U2F Raw Message Formats:
|
2017-11-17 04:11:02 +03:00
|
|
|
* https://www.fidoalliance.org/specs/fido-u2f-v1.1-id-20160915/fido-u2f-raw-message-formats-v1.1-id-20160915.html
|
|
|
|
* and the U2F JavaScript API v1.1:
|
|
|
|
* https://www.fidoalliance.org/specs/fido-u2f-v1.1-id-20160915/fido-u2f-javascript-api-v1.1-id-20160915.html
|
2016-02-09 18:43:00 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
[NoInterfaceObject]
|
|
|
|
interface GlobalU2F {
|
2017-12-14 02:02:38 +03:00
|
|
|
[SecureContext, Throws, Pref="security.webauth.u2f"]
|
2016-02-09 18:43:00 +03:00
|
|
|
readonly attribute U2F u2f;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef unsigned short ErrorCode;
|
|
|
|
typedef sequence<Transport> Transports;
|
|
|
|
|
|
|
|
enum Transport {
|
2018-09-13 23:04:55 +03:00
|
|
|
"bt",
|
|
|
|
"ble",
|
|
|
|
"nfc",
|
|
|
|
"usb"
|
2016-02-09 18:43:00 +03:00
|
|
|
};
|
|
|
|
|
2017-01-09 23:22:49 +03:00
|
|
|
dictionary U2FClientData {
|
2018-09-13 23:04:55 +03:00
|
|
|
DOMString typ; // Spelling is from the specification
|
|
|
|
DOMString challenge;
|
|
|
|
DOMString origin;
|
|
|
|
// cid_pubkey for Token Binding is not implemented
|
2016-02-09 18:43:00 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
dictionary RegisterRequest {
|
2018-09-13 23:04:55 +03:00
|
|
|
DOMString version;
|
|
|
|
DOMString challenge;
|
2016-02-09 18:43:00 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
dictionary RegisterResponse {
|
2018-09-13 23:04:55 +03:00
|
|
|
DOMString version;
|
|
|
|
DOMString registrationData;
|
|
|
|
DOMString clientData;
|
2016-02-09 18:43:00 +03:00
|
|
|
|
2018-09-13 23:04:55 +03:00
|
|
|
// From Error
|
|
|
|
ErrorCode? errorCode;
|
|
|
|
DOMString? errorMessage;
|
2016-02-09 18:43:00 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
dictionary RegisteredKey {
|
2018-09-13 23:04:55 +03:00
|
|
|
DOMString version;
|
|
|
|
DOMString keyHandle;
|
|
|
|
Transports? transports;
|
|
|
|
DOMString? appId;
|
2016-02-09 18:43:00 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
dictionary SignResponse {
|
2018-09-13 23:04:55 +03:00
|
|
|
DOMString keyHandle;
|
|
|
|
DOMString signatureData;
|
|
|
|
DOMString clientData;
|
2016-02-09 18:43:00 +03:00
|
|
|
|
2018-09-13 23:04:55 +03:00
|
|
|
// From Error
|
|
|
|
ErrorCode? errorCode;
|
|
|
|
DOMString? errorMessage;
|
2016-02-09 18:43:00 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
callback U2FRegisterCallback = void(RegisterResponse response);
|
|
|
|
callback U2FSignCallback = void(SignResponse response);
|
|
|
|
|
2017-12-14 02:02:38 +03:00
|
|
|
[SecureContext, Pref="security.webauth.u2f"]
|
2016-02-09 18:43:00 +03:00
|
|
|
interface U2F {
|
|
|
|
// These enumerations are defined in the FIDO U2F Javascript API under the
|
|
|
|
// interface "ErrorCode" as constant integers, and also in the U2F.cpp file.
|
|
|
|
// Any changes to these must occur in both locations.
|
|
|
|
const unsigned short OK = 0;
|
|
|
|
const unsigned short OTHER_ERROR = 1;
|
|
|
|
const unsigned short BAD_REQUEST = 2;
|
|
|
|
const unsigned short CONFIGURATION_UNSUPPORTED = 3;
|
|
|
|
const unsigned short DEVICE_INELIGIBLE = 4;
|
|
|
|
const unsigned short TIMEOUT = 5;
|
|
|
|
|
|
|
|
[Throws]
|
|
|
|
void register (DOMString appId,
|
|
|
|
sequence<RegisterRequest> registerRequests,
|
|
|
|
sequence<RegisteredKey> registeredKeys,
|
|
|
|
U2FRegisterCallback callback,
|
|
|
|
optional long? opt_timeoutSeconds);
|
|
|
|
|
|
|
|
[Throws]
|
|
|
|
void sign (DOMString appId,
|
|
|
|
DOMString challenge,
|
|
|
|
sequence<RegisteredKey> registeredKeys,
|
|
|
|
U2FSignCallback callback,
|
|
|
|
optional long? opt_timeoutSeconds);
|
|
|
|
};
|