1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4  * License, v. 2.0. If a copy of the MPL was not distributed with this
5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 
7 #ifndef mozilla_dom_U2FAuthenticator_h
8 #define mozilla_dom_U2FAuthenticator_h
9 
10 #include "mozilla/MozPromise.h"
11 
12 namespace mozilla {
13 namespace dom {
14 
15 // These enumerations are defined in the FIDO U2F Javascript API under the
16 // interface "ErrorCode" as constant integers, and thus in the U2F.webidl file.
17 // Any changes to these must occur in both locations.
18 enum class ErrorCode {
19   OK = 0,
20   OTHER_ERROR = 1,
21   BAD_REQUEST = 2,
22   CONFIGURATION_UNSUPPORTED = 3,
23   DEVICE_INELIGIBLE = 4,
24   TIMEOUT = 5
25 };
26 
27 typedef MozPromise<nsString, ErrorCode, false> U2FPromise;
28 
29 constexpr auto kRequiredU2FVersion = u"U2F_V2"_ns;
30 
31 }  // namespace dom
32 }  // namespace mozilla
33 
34 #endif  // mozilla_dom_U2FAuthenticator_h
35