1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
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_MLSTransactionParent_h
8 #define mozilla_dom_MLSTransactionParent_h
10 #include "mozilla/dom/PMLSTransaction.h"
11 #include "mozilla/dom/PMLSTransactionParent.h"
12 #include "nsIPrincipal.h"
14 namespace mozilla::dom
{
16 class MLSTransactionParent final
: public PMLSTransactionParent
{
18 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MLSTransactionParent
, override
);
20 explicit MLSTransactionParent(const nsACString
& aDatabasePath
)
21 : mDatabasePath(aDatabasePath
) {};
23 static nsresult
CreateDirectoryIfNotExists(nsIFile
* aDir
);
25 static nsresult
ConstructDatabasePrefixPath(nsCOMPtr
<nsIFile
>& aFile
);
27 static nsresult
ConstructDatabaseFullPath(nsCOMPtr
<nsIFile
>& aFile
,
28 nsIPrincipal
* aPrincipal
,
29 nsCString
& aDatabasePath
);
31 void ActorDestroy(ActorDestroyReason
) override
;
33 mozilla::ipc::IPCResult
RecvRequestStateDelete(
34 RequestStateDeleteResolver
&& aResolver
);
36 mozilla::ipc::IPCResult
RecvRequestGroupStateDelete(
37 const nsTArray
<uint8_t>& aGroupIdentifier
,
38 const nsTArray
<uint8_t>& aIdentifier
,
39 RequestGroupStateDeleteResolver
&& aResolver
);
41 mozilla::ipc::IPCResult
RecvRequestGenerateIdentityKeypair(
42 RequestGenerateIdentityKeypairResolver
&& aResolver
);
44 mozilla::ipc::IPCResult
RecvRequestGenerateCredentialBasic(
45 const nsTArray
<uint8_t>& aCredContent
,
46 RequestGenerateCredentialBasicResolver
&& aResolver
);
48 mozilla::ipc::IPCResult
RecvRequestGenerateKeyPackage(
49 const nsTArray
<uint8_t>& aIdentifier
,
50 const nsTArray
<uint8_t>& aCredential
,
51 RequestGenerateKeyPackageResolver
&& aResolver
);
53 mozilla::ipc::IPCResult
RecvRequestGroupCreate(
54 const nsTArray
<uint8_t>& aIdentifier
,
55 const nsTArray
<uint8_t>& aCredential
,
56 const nsTArray
<uint8_t>& aInOptGroupIdentifier
,
57 RequestGroupCreateResolver
&& aResolver
);
59 mozilla::ipc::IPCResult
RecvRequestGroupJoin(
60 const nsTArray
<uint8_t>& aIdentifier
, const nsTArray
<uint8_t>& aWelcome
,
61 RequestGroupJoinResolver
&& aResolver
);
63 mozilla::ipc::IPCResult
RecvRequestGroupAdd(
64 const nsTArray
<uint8_t>& aGroupIdentifier
,
65 const nsTArray
<uint8_t>& aIdentifier
,
66 const nsTArray
<uint8_t>& aKeyPackage
,
67 RequestGroupAddResolver
&& aResolver
);
69 mozilla::ipc::IPCResult
RecvRequestGroupProposeAdd(
70 const nsTArray
<uint8_t>& aGroupIdentifier
,
71 const nsTArray
<uint8_t>& aIdentifier
,
72 const nsTArray
<uint8_t>& aKeyPackage
,
73 RequestGroupProposeAddResolver
&& aResolver
);
75 mozilla::ipc::IPCResult
RecvRequestGroupRemove(
76 const nsTArray
<uint8_t>& aGroupIdentifier
,
77 const nsTArray
<uint8_t>& aIdentifier
,
78 const nsTArray
<uint8_t>& aRemIdentifier
,
79 RequestGroupRemoveResolver
&& aResolver
);
81 mozilla::ipc::IPCResult
RecvRequestGroupProposeRemove(
82 const nsTArray
<uint8_t>& aGroupIdentifier
,
83 const nsTArray
<uint8_t>& aIdentifier
,
84 const nsTArray
<uint8_t>& aRemIdentifier
,
85 RequestGroupProposeRemoveResolver
&& aResolver
);
87 mozilla::ipc::IPCResult
RecvRequestGroupClose(
88 const nsTArray
<uint8_t>& aGroupIdentifier
,
89 const nsTArray
<uint8_t>& aIdentifier
,
90 RequestGroupCloseResolver
&& aResolver
);
92 mozilla::ipc::IPCResult
RecvRequestGroupDetails(
93 const nsTArray
<uint8_t>& aGroupIdentifier
,
94 const nsTArray
<uint8_t>& aIdentifier
,
95 RequestGroupDetailsResolver
&& aResolver
);
97 mozilla::ipc::IPCResult
RecvRequestReceive(
98 const nsTArray
<uint8_t>& aClientIdentifier
,
99 const nsTArray
<uint8_t>& aMessage
, RequestReceiveResolver
&& aResolver
);
101 mozilla::ipc::IPCResult
RecvRequestApplyPendingCommit(
102 const nsTArray
<uint8_t>& aGroupIdentifier
,
103 const nsTArray
<uint8_t>& aClientIdentifier
,
104 RequestApplyPendingCommitResolver
&& aResolver
);
106 mozilla::ipc::IPCResult
RecvRequestSend(
107 const nsTArray
<uint8_t>& aGroupIdentifier
,
108 const nsTArray
<uint8_t>& aIdentifier
, const nsTArray
<uint8_t>& aMessage
,
109 RequestSendResolver
&& aResolver
);
111 mozilla::ipc::IPCResult
RecvRequestExportSecret(
112 const nsTArray
<uint8_t>& aGroupIdentifier
,
113 const nsTArray
<uint8_t>& aIdentifier
, const nsTArray
<uint8_t>& aLabel
,
114 const nsTArray
<uint8_t>& aContext
, uint64_t aLen
,
115 RequestExportSecretResolver
&& aResolver
);
117 mozilla::ipc::IPCResult
RecvRequestGetGroupIdentifier(
118 const nsTArray
<uint8_t>& aMessage
,
119 RequestGetGroupIdentifierResolver
&& aResolver
);
122 ~MLSTransactionParent() = default;
123 nsCString mDatabasePath
;
126 } // namespace mozilla::dom