Bug 1685822 [wpt PR 27117] - [Import Maps] Add tests for rejecting multiple import...
[gecko.git] / dom / webauthn / U2FTokenTransport.h
blobc8ad0f0c31e050a1e88bb209f2010253b927f137
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 {
20 namespace dom {
22 typedef MozPromise<WebAuthnMakeCredentialResult, nsresult, true>
23 U2FRegisterPromise;
24 typedef MozPromise<WebAuthnGetAssertionResult, nsresult, true> U2FSignPromise;
26 class U2FTokenTransport {
27 public:
28 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(U2FTokenTransport);
29 U2FTokenTransport() = default;
31 virtual RefPtr<U2FRegisterPromise> Register(
32 const WebAuthnMakeCredentialInfo& aInfo, bool aForceNoneAttestation) = 0;
34 virtual RefPtr<U2FSignPromise> Sign(
35 const WebAuthnGetAssertionInfo& aInfo) = 0;
37 virtual void Cancel() = 0;
39 virtual void Drop() {}
41 protected:
42 virtual ~U2FTokenTransport() = default;
45 } // namespace dom
46 } // namespace mozilla
48 #endif // mozilla_dom_U2FTokenTransport_h