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_PublicKeyCredential_h
8 #define mozilla_dom_PublicKeyCredential_h
10 #include "js/TypeDecls.h"
11 #include "mozilla/Attributes.h"
12 #include "mozilla/dom/BindingDeclarations.h"
13 #include "mozilla/dom/Credential.h"
14 #include "nsCycleCollectionParticipant.h"
15 #include "nsWrapperCache.h"
16 #include "mozilla/dom/CryptoBuffer.h"
18 namespace mozilla::dom
{
20 class PublicKeyCredential final
: public Credential
{
22 NS_DECL_ISUPPORTS_INHERITED
23 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(PublicKeyCredential
,
26 explicit PublicKeyCredential(nsPIDOMWindowInner
* aParent
);
29 ~PublicKeyCredential() override
;
32 virtual JSObject
* WrapObject(JSContext
* aCx
,
33 JS::Handle
<JSObject
*> aGivenProto
) override
;
35 void GetRawId(JSContext
* cx
, JS::MutableHandle
<JSObject
*> aRetVal
);
37 already_AddRefed
<AuthenticatorResponse
> Response() const;
39 nsresult
SetRawId(CryptoBuffer
& aBuffer
);
41 void SetResponse(RefPtr
<AuthenticatorResponse
>);
43 static already_AddRefed
<Promise
>
44 IsUserVerifyingPlatformAuthenticatorAvailable(GlobalObject
& aGlobal
,
47 static already_AddRefed
<Promise
> IsExternalCTAP2SecurityKeySupported(
48 GlobalObject
& aGlobal
, ErrorResult
& aError
);
50 void GetClientExtensionResults(
51 AuthenticationExtensionsClientOutputs
& aResult
);
53 void SetClientExtensionResultAppId(bool aResult
);
55 void SetClientExtensionResultHmacSecret(bool aHmacCreateSecret
);
59 JS::Heap
<JSObject
*> mRawIdCachedObj
;
60 RefPtr
<AuthenticatorResponse
> mResponse
;
61 AuthenticationExtensionsClientOutputs mClientExtensionOutputs
;
64 } // namespace mozilla::dom
66 #endif // mozilla_dom_PublicKeyCredential_h