AuthenticatorAssertionResponse.h (2156B)
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_AuthenticatorAssertionResponse_h 8 #define mozilla_dom_AuthenticatorAssertionResponse_h 9 10 #include "js/TypeDecls.h" 11 #include "mozilla/dom/AuthenticatorResponse.h" 12 #include "mozilla/dom/BindingDeclarations.h" 13 #include "mozilla/dom/WebAuthenticationBinding.h" 14 #include "nsCycleCollectionParticipant.h" 15 #include "nsWrapperCache.h" 16 17 namespace mozilla::dom { 18 19 class AuthenticatorAssertionResponse final : public AuthenticatorResponse { 20 public: 21 NS_DECL_ISUPPORTS_INHERITED 22 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED( 23 AuthenticatorAssertionResponse, AuthenticatorResponse) 24 25 explicit AuthenticatorAssertionResponse(nsPIDOMWindowInner* aParent); 26 27 protected: 28 ~AuthenticatorAssertionResponse() override; 29 30 public: 31 virtual JSObject* WrapObject(JSContext* aCx, 32 JS::Handle<JSObject*> aGivenProto) override; 33 34 void GetAuthenticatorData(JSContext* aCx, JS::MutableHandle<JSObject*> aValue, 35 ErrorResult& aRv); 36 37 void SetAuthenticatorData(const nsTArray<uint8_t>& aBuffer); 38 39 void GetSignature(JSContext* aCx, JS::MutableHandle<JSObject*> aValue, 40 ErrorResult& aRv); 41 42 void SetSignature(const nsTArray<uint8_t>& aBuffer); 43 44 void GetUserHandle(JSContext* aCx, JS::MutableHandle<JSObject*> aValue, 45 ErrorResult& aRv); 46 47 void SetUserHandle(const nsTArray<uint8_t>& aBuffer); 48 49 void ToJSON(AuthenticatorAssertionResponseJSON& aJSON, ErrorResult& aError); 50 51 private: 52 nsTArray<uint8_t> mAuthenticatorData; 53 JS::Heap<JSObject*> mAuthenticatorDataCachedObj; 54 nsTArray<uint8_t> mSignature; 55 JS::Heap<JSObject*> mSignatureCachedObj; 56 nsTArray<uint8_t> mUserHandle; 57 JS::Heap<JSObject*> mUserHandleCachedObj; 58 }; 59 60 } // namespace mozilla::dom 61 62 #endif // mozilla_dom_AuthenticatorAssertionResponse_h