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
22 typedef MozPromise
<WebAuthnMakeCredentialResult
, nsresult
, true>
24 typedef MozPromise
<WebAuthnGetAssertionResult
, nsresult
, true> U2FSignPromise
;
26 class U2FTokenTransport
{
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() {}
42 virtual ~U2FTokenTransport() = default;
46 } // namespace mozilla
48 #endif // mozilla_dom_U2FTokenTransport_h