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_WinWebAuthnManager_h
8
#define mozilla_dom_WinWebAuthnManager_h
9
10
#include "mozilla/dom/U2FTokenTransport.h"
11
#include "mozilla/dom/PWebAuthnTransaction.h"
12
13
namespace mozilla {
14
namespace dom {
15
16
class WebAuthnTransactionParent;
17
18
class WinWebAuthnManager final {
19
public:
20
static WinWebAuthnManager* Get();
21
void Register(PWebAuthnTransactionParent* aTransactionParent,
22
const uint64_t& aTransactionId,
23
const WebAuthnMakeCredentialInfo& aTransactionInfo);
24
void Sign(PWebAuthnTransactionParent* aTransactionParent,
25
const uint64_t& aTransactionId,
26
const WebAuthnGetAssertionInfo& aTransactionInfo);
27
void Cancel(PWebAuthnTransactionParent* aTransactionParent,
28
const uint64_t& aTransactionId);
29
void MaybeClearTransaction(PWebAuthnTransactionParent* aParent);
30
static void Initialize();
31
static bool IsUserVerifyingPlatformAuthenticatorAvailable();
32
static bool AreWebAuthNApisAvailable();
33
34
WinWebAuthnManager();
35
~WinWebAuthnManager();
36
37
private:
38
void AbortTransaction(const uint64_t& aTransactionId, const nsresult& aError);
39
void ClearTransaction();
40
void MaybeAbortRegister(const uint64_t& aTransactionId,
41
const nsresult& aError);
42
void MaybeAbortSign(const uint64_t& aTransactionId, const nsresult& aError);
43
bool IsUserVerifyingPlatformAuthenticatorAvailableInternal();
44
uint32_t GetWebAuthNApiVersion();
45
46
PWebAuthnTransactionParent* mTransactionParent;
47
uint32_t mWinWebAuthNApiVersion = 0;
48
std::map<uint64_t, GUID*> mCancellationIds;
49
};
50
51
} // namespace dom
52
} // namespace mozilla
53
54
#endif // mozilla_dom_WinWebAuthnManager_h