tor-browser

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

MLS.h (2694B)


      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_MLS_h
      8 #define mozilla_dom_MLS_h
      9 
     10 // #include "mozilla/dom/TypedArray.h"
     11 #include "mozilla/DOMEventTargetHelper.h"
     12 #include "mozilla/dom/MLSBinding.h"
     13 #include "mozilla/dom/MLSTransactionChild.h"
     14 #include "mozilla/dom/Promise.h"
     15 #include "nsIGlobalObject.h"
     16 
     17 class nsIGlobalObject;
     18 
     19 namespace mozilla::dom {
     20 
     21 class MLSGroupView;
     22 
     23 class MLS final : public nsISupports, public nsWrapperCache {
     24 public:
     25  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
     26  NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(MLS)
     27 
     28  static already_AddRefed<MLS> Constructor(GlobalObject& aGlobal,
     29                                           ErrorResult& aRv);
     30 
     31  explicit MLS(nsIGlobalObject* aGlobalObject, MLSTransactionChild* aActor);
     32 
     33  nsIGlobalObject* GetParentObject() const { return mGlobalObject; }
     34 
     35  JSObject* WrapObject(JSContext* aCx,
     36                       JS::Handle<JSObject*> aGivenProto) override;
     37 
     38  already_AddRefed<mozilla::dom::Promise> DeleteState(ErrorResult& aRv);
     39 
     40  already_AddRefed<mozilla::dom::Promise> GenerateIdentity(ErrorResult& aRv);
     41 
     42  already_AddRefed<mozilla::dom::Promise> GenerateCredential(
     43      const MLSBytesOrUint8ArrayOrUTF8String& aJsCredContent, ErrorResult& aRv);
     44 
     45  already_AddRefed<mozilla::dom::Promise> GenerateKeyPackage(
     46      const MLSBytesOrUint8Array& aJsClientIdentifier,
     47      const MLSBytesOrUint8Array& aJsCredential, ErrorResult& aRv);
     48 
     49  already_AddRefed<mozilla::dom::Promise> GroupCreate(
     50      const MLSBytesOrUint8Array& aJsClientIdentifier,
     51      const MLSBytesOrUint8Array& aJsCredential, ErrorResult& aRv);
     52 
     53  already_AddRefed<mozilla::dom::Promise> GroupGet(
     54      const MLSBytesOrUint8Array& aJsGroupIdentifier,
     55      const MLSBytesOrUint8Array& aJsClientIdentifier, ErrorResult& aRv);
     56 
     57  already_AddRefed<mozilla::dom::Promise> GroupJoin(
     58      const MLSBytesOrUint8Array& aJsClientIdentifier,
     59      const MLSBytesOrUint8Array& aJsWelcome, ErrorResult& aRv);
     60 
     61  already_AddRefed<mozilla::dom::Promise> GetGroupIdFromMessage(
     62      const MLSBytesOrUint8Array& aJsMessage, ErrorResult& aRv);
     63 
     64  already_AddRefed<mozilla::dom::Promise> GetGroupEpochFromMessage(
     65      const MLSBytesOrUint8Array& aJsMessage, ErrorResult& aRv);
     66 
     67 private:
     68  friend class MLSGroupView;
     69 
     70  virtual ~MLS();
     71  nsCOMPtr<nsIGlobalObject> mGlobalObject;
     72  RefPtr<MLSTransactionChild> mTransactionChild;
     73 };
     74 
     75 }  // namespace mozilla::dom
     76 
     77 #endif