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_PublicKeyCredential_h
8
#define mozilla_dom_PublicKeyCredential_h
9
10
#include "js/TypeDecls.h"
11
#include "mozilla/Attributes.h"
12
#include "mozilla/dom/BindingDeclarations.h"
13
#include "mozilla/dom/Credential.h"
14
#include "mozilla/ErrorResult.h"
15
#include "nsCycleCollectionParticipant.h"
16
#include "nsWrapperCache.h"
17
18
namespace mozilla {
19
namespace dom {
20
21
class PublicKeyCredential final : public Credential {
22
public:
23
NS_DECL_ISUPPORTS_INHERITED
24
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(PublicKeyCredential,
25
Credential)
26
27
explicit PublicKeyCredential(nsPIDOMWindowInner* aParent);
28
29
protected:
30
~PublicKeyCredential() override;
31
32
public:
33
virtual JSObject* WrapObject(JSContext* aCx,
34
JS::Handle<JSObject*> aGivenProto) override;
35
36
void GetRawId(JSContext* cx, JS::MutableHandle<JSObject*> aRetVal);
37
38
already_AddRefed<AuthenticatorResponse> Response() const;
39
40
nsresult SetRawId(CryptoBuffer& aBuffer);
41
42
void SetResponse(RefPtr<AuthenticatorResponse>);
43
44
static already_AddRefed<Promise>
45
IsUserVerifyingPlatformAuthenticatorAvailable(GlobalObject& aGlobal);
46
47
static already_AddRefed<Promise> IsExternalCTAP2SecurityKeySupported(
48
GlobalObject& aGlobal);
49
50
void GetClientExtensionResults(
51
AuthenticationExtensionsClientOutputs& aResult);
52
53
void SetClientExtensionResultAppId(bool aResult);
54
55
void SetClientExtensionResultHmacSecret(bool aHmacCreateSecret);
56
57
private:
58
CryptoBuffer mRawId;
59
JS::Heap<JSObject*> mRawIdCachedObj;
60
RefPtr<AuthenticatorResponse> mResponse;
61
AuthenticationExtensionsClientOutputs mClientExtensionOutputs;
62
};
63
64
} // namespace dom
65
} // namespace mozilla
66
67
#endif // mozilla_dom_PublicKeyCredential_h