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