Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/dom/U2FSoftTokenManager.h
Line
Count
Source (jump to first uncovered line)
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_U2FSoftTokenManager_h
8
#define mozilla_dom_U2FSoftTokenManager_h
9
10
#include "mozilla/dom/U2FTokenTransport.h"
11
#include "ScopedNSSTypes.h"
12
13
/*
14
 * U2FSoftTokenManager is a software implementation of a secure token manager
15
 * for the U2F and WebAuthn APIs.
16
 */
17
18
namespace mozilla {
19
namespace dom {
20
21
class U2FSoftTokenManager final : public U2FTokenTransport
22
{
23
public:
24
  explicit U2FSoftTokenManager(uint32_t aCounter);
25
26
  RefPtr<U2FRegisterPromise>
27
  Register(const WebAuthnMakeCredentialInfo& aInfo,
28
           bool aForceNoneAttestation) override;
29
30
  RefPtr<U2FSignPromise>
31
  Sign(const WebAuthnGetAssertionInfo& aInfo) override;
32
33
  void Cancel() override;
34
35
private:
36
0
  ~U2FSoftTokenManager() {}
37
  nsresult Init();
38
39
  nsresult IsRegistered(const nsTArray<uint8_t>& aKeyHandle,
40
                        const nsTArray<uint8_t>& aAppParam,
41
                        bool& aResult);
42
43
  bool
44
  FindRegisteredKeyHandle(const nsTArray<nsTArray<uint8_t>>& aAppIds,
45
                          const nsTArray<WebAuthnScopedCredential>& aCredentials,
46
                          /*out*/ nsTArray<uint8_t>& aKeyHandle,
47
                          /*out*/ nsTArray<uint8_t>& aAppId);
48
49
  bool mInitialized;
50
  mozilla::UniquePK11SymKey mWrappingKey;
51
52
  static const nsCString mSecretNickname;
53
54
  nsresult GetOrCreateWrappingKey(const mozilla::UniquePK11SlotInfo& aSlot);
55
  uint32_t mCounter;
56
};
57
58
} // namespace dom
59
} // namespace mozilla
60
61
#endif // mozilla_dom_U2FSoftTokenManager_h