Bug 1874684 - Part 6: Limit day length calculations to safe integers. r=mgaudet
[gecko.git] / dom / webauthn / AuthenticatorAssertionResponse.h
blob75982800d135411a71d8ce32cca0693a4112a8f3
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_AuthenticatorAssertionResponse_h
8 #define mozilla_dom_AuthenticatorAssertionResponse_h
10 #include "js/TypeDecls.h"
11 #include "mozilla/Attributes.h"
12 #include "mozilla/dom/AuthenticatorResponse.h"
13 #include "mozilla/dom/BindingDeclarations.h"
14 #include "mozilla/dom/WebAuthenticationBinding.h"
15 #include "nsCycleCollectionParticipant.h"
16 #include "nsWrapperCache.h"
18 namespace mozilla::dom {
20 class AuthenticatorAssertionResponse final : public AuthenticatorResponse {
21 public:
22 NS_DECL_ISUPPORTS_INHERITED
23 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(
24 AuthenticatorAssertionResponse, AuthenticatorResponse)
26 explicit AuthenticatorAssertionResponse(nsPIDOMWindowInner* aParent);
28 protected:
29 ~AuthenticatorAssertionResponse() override;
31 public:
32 virtual JSObject* WrapObject(JSContext* aCx,
33 JS::Handle<JSObject*> aGivenProto) override;
35 void GetAuthenticatorData(JSContext* aCx, JS::MutableHandle<JSObject*> aValue,
36 ErrorResult& aRv);
38 void SetAuthenticatorData(const nsTArray<uint8_t>& aBuffer);
40 void GetSignature(JSContext* aCx, JS::MutableHandle<JSObject*> aValue,
41 ErrorResult& aRv);
43 void SetSignature(const nsTArray<uint8_t>& aBuffer);
45 void GetUserHandle(JSContext* aCx, JS::MutableHandle<JSObject*> aValue,
46 ErrorResult& aRv);
48 void SetUserHandle(const nsTArray<uint8_t>& aBuffer);
50 void ToJSON(AuthenticatorAssertionResponseJSON& aJSON, ErrorResult& aError);
52 private:
53 nsTArray<uint8_t> mAuthenticatorData;
54 JS::Heap<JSObject*> mAuthenticatorDataCachedObj;
55 nsTArray<uint8_t> mSignature;
56 JS::Heap<JSObject*> mSignatureCachedObj;
57 nsTArray<uint8_t> mUserHandle;
58 JS::Heap<JSObject*> mUserHandleCachedObj;
61 } // namespace mozilla::dom
63 #endif // mozilla_dom_AuthenticatorAssertionResponse_h