Bug 1828719 - Remove omnijar Gradle project from srcdir r=geckoview-reviewers,nalexan...
[gecko.git] / dom / webauthn / U2FTokenTransport.h
blob0c6d80bdf31cb06f1dfe36788ebb29676cb47f19
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/. */
7 #ifndef mozilla_dom_U2FTokenTransport_h
8 #define mozilla_dom_U2FTokenTransport_h
10 #include "mozilla/dom/PWebAuthnTransaction.h"
11 #include "mozilla/MozPromise.h"
14 * Abstract class representing a transport manager for U2F Keys (software,
15 * bluetooth, usb, etc.). Hides the implementation details for specific key
16 * transport types.
19 namespace mozilla::dom {
21 class WebAuthnGetAssertionResultWrapper {
22 public:
23 WebAuthnGetAssertionResult assertion;
24 mozilla::Maybe<nsCString> username;
27 typedef MozPromise<WebAuthnMakeCredentialResult, nsresult, true>
28 U2FRegisterPromise;
29 typedef MozPromise<nsTArray<WebAuthnGetAssertionResultWrapper>, nsresult, true>
30 U2FSignPromise;
32 class U2FTokenTransport {
33 public:
34 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(U2FTokenTransport);
35 U2FTokenTransport() = default;
37 virtual RefPtr<U2FRegisterPromise> Register(
38 const WebAuthnMakeCredentialInfo& aInfo, bool aForceNoneAttestation) = 0;
40 virtual RefPtr<U2FSignPromise> Sign(
41 const WebAuthnGetAssertionInfo& aInfo) = 0;
43 virtual void Cancel() = 0;
45 virtual void Drop() {}
47 protected:
48 virtual ~U2FTokenTransport() = default;
51 } // namespace mozilla::dom
53 #endif // mozilla_dom_U2FTokenTransport_h