Source code

Revision control

Other Tools

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_U2FTokenTransport_h
8
#define mozilla_dom_U2FTokenTransport_h
9
10
#include "mozilla/dom/PWebAuthnTransaction.h"
11
12
/*
13
* Abstract class representing a transport manager for U2F Keys (software,
14
* bluetooth, usb, etc.). Hides the implementation details for specific key
15
* transport types.
16
*/
17
18
namespace mozilla {
19
namespace dom {
20
21
typedef MozPromise<WebAuthnMakeCredentialResult, nsresult, true>
22
U2FRegisterPromise;
23
typedef MozPromise<WebAuthnGetAssertionResult, nsresult, true> U2FSignPromise;
24
25
class U2FTokenTransport {
26
public:
27
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(U2FTokenTransport);
28
U2FTokenTransport() {}
29
30
virtual RefPtr<U2FRegisterPromise> Register(
31
const WebAuthnMakeCredentialInfo& aInfo, bool aForceNoneAttestation) = 0;
32
33
virtual RefPtr<U2FSignPromise> Sign(
34
const WebAuthnGetAssertionInfo& aInfo) = 0;
35
36
virtual void Cancel() = 0;
37
38
virtual void Drop() {}
39
40
protected:
41
virtual ~U2FTokenTransport() = default;
42
};
43
44
} // namespace dom
45
} // namespace mozilla
46
47
#endif // mozilla_dom_U2FTokenTransport_h