Bug 1769628 [wpt PR 34081] - Update wpt metadata, a=testonly
[gecko.git] / dom / webauthn / PublicKeyCredential.h
blobc66cb696576e618c93c2abaac6e158c8f679c927
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 {
21 public:
22 NS_DECL_ISUPPORTS_INHERITED
23 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(PublicKeyCredential,
24 Credential)
26 explicit PublicKeyCredential(nsPIDOMWindowInner* aParent);
28 protected:
29 ~PublicKeyCredential() override;
31 public:
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,
45 ErrorResult& aError);
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);
57 private:
58 CryptoBuffer mRawId;
59 JS::Heap<JSObject*> mRawIdCachedObj;
60 RefPtr<AuthenticatorResponse> mResponse;
61 AuthenticationExtensionsClientOutputs mClientExtensionOutputs;
64 } // namespace mozilla::dom
66 #endif // mozilla_dom_PublicKeyCredential_h