Bug 1700051: part 46) Const-qualify `mozInlineSpellStatus::mAnchorRange`. r=smaug
[gecko.git] / dom / webauthn / U2FSoftTokenManager.h
blob411df8f611130cd9af9ca7d24a8de047e0f5e7d2
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_U2FSoftTokenManager_h
8 #define mozilla_dom_U2FSoftTokenManager_h
10 #include "mozilla/dom/U2FTokenTransport.h"
11 #include "ScopedNSSTypes.h"
14 * U2FSoftTokenManager is a software implementation of a secure token manager
15 * for the U2F and WebAuthn APIs.
18 namespace mozilla {
19 namespace dom {
21 class U2FSoftTokenManager final : public U2FTokenTransport {
22 public:
23 explicit U2FSoftTokenManager(uint32_t aCounter);
25 RefPtr<U2FRegisterPromise> Register(const WebAuthnMakeCredentialInfo& aInfo,
26 bool aForceNoneAttestation) override;
28 RefPtr<U2FSignPromise> Sign(const WebAuthnGetAssertionInfo& aInfo) override;
30 void Cancel() override;
32 private:
33 ~U2FSoftTokenManager() = default;
34 nsresult Init();
36 nsresult IsRegistered(const nsTArray<uint8_t>& aKeyHandle,
37 const nsTArray<uint8_t>& aAppParam, bool& aResult);
39 bool FindRegisteredKeyHandle(
40 const nsTArray<nsTArray<uint8_t>>& aAppIds,
41 const nsTArray<WebAuthnScopedCredential>& aCredentials,
42 /*out*/ nsTArray<uint8_t>& aKeyHandle,
43 /*out*/ nsTArray<uint8_t>& aAppId);
45 bool mInitialized;
46 mozilla::UniquePK11SymKey mWrappingKey;
48 static const nsCString mSecretNickname;
50 nsresult GetOrCreateWrappingKey(const mozilla::UniquePK11SlotInfo& aSlot);
51 uint32_t mCounter;
54 } // namespace dom
55 } // namespace mozilla
57 #endif // mozilla_dom_U2FSoftTokenManager_h