tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

WinWebAuthnService.h (1559B)


      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_WinWebAuthnService_h
      8 #define mozilla_dom_WinWebAuthnService_h
      9 
     10 #include "mozilla/dom/PWebAuthnTransaction.h"
     11 #include "nsIWebAuthnService.h"
     12 
     13 namespace mozilla::dom {
     14 
     15 class WinWebAuthnService final : public nsIWebAuthnService {
     16 public:
     17  NS_DECL_THREADSAFE_ISUPPORTS
     18  NS_DECL_NSIWEBAUTHNSERVICE
     19 
     20  static bool IsUserVerifyingPlatformAuthenticatorAvailable();
     21  static bool AreWebAuthNApisAvailable();
     22  static nsresult EnsureWinWebAuthnModuleLoaded();
     23 
     24  WinWebAuthnService()
     25      : mTransactionState(Nothing(), "WinWebAuthnService::mTransactionState") {
     26        };
     27 
     28 private:
     29  ~WinWebAuthnService();
     30 
     31  uint32_t GetWebAuthNApiVersion();
     32 
     33  struct TransactionState {
     34    uint64_t transactionId;
     35    uint64_t browsingContextId;
     36    Maybe<RefPtr<nsIWebAuthnSignArgs>> pendingSignArgs;
     37    Maybe<RefPtr<nsIWebAuthnSignPromise>> pendingSignPromise;
     38    GUID cancellationId;
     39  };
     40 
     41  using TransactionStateMutex = DataMutex<Maybe<TransactionState>>;
     42  TransactionStateMutex mTransactionState;
     43  void DoGetAssertion(Maybe<nsTArray<uint8_t>>&& aSelectedCredentialId,
     44                      const TransactionStateMutex::AutoLock& aGuard);
     45 };
     46 
     47 }  // namespace mozilla::dom
     48 
     49 #endif  // mozilla_dom_WinWebAuthnService_h