Backed out changeset b462e7b742d8 (bug 1908261) for causing multiple reftest failures...
[gecko.git] / dom / webauthn / WinWebAuthnService.h
blob21c8df2b0285ae08825e63301e9aca980618fc15
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_WinWebAuthnService_h
8 #define mozilla_dom_WinWebAuthnService_h
10 #include "mozilla/dom/PWebAuthnTransaction.h"
11 #include "mozilla/Tainting.h"
12 #include "nsIWebAuthnService.h"
14 namespace mozilla::dom {
16 class WinWebAuthnService final : public nsIWebAuthnService {
17 public:
18 NS_DECL_THREADSAFE_ISUPPORTS
19 NS_DECL_NSIWEBAUTHNSERVICE
21 static bool IsUserVerifyingPlatformAuthenticatorAvailable();
22 static bool AreWebAuthNApisAvailable();
23 static nsresult EnsureWinWebAuthnModuleLoaded();
25 WinWebAuthnService()
26 : mTransactionState(Nothing(), "WinWebAuthnService::mTransactionState") {
29 private:
30 ~WinWebAuthnService();
32 uint32_t GetWebAuthNApiVersion();
34 struct TransactionState {
35 uint64_t transactionId;
36 uint64_t browsingContextId;
37 Maybe<RefPtr<nsIWebAuthnSignArgs>> pendingSignArgs;
38 Maybe<RefPtr<nsIWebAuthnSignPromise>> pendingSignPromise;
39 GUID cancellationId;
42 using TransactionStateMutex = DataMutex<Maybe<TransactionState>>;
43 TransactionStateMutex mTransactionState;
44 void DoGetAssertion(Maybe<nsTArray<uint8_t>>&& aSelectedCredentialId,
45 const TransactionStateMutex::AutoLock& aGuard);
48 } // namespace mozilla::dom
50 #endif // mozilla_dom_WinWebAuthnService_h