tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

AuthenticatorAttestationResponse.h (2372B)


      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_AuthenticatorAttestationResponse_h
      8 #define mozilla_dom_AuthenticatorAttestationResponse_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 "nsIWebAuthnAttObj.h"
     16 #include "nsWrapperCache.h"
     17 
     18 namespace mozilla::dom {
     19 
     20 class AuthenticatorAttestationResponse final : public AuthenticatorResponse {
     21 public:
     22  NS_DECL_ISUPPORTS_INHERITED
     23  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(
     24      AuthenticatorAttestationResponse, AuthenticatorResponse)
     25 
     26  explicit AuthenticatorAttestationResponse(nsPIDOMWindowInner* aParent);
     27 
     28 protected:
     29  ~AuthenticatorAttestationResponse() override;
     30 
     31 public:
     32  virtual JSObject* WrapObject(JSContext* aCx,
     33                               JS::Handle<JSObject*> aGivenProto) override;
     34 
     35  void GetAttestationObject(JSContext* aCx, JS::MutableHandle<JSObject*> aValue,
     36                            ErrorResult& aRv);
     37 
     38  void SetAttestationObject(const nsTArray<uint8_t>& aBuffer);
     39 
     40  void GetTransports(nsTArray<nsString>& aTransports);
     41 
     42  void SetTransports(const nsTArray<nsString>& aTransports);
     43 
     44  void GetAuthenticatorData(JSContext* aCx, JS::MutableHandle<JSObject*> aValue,
     45                            ErrorResult& aRv);
     46 
     47  void GetPublicKey(JSContext* aCx, JS::MutableHandle<JSObject*> aValue,
     48                    ErrorResult& aRv);
     49 
     50  COSEAlgorithmIdentifier GetPublicKeyAlgorithm(ErrorResult& aRv);
     51 
     52  void ToJSON(AuthenticatorAttestationResponseJSON& aJSON, ErrorResult& aError);
     53 
     54 private:
     55  nsresult GetAuthenticatorDataBytes(nsTArray<uint8_t>& aAuthenticatorData);
     56  nsresult GetPublicKeyBytes(nsTArray<uint8_t>& aPublicKeyBytes);
     57 
     58  nsTArray<uint8_t> mAttestationObject;
     59  nsCOMPtr<nsIWebAuthnAttObj> mAttestationObjectParsed;
     60  JS::Heap<JSObject*> mAttestationObjectCachedObj;
     61  nsTArray<nsString> mTransports;
     62 };
     63 
     64 }  // namespace mozilla::dom
     65 
     66 #endif  // mozilla_dom_AuthenticatorAttestationResponse_h