@signalapp/libsignal-client 0.15.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Native.d.ts +68 -48
- package/dist/index.d.ts +9 -13
- package/dist/index.js +27 -19
- package/dist/zkgroup/NotarySignature.d.ts +1 -0
- package/dist/zkgroup/ServerPublicParams.d.ts +1 -0
- package/dist/zkgroup/ServerSecretParams.d.ts +1 -0
- package/dist/zkgroup/ServerSecretParams.js +3 -3
- package/dist/zkgroup/auth/AuthCredential.d.ts +1 -0
- package/dist/zkgroup/auth/AuthCredentialPresentation.d.ts +3 -1
- package/dist/zkgroup/auth/AuthCredentialPresentation.js +9 -2
- package/dist/zkgroup/auth/AuthCredentialResponse.d.ts +1 -0
- package/dist/zkgroup/auth/AuthCredentialWithPni.d.ts +6 -0
- package/dist/zkgroup/auth/AuthCredentialWithPni.js +15 -0
- package/dist/zkgroup/auth/AuthCredentialWithPniResponse.d.ts +6 -0
- package/dist/zkgroup/auth/AuthCredentialWithPniResponse.js +15 -0
- package/dist/zkgroup/auth/ClientZkAuthOperations.d.ts +10 -0
- package/dist/zkgroup/auth/ClientZkAuthOperations.js +17 -1
- package/dist/zkgroup/auth/ServerZkAuthOperations.d.ts +3 -0
- package/dist/zkgroup/auth/ServerZkAuthOperations.js +9 -1
- package/dist/zkgroup/groups/GroupIdentifier.d.ts +1 -0
- package/dist/zkgroup/groups/GroupMasterKey.d.ts +1 -0
- package/dist/zkgroup/groups/GroupPublicParams.d.ts +1 -0
- package/dist/zkgroup/groups/GroupSecretParams.d.ts +1 -0
- package/dist/zkgroup/groups/GroupSecretParams.js +3 -3
- package/dist/zkgroup/groups/ProfileKeyCiphertext.d.ts +1 -0
- package/dist/zkgroup/groups/UuidCiphertext.d.ts +1 -0
- package/dist/zkgroup/profiles/ClientZkProfileOperations.d.ts +5 -0
- package/dist/zkgroup/profiles/ClientZkProfileOperations.js +12 -1
- package/dist/zkgroup/profiles/ExpiringProfileKeyCredential.d.ts +7 -0
- package/dist/zkgroup/profiles/ExpiringProfileKeyCredential.js +19 -0
- package/dist/zkgroup/profiles/ExpiringProfileKeyCredentialResponse.d.ts +6 -0
- package/dist/zkgroup/profiles/ExpiringProfileKeyCredentialResponse.js +15 -0
- package/dist/zkgroup/profiles/PniCredential.d.ts +1 -0
- package/dist/zkgroup/profiles/PniCredentialPresentation.d.ts +1 -0
- package/dist/zkgroup/profiles/PniCredentialRequestContext.d.ts +1 -0
- package/dist/zkgroup/profiles/PniCredentialResponse.d.ts +1 -0
- package/dist/zkgroup/profiles/ProfileKey.d.ts +1 -0
- package/dist/zkgroup/profiles/ProfileKeyCommitment.d.ts +1 -0
- package/dist/zkgroup/profiles/ProfileKeyCredential.d.ts +1 -0
- package/dist/zkgroup/profiles/ProfileKeyCredentialPresentation.d.ts +1 -0
- package/dist/zkgroup/profiles/ProfileKeyCredentialRequest.d.ts +1 -0
- package/dist/zkgroup/profiles/ProfileKeyCredentialRequestContext.d.ts +1 -0
- package/dist/zkgroup/profiles/ProfileKeyCredentialResponse.d.ts +1 -0
- package/dist/zkgroup/profiles/ProfileKeyVersion.d.ts +1 -0
- package/dist/zkgroup/profiles/ServerZkProfileOperations.d.ts +4 -1
- package/dist/zkgroup/profiles/ServerZkProfileOperations.js +11 -3
- package/dist/zkgroup/receipts/ReceiptCredential.d.ts +2 -1
- package/dist/zkgroup/receipts/ReceiptCredential.js +1 -1
- package/dist/zkgroup/receipts/ReceiptCredentialPresentation.d.ts +2 -1
- package/dist/zkgroup/receipts/ReceiptCredentialPresentation.js +1 -1
- package/dist/zkgroup/receipts/ReceiptCredentialRequest.d.ts +1 -0
- package/dist/zkgroup/receipts/ReceiptCredentialRequestContext.d.ts +1 -0
- package/dist/zkgroup/receipts/ReceiptCredentialResponse.d.ts +1 -0
- package/dist/zkgroup/receipts/ReceiptSerial.d.ts +1 -0
- package/dist/zkgroup/receipts/ServerZkReceiptOperations.d.ts +2 -2
- package/dist/zkgroup/receipts/ServerZkReceiptOperations.js +1 -1
- package/package.json +5 -7
- package/prebuilds/darwin-arm64/node.napi.node +0 -0
- package/prebuilds/darwin-x64/node.napi.node +0 -0
- package/prebuilds/linux-arm64/node.napi.node +0 -0
- package/prebuilds/linux-x64/node.napi.node +0 -0
- package/prebuilds/win32-arm64/node.napi.node +0 -0
- package/prebuilds/win32-x64/node.napi.node +0 -0
package/Native.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
//
|
|
2
|
-
// Copyright 2020-
|
|
2
|
+
// Copyright 2020-2022 Signal Messenger, LLC.
|
|
3
3
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
4
4
|
//
|
|
5
5
|
|
|
6
6
|
// WARNING: this file was automatically generated
|
|
7
7
|
|
|
8
8
|
type Uuid = Buffer;
|
|
9
|
+
|
|
10
|
+
/// A Native.Timestamp may be measured in seconds or in milliseconds;
|
|
11
|
+
/// what's important is that it's an integer less than Number.MAX_SAFE_INTEGER.
|
|
9
12
|
type Timestamp = number;
|
|
10
13
|
|
|
11
14
|
export abstract class IdentityKeyStore {
|
|
@@ -50,11 +53,19 @@ export const enum LogLevel { Error = 1, Warn, Info, Debug, Trace }
|
|
|
50
53
|
export function Aes256GcmSiv_Decrypt(aesGcmSiv: Wrapper<Aes256GcmSiv>, ctext: Buffer, nonce: Buffer, associatedData: Buffer): Buffer;
|
|
51
54
|
export function Aes256GcmSiv_Encrypt(aesGcmSivObj: Wrapper<Aes256GcmSiv>, ptext: Buffer, nonce: Buffer, associatedData: Buffer): Buffer;
|
|
52
55
|
export function Aes256GcmSiv_New(key: Buffer): Aes256GcmSiv;
|
|
53
|
-
export function AuthCredentialPresentation_CheckValidContents(
|
|
54
|
-
export function
|
|
55
|
-
export function
|
|
56
|
-
export function
|
|
57
|
-
export function
|
|
56
|
+
export function AuthCredentialPresentation_CheckValidContents(presentationBytes: Buffer): void;
|
|
57
|
+
export function AuthCredentialPresentation_GetPniCiphertext(presentationBytes: Buffer): Buffer;
|
|
58
|
+
export function AuthCredentialPresentation_GetRedemptionTime(presentationBytes: Buffer): Timestamp;
|
|
59
|
+
export function AuthCredentialPresentation_GetUuidCiphertext(presentationBytes: Buffer): Serialized<UuidCiphertext>;
|
|
60
|
+
export function AuthCredentialResponse_CheckValidContents(buffer: Buffer): void;
|
|
61
|
+
export function AuthCredentialWithPniResponse_CheckValidContents(buffer: Buffer): void;
|
|
62
|
+
export function AuthCredentialWithPni_CheckValidContents(buffer: Buffer): void;
|
|
63
|
+
export function AuthCredential_CheckValidContents(buffer: Buffer): void;
|
|
64
|
+
export function Cds2ClientState_CompleteHandshake(cli: Wrapper<Cds2ClientState>, handshakeReceived: Buffer): void;
|
|
65
|
+
export function Cds2ClientState_EstablishedRecv(cli: Wrapper<Cds2ClientState>, receivedCiphertext: Buffer): Buffer;
|
|
66
|
+
export function Cds2ClientState_EstablishedSend(cli: Wrapper<Cds2ClientState>, plaintextToSend: Buffer): Buffer;
|
|
67
|
+
export function Cds2ClientState_InitialRequest(obj: Wrapper<Cds2ClientState>): Buffer;
|
|
68
|
+
export function Cds2ClientState_New(mrenclave: Buffer, caCert: Buffer, attestationMsg: Buffer, earliestValidTimestamp: Timestamp): Cds2ClientState;
|
|
58
69
|
export function CiphertextMessage_FromPlaintextContent(m: Wrapper<PlaintextContent>): CiphertextMessage;
|
|
59
70
|
export function CiphertextMessage_Serialize(obj: Wrapper<CiphertextMessage>): Buffer;
|
|
60
71
|
export function CiphertextMessage_Type(msg: Wrapper<CiphertextMessage>): number;
|
|
@@ -65,15 +76,18 @@ export function DecryptionErrorMessage_GetDeviceId(obj: Wrapper<DecryptionErrorM
|
|
|
65
76
|
export function DecryptionErrorMessage_GetRatchetKey(m: Wrapper<DecryptionErrorMessage>): PublicKey | null;
|
|
66
77
|
export function DecryptionErrorMessage_GetTimestamp(obj: Wrapper<DecryptionErrorMessage>): Timestamp;
|
|
67
78
|
export function DecryptionErrorMessage_Serialize(obj: Wrapper<DecryptionErrorMessage>): Buffer;
|
|
79
|
+
export function ExpiringProfileKeyCredentialResponse_CheckValidContents(buffer: Buffer): void;
|
|
80
|
+
export function ExpiringProfileKeyCredential_CheckValidContents(buffer: Buffer): void;
|
|
81
|
+
export function ExpiringProfileKeyCredential_GetExpirationTime(credential: Serialized<ExpiringProfileKeyCredential>): Timestamp;
|
|
68
82
|
export function Fingerprint_DisplayString(obj: Wrapper<Fingerprint>): string;
|
|
69
83
|
export function Fingerprint_New(iterations: number, version: number, localIdentifier: Buffer, localKey: Wrapper<PublicKey>, remoteIdentifier: Buffer, remoteKey: Wrapper<PublicKey>): Fingerprint;
|
|
70
84
|
export function Fingerprint_ScannableEncoding(obj: Wrapper<Fingerprint>): Buffer;
|
|
71
85
|
export function GroupCipher_DecryptMessage(sender: Wrapper<ProtocolAddress>, message: Buffer, store: SenderKeyStore, ctx: null): Promise<Buffer>;
|
|
72
86
|
export function GroupCipher_EncryptMessage(sender: Wrapper<ProtocolAddress>, distributionId: Uuid, message: Buffer, store: SenderKeyStore, ctx: null): Promise<CiphertextMessage>;
|
|
73
|
-
export function GroupMasterKey_CheckValidContents(
|
|
74
|
-
export function GroupPublicParams_CheckValidContents(
|
|
87
|
+
export function GroupMasterKey_CheckValidContents(buffer: Buffer): void;
|
|
88
|
+
export function GroupPublicParams_CheckValidContents(buffer: Buffer): void;
|
|
75
89
|
export function GroupPublicParams_GetGroupIdentifier(groupPublicParams: Serialized<GroupPublicParams>): Buffer;
|
|
76
|
-
export function GroupSecretParams_CheckValidContents(
|
|
90
|
+
export function GroupSecretParams_CheckValidContents(buffer: Buffer): void;
|
|
77
91
|
export function GroupSecretParams_DecryptBlobWithPadding(params: Serialized<GroupSecretParams>, ciphertext: Buffer): Buffer;
|
|
78
92
|
export function GroupSecretParams_DecryptProfileKey(params: Serialized<GroupSecretParams>, profileKey: Serialized<ProfileKeyCiphertext>, uuid: Uuid): Serialized<ProfileKey>;
|
|
79
93
|
export function GroupSecretParams_DecryptUuid(params: Serialized<GroupSecretParams>, uuid: Serialized<UuidCiphertext>): Uuid;
|
|
@@ -97,14 +111,14 @@ export function PlaintextContent_Deserialize(data: Buffer): PlaintextContent;
|
|
|
97
111
|
export function PlaintextContent_FromDecryptionErrorMessage(m: Wrapper<DecryptionErrorMessage>): PlaintextContent;
|
|
98
112
|
export function PlaintextContent_GetBody(obj: Wrapper<PlaintextContent>): Buffer;
|
|
99
113
|
export function PlaintextContent_Serialize(obj: Wrapper<PlaintextContent>): Buffer;
|
|
100
|
-
export function PniCredentialPresentation_CheckValidContents(
|
|
101
|
-
export function PniCredentialPresentation_GetAciCiphertext(
|
|
102
|
-
export function PniCredentialPresentation_GetPniCiphertext(
|
|
103
|
-
export function PniCredentialPresentation_GetProfileKeyCiphertext(
|
|
104
|
-
export function PniCredentialRequestContext_CheckValidContents(
|
|
114
|
+
export function PniCredentialPresentation_CheckValidContents(presentationBytes: Buffer): void;
|
|
115
|
+
export function PniCredentialPresentation_GetAciCiphertext(presentationBytes: Buffer): Serialized<UuidCiphertext>;
|
|
116
|
+
export function PniCredentialPresentation_GetPniCiphertext(presentationBytes: Buffer): Serialized<UuidCiphertext>;
|
|
117
|
+
export function PniCredentialPresentation_GetProfileKeyCiphertext(presentationBytes: Buffer): Serialized<ProfileKeyCiphertext>;
|
|
118
|
+
export function PniCredentialRequestContext_CheckValidContents(buffer: Buffer): void;
|
|
105
119
|
export function PniCredentialRequestContext_GetRequest(context: Serialized<PniCredentialRequestContext>): Serialized<ProfileKeyCredentialRequest>;
|
|
106
|
-
export function PniCredentialResponse_CheckValidContents(
|
|
107
|
-
export function PniCredential_CheckValidContents(
|
|
120
|
+
export function PniCredentialResponse_CheckValidContents(buffer: Buffer): void;
|
|
121
|
+
export function PniCredential_CheckValidContents(buffer: Buffer): void;
|
|
108
122
|
export function PreKeyBundle_GetDeviceId(obj: Wrapper<PreKeyBundle>): number;
|
|
109
123
|
export function PreKeyBundle_GetIdentityKey(p: Wrapper<PreKeyBundle>): PublicKey;
|
|
110
124
|
export function PreKeyBundle_GetPreKeyId(obj: Wrapper<PreKeyBundle>): number | null;
|
|
@@ -133,17 +147,17 @@ export function PrivateKey_Generate(): PrivateKey;
|
|
|
133
147
|
export function PrivateKey_GetPublicKey(k: Wrapper<PrivateKey>): PublicKey;
|
|
134
148
|
export function PrivateKey_Serialize(obj: Wrapper<PrivateKey>): Buffer;
|
|
135
149
|
export function PrivateKey_Sign(key: Wrapper<PrivateKey>, message: Buffer): Buffer;
|
|
136
|
-
export function ProfileKeyCiphertext_CheckValidContents(
|
|
137
|
-
export function ProfileKeyCommitment_CheckValidContents(
|
|
138
|
-
export function ProfileKeyCredentialPresentation_CheckValidContents(
|
|
139
|
-
export function ProfileKeyCredentialPresentation_GetProfileKeyCiphertext(
|
|
140
|
-
export function ProfileKeyCredentialPresentation_GetUuidCiphertext(
|
|
141
|
-
export function ProfileKeyCredentialRequestContext_CheckValidContents(
|
|
150
|
+
export function ProfileKeyCiphertext_CheckValidContents(buffer: Buffer): void;
|
|
151
|
+
export function ProfileKeyCommitment_CheckValidContents(buffer: Buffer): void;
|
|
152
|
+
export function ProfileKeyCredentialPresentation_CheckValidContents(presentationBytes: Buffer): void;
|
|
153
|
+
export function ProfileKeyCredentialPresentation_GetProfileKeyCiphertext(presentationBytes: Buffer): Serialized<ProfileKeyCiphertext>;
|
|
154
|
+
export function ProfileKeyCredentialPresentation_GetUuidCiphertext(presentationBytes: Buffer): Serialized<UuidCiphertext>;
|
|
155
|
+
export function ProfileKeyCredentialRequestContext_CheckValidContents(buffer: Buffer): void;
|
|
142
156
|
export function ProfileKeyCredentialRequestContext_GetRequest(context: Serialized<ProfileKeyCredentialRequestContext>): Serialized<ProfileKeyCredentialRequest>;
|
|
143
|
-
export function ProfileKeyCredentialRequest_CheckValidContents(
|
|
144
|
-
export function ProfileKeyCredentialResponse_CheckValidContents(
|
|
145
|
-
export function ProfileKeyCredential_CheckValidContents(
|
|
146
|
-
export function ProfileKey_CheckValidContents(
|
|
157
|
+
export function ProfileKeyCredentialRequest_CheckValidContents(buffer: Buffer): void;
|
|
158
|
+
export function ProfileKeyCredentialResponse_CheckValidContents(buffer: Buffer): void;
|
|
159
|
+
export function ProfileKeyCredential_CheckValidContents(buffer: Buffer): void;
|
|
160
|
+
export function ProfileKey_CheckValidContents(buffer: Buffer): void;
|
|
147
161
|
export function ProfileKey_GetCommitment(profileKey: Serialized<ProfileKey>, uuid: Uuid): Serialized<ProfileKeyCommitment>;
|
|
148
162
|
export function ProfileKey_GetProfileKeyVersion(profileKey: Serialized<ProfileKey>, uuid: Uuid): Buffer;
|
|
149
163
|
export function ProtocolAddress_DeviceId(obj: Wrapper<ProtocolAddress>): number;
|
|
@@ -154,16 +168,16 @@ export function PublicKey_Deserialize(data: Buffer): PublicKey;
|
|
|
154
168
|
export function PublicKey_GetPublicKeyBytes(obj: Wrapper<PublicKey>): Buffer;
|
|
155
169
|
export function PublicKey_Serialize(obj: Wrapper<PublicKey>): Buffer;
|
|
156
170
|
export function PublicKey_Verify(key: Wrapper<PublicKey>, message: Buffer, signature: Buffer): boolean;
|
|
157
|
-
export function ReceiptCredentialPresentation_CheckValidContents(
|
|
158
|
-
export function ReceiptCredentialPresentation_GetReceiptExpirationTime(presentation: Serialized<ReceiptCredentialPresentation>):
|
|
171
|
+
export function ReceiptCredentialPresentation_CheckValidContents(buffer: Buffer): void;
|
|
172
|
+
export function ReceiptCredentialPresentation_GetReceiptExpirationTime(presentation: Serialized<ReceiptCredentialPresentation>): Timestamp;
|
|
159
173
|
export function ReceiptCredentialPresentation_GetReceiptLevel(presentation: Serialized<ReceiptCredentialPresentation>): Buffer;
|
|
160
174
|
export function ReceiptCredentialPresentation_GetReceiptSerial(presentation: Serialized<ReceiptCredentialPresentation>): Buffer;
|
|
161
|
-
export function ReceiptCredentialRequestContext_CheckValidContents(
|
|
175
|
+
export function ReceiptCredentialRequestContext_CheckValidContents(buffer: Buffer): void;
|
|
162
176
|
export function ReceiptCredentialRequestContext_GetRequest(requestContext: Serialized<ReceiptCredentialRequestContext>): Serialized<ReceiptCredentialRequest>;
|
|
163
|
-
export function ReceiptCredentialRequest_CheckValidContents(
|
|
164
|
-
export function ReceiptCredentialResponse_CheckValidContents(
|
|
165
|
-
export function ReceiptCredential_CheckValidContents(
|
|
166
|
-
export function ReceiptCredential_GetReceiptExpirationTime(receiptCredential: Serialized<ReceiptCredential>):
|
|
177
|
+
export function ReceiptCredentialRequest_CheckValidContents(buffer: Buffer): void;
|
|
178
|
+
export function ReceiptCredentialResponse_CheckValidContents(buffer: Buffer): void;
|
|
179
|
+
export function ReceiptCredential_CheckValidContents(buffer: Buffer): void;
|
|
180
|
+
export function ReceiptCredential_GetReceiptExpirationTime(receiptCredential: Serialized<ReceiptCredential>): Timestamp;
|
|
167
181
|
export function ReceiptCredential_GetReceiptLevel(receiptCredential: Serialized<ReceiptCredential>): Buffer;
|
|
168
182
|
export function ScannableFingerprint_Compare(fprint1: Buffer, fprint2: Buffer): boolean;
|
|
169
183
|
export function SealedSenderDecryptionResult_GetDeviceId(obj: Wrapper<SealedSenderDecryptionResult>): number;
|
|
@@ -213,30 +227,36 @@ export function ServerCertificate_GetKeyId(obj: Wrapper<ServerCertificate>): num
|
|
|
213
227
|
export function ServerCertificate_GetSerialized(obj: Wrapper<ServerCertificate>): Buffer;
|
|
214
228
|
export function ServerCertificate_GetSignature(obj: Wrapper<ServerCertificate>): Buffer;
|
|
215
229
|
export function ServerCertificate_New(keyId: number, serverKey: Wrapper<PublicKey>, trustRoot: Wrapper<PrivateKey>): ServerCertificate;
|
|
216
|
-
export function ServerPublicParams_CheckValidContents(
|
|
217
|
-
export function ServerPublicParams_CreateAuthCredentialPresentationDeterministic(serverPublicParams: Serialized<ServerPublicParams>, randomness: Buffer, groupSecretParams: Serialized<GroupSecretParams>, authCredential: Serialized<AuthCredential>):
|
|
218
|
-
export function
|
|
230
|
+
export function ServerPublicParams_CheckValidContents(buffer: Buffer): void;
|
|
231
|
+
export function ServerPublicParams_CreateAuthCredentialPresentationDeterministic(serverPublicParams: Serialized<ServerPublicParams>, randomness: Buffer, groupSecretParams: Serialized<GroupSecretParams>, authCredential: Serialized<AuthCredential>): Buffer;
|
|
232
|
+
export function ServerPublicParams_CreateAuthCredentialWithPniPresentationDeterministic(serverPublicParams: Serialized<ServerPublicParams>, randomness: Buffer, groupSecretParams: Serialized<GroupSecretParams>, authCredential: Serialized<AuthCredentialWithPni>): Buffer;
|
|
233
|
+
export function ServerPublicParams_CreateExpiringProfileKeyCredentialPresentationDeterministic(serverPublicParams: Serialized<ServerPublicParams>, randomness: Buffer, groupSecretParams: Serialized<GroupSecretParams>, profileKeyCredential: Serialized<ExpiringProfileKeyCredential>): Buffer;
|
|
234
|
+
export function ServerPublicParams_CreatePniCredentialPresentationDeterministic(serverPublicParams: Serialized<ServerPublicParams>, randomness: Buffer, groupSecretParams: Serialized<GroupSecretParams>, pniCredential: Serialized<PniCredential>): Buffer;
|
|
219
235
|
export function ServerPublicParams_CreatePniCredentialRequestContextDeterministic(serverPublicParams: Serialized<ServerPublicParams>, randomness: Buffer, aci: Uuid, pni: Uuid, profileKey: Serialized<ProfileKey>): Serialized<PniCredentialRequestContext>;
|
|
220
|
-
export function ServerPublicParams_CreateProfileKeyCredentialPresentationDeterministic(serverPublicParams: Serialized<ServerPublicParams>, randomness: Buffer, groupSecretParams: Serialized<GroupSecretParams>, profileKeyCredential: Serialized<ProfileKeyCredential>):
|
|
236
|
+
export function ServerPublicParams_CreateProfileKeyCredentialPresentationDeterministic(serverPublicParams: Serialized<ServerPublicParams>, randomness: Buffer, groupSecretParams: Serialized<GroupSecretParams>, profileKeyCredential: Serialized<ProfileKeyCredential>): Buffer;
|
|
221
237
|
export function ServerPublicParams_CreateProfileKeyCredentialRequestContextDeterministic(serverPublicParams: Serialized<ServerPublicParams>, randomness: Buffer, uuid: Uuid, profileKey: Serialized<ProfileKey>): Serialized<ProfileKeyCredentialRequestContext>;
|
|
222
238
|
export function ServerPublicParams_CreateReceiptCredentialPresentationDeterministic(serverPublicParams: Serialized<ServerPublicParams>, randomness: Buffer, receiptCredential: Serialized<ReceiptCredential>): Serialized<ReceiptCredentialPresentation>;
|
|
223
239
|
export function ServerPublicParams_CreateReceiptCredentialRequestContextDeterministic(serverPublicParams: Serialized<ServerPublicParams>, randomness: Buffer, receiptSerial: Buffer): Serialized<ReceiptCredentialRequestContext>;
|
|
224
240
|
export function ServerPublicParams_ReceiveAuthCredential(params: Serialized<ServerPublicParams>, uuid: Uuid, redemptionTime: number, response: Serialized<AuthCredentialResponse>): Serialized<AuthCredential>;
|
|
241
|
+
export function ServerPublicParams_ReceiveAuthCredentialWithPni(params: Serialized<ServerPublicParams>, aci: Uuid, pni: Uuid, redemptionTime: Timestamp, response: Serialized<AuthCredentialWithPniResponse>): Serialized<AuthCredentialWithPni>;
|
|
242
|
+
export function ServerPublicParams_ReceiveExpiringProfileKeyCredential(serverPublicParams: Serialized<ServerPublicParams>, requestContext: Serialized<ProfileKeyCredentialRequestContext>, response: Serialized<ExpiringProfileKeyCredentialResponse>, currentTimeInSeconds: Timestamp): Serialized<ExpiringProfileKeyCredential>;
|
|
225
243
|
export function ServerPublicParams_ReceivePniCredential(serverPublicParams: Serialized<ServerPublicParams>, requestContext: Serialized<PniCredentialRequestContext>, response: Serialized<PniCredentialResponse>): Serialized<PniCredential>;
|
|
226
244
|
export function ServerPublicParams_ReceiveProfileKeyCredential(serverPublicParams: Serialized<ServerPublicParams>, requestContext: Serialized<ProfileKeyCredentialRequestContext>, response: Serialized<ProfileKeyCredentialResponse>): Serialized<ProfileKeyCredential>;
|
|
227
245
|
export function ServerPublicParams_ReceiveReceiptCredential(serverPublicParams: Serialized<ServerPublicParams>, requestContext: Serialized<ReceiptCredentialRequestContext>, response: Serialized<ReceiptCredentialResponse>): Serialized<ReceiptCredential>;
|
|
228
246
|
export function ServerPublicParams_VerifySignature(serverPublicParams: Serialized<ServerPublicParams>, message: Buffer, notarySignature: Buffer): void;
|
|
229
|
-
export function ServerSecretParams_CheckValidContents(
|
|
247
|
+
export function ServerSecretParams_CheckValidContents(buffer: Buffer): void;
|
|
230
248
|
export function ServerSecretParams_GenerateDeterministic(randomness: Buffer): Serialized<ServerSecretParams>;
|
|
231
249
|
export function ServerSecretParams_GetPublicParams(params: Serialized<ServerSecretParams>): Serialized<ServerPublicParams>;
|
|
232
250
|
export function ServerSecretParams_IssueAuthCredentialDeterministic(serverSecretParams: Serialized<ServerSecretParams>, randomness: Buffer, uuid: Uuid, redemptionTime: number): Serialized<AuthCredentialResponse>;
|
|
251
|
+
export function ServerSecretParams_IssueAuthCredentialWithPniDeterministic(serverSecretParams: Serialized<ServerSecretParams>, randomness: Buffer, aci: Uuid, pni: Uuid, redemptionTime: Timestamp): Serialized<AuthCredentialWithPniResponse>;
|
|
252
|
+
export function ServerSecretParams_IssueExpiringProfileKeyCredentialDeterministic(serverSecretParams: Serialized<ServerSecretParams>, randomness: Buffer, request: Serialized<ProfileKeyCredentialRequest>, uuid: Uuid, commitment: Serialized<ProfileKeyCommitment>, expirationInSeconds: Timestamp): Serialized<ExpiringProfileKeyCredentialResponse>;
|
|
233
253
|
export function ServerSecretParams_IssuePniCredentialDeterministic(serverSecretParams: Serialized<ServerSecretParams>, randomness: Buffer, request: Serialized<ProfileKeyCredentialRequest>, aci: Uuid, pni: Uuid, commitment: Serialized<ProfileKeyCommitment>): Serialized<PniCredentialResponse>;
|
|
234
254
|
export function ServerSecretParams_IssueProfileKeyCredentialDeterministic(serverSecretParams: Serialized<ServerSecretParams>, randomness: Buffer, request: Serialized<ProfileKeyCredentialRequest>, uuid: Uuid, commitment: Serialized<ProfileKeyCommitment>): Serialized<ProfileKeyCredentialResponse>;
|
|
235
|
-
export function ServerSecretParams_IssueReceiptCredentialDeterministic(serverSecretParams: Serialized<ServerSecretParams>, randomness: Buffer, request: Serialized<ReceiptCredentialRequest>, receiptExpirationTime:
|
|
255
|
+
export function ServerSecretParams_IssueReceiptCredentialDeterministic(serverSecretParams: Serialized<ServerSecretParams>, randomness: Buffer, request: Serialized<ReceiptCredentialRequest>, receiptExpirationTime: Timestamp, receiptLevel: Buffer): Serialized<ReceiptCredentialResponse>;
|
|
236
256
|
export function ServerSecretParams_SignDeterministic(params: Serialized<ServerSecretParams>, randomness: Buffer, message: Buffer): Buffer;
|
|
237
|
-
export function ServerSecretParams_VerifyAuthCredentialPresentation(serverSecretParams: Serialized<ServerSecretParams>, groupPublicParams: Serialized<GroupPublicParams>,
|
|
238
|
-
export function ServerSecretParams_VerifyPniCredentialPresentation(serverSecretParams: Serialized<ServerSecretParams>, groupPublicParams: Serialized<GroupPublicParams>,
|
|
239
|
-
export function ServerSecretParams_VerifyProfileKeyCredentialPresentation(serverSecretParams: Serialized<ServerSecretParams>, groupPublicParams: Serialized<GroupPublicParams>,
|
|
257
|
+
export function ServerSecretParams_VerifyAuthCredentialPresentation(serverSecretParams: Serialized<ServerSecretParams>, groupPublicParams: Serialized<GroupPublicParams>, presentationBytes: Buffer): void;
|
|
258
|
+
export function ServerSecretParams_VerifyPniCredentialPresentation(serverSecretParams: Serialized<ServerSecretParams>, groupPublicParams: Serialized<GroupPublicParams>, presentationBytes: Buffer): void;
|
|
259
|
+
export function ServerSecretParams_VerifyProfileKeyCredentialPresentation(serverSecretParams: Serialized<ServerSecretParams>, groupPublicParams: Serialized<GroupPublicParams>, presentationBytes: Buffer, currentTimeInSeconds: Timestamp): void;
|
|
240
260
|
export function ServerSecretParams_VerifyReceiptCredentialPresentation(serverSecretParams: Serialized<ServerSecretParams>, presentation: Serialized<ReceiptCredentialPresentation>): void;
|
|
241
261
|
export function SessionBuilder_ProcessPreKeyBundle(bundle: Wrapper<PreKeyBundle>, protocolAddress: Wrapper<ProtocolAddress>, sessionStore: SessionStore, identityKeyStore: IdentityKeyStore, ctx: null): Promise<void>;
|
|
242
262
|
export function SessionCipher_DecryptPreKeySignalMessage(message: Wrapper<PreKeySignalMessage>, protocolAddress: Wrapper<ProtocolAddress>, sessionStore: SessionStore, identityKeyStore: IdentityKeyStore, prekeyStore: PreKeyStore, signedPrekeyStore: SignedPreKeyStore, ctx: null): Promise<Buffer>;
|
|
@@ -248,9 +268,7 @@ export function SessionRecord_Deserialize(data: Buffer): SessionRecord;
|
|
|
248
268
|
export function SessionRecord_GetLocalRegistrationId(obj: Wrapper<SessionRecord>): number;
|
|
249
269
|
export function SessionRecord_GetRemoteRegistrationId(obj: Wrapper<SessionRecord>): number;
|
|
250
270
|
export function SessionRecord_HasCurrentState(obj: Wrapper<SessionRecord>): boolean;
|
|
251
|
-
export function SessionRecord_NeedsPniSignature(obj: Wrapper<SessionRecord>): boolean;
|
|
252
271
|
export function SessionRecord_Serialize(obj: Wrapper<SessionRecord>): Buffer;
|
|
253
|
-
export function SessionRecord_SetNeedsPniSignature(s: Wrapper<SessionRecord>, needsPniSignature: boolean): void;
|
|
254
272
|
export function SignalMessage_Deserialize(data: Buffer): SignalMessage;
|
|
255
273
|
export function SignalMessage_GetBody(obj: Wrapper<SignalMessage>): Buffer;
|
|
256
274
|
export function SignalMessage_GetCounter(obj: Wrapper<SignalMessage>): number;
|
|
@@ -274,14 +292,18 @@ export function UnidentifiedSenderMessageContent_GetMsgType(m: Wrapper<Unidentif
|
|
|
274
292
|
export function UnidentifiedSenderMessageContent_GetSenderCert(m: Wrapper<UnidentifiedSenderMessageContent>): SenderCertificate;
|
|
275
293
|
export function UnidentifiedSenderMessageContent_New(message: Wrapper<CiphertextMessage>, sender: Wrapper<SenderCertificate>, contentHint: number, groupId: Buffer | null): UnidentifiedSenderMessageContent;
|
|
276
294
|
export function UnidentifiedSenderMessageContent_Serialize(obj: Wrapper<UnidentifiedSenderMessageContent>): Buffer;
|
|
277
|
-
export function UuidCiphertext_CheckValidContents(
|
|
295
|
+
export function UuidCiphertext_CheckValidContents(buffer: Buffer): void;
|
|
278
296
|
export function initLogger(maxLevel: LogLevel, callback: (level: LogLevel, target: string, file: string | null, line: number | null, message: string) => void): void
|
|
279
297
|
interface Aes256GcmSiv { readonly __type: unique symbol; }
|
|
280
298
|
interface AuthCredential { readonly __type: unique symbol; }
|
|
281
|
-
interface AuthCredentialPresentation { readonly __type: unique symbol; }
|
|
282
299
|
interface AuthCredentialResponse { readonly __type: unique symbol; }
|
|
300
|
+
interface AuthCredentialWithPni { readonly __type: unique symbol; }
|
|
301
|
+
interface AuthCredentialWithPniResponse { readonly __type: unique symbol; }
|
|
302
|
+
interface Cds2ClientState { readonly __type: unique symbol; }
|
|
283
303
|
interface CiphertextMessage { readonly __type: unique symbol; }
|
|
284
304
|
interface DecryptionErrorMessage { readonly __type: unique symbol; }
|
|
305
|
+
interface ExpiringProfileKeyCredential { readonly __type: unique symbol; }
|
|
306
|
+
interface ExpiringProfileKeyCredentialResponse { readonly __type: unique symbol; }
|
|
285
307
|
interface Fingerprint { readonly __type: unique symbol; }
|
|
286
308
|
interface GroupMasterKey { readonly __type: unique symbol; }
|
|
287
309
|
interface GroupPublicParams { readonly __type: unique symbol; }
|
|
@@ -289,7 +311,6 @@ interface GroupSecretParams { readonly __type: unique symbol; }
|
|
|
289
311
|
interface HsmEnclaveClient { readonly __type: unique symbol; }
|
|
290
312
|
interface PlaintextContent { readonly __type: unique symbol; }
|
|
291
313
|
interface PniCredential { readonly __type: unique symbol; }
|
|
292
|
-
interface PniCredentialPresentation { readonly __type: unique symbol; }
|
|
293
314
|
interface PniCredentialRequestContext { readonly __type: unique symbol; }
|
|
294
315
|
interface PniCredentialResponse { readonly __type: unique symbol; }
|
|
295
316
|
interface PreKeyBundle { readonly __type: unique symbol; }
|
|
@@ -300,7 +321,6 @@ interface ProfileKey { readonly __type: unique symbol; }
|
|
|
300
321
|
interface ProfileKeyCiphertext { readonly __type: unique symbol; }
|
|
301
322
|
interface ProfileKeyCommitment { readonly __type: unique symbol; }
|
|
302
323
|
interface ProfileKeyCredential { readonly __type: unique symbol; }
|
|
303
|
-
interface ProfileKeyCredentialPresentation { readonly __type: unique symbol; }
|
|
304
324
|
interface ProfileKeyCredentialRequest { readonly __type: unique symbol; }
|
|
305
325
|
interface ProfileKeyCredentialRequestContext { readonly __type: unique symbol; }
|
|
306
326
|
interface ProfileKeyCredentialResponse { readonly __type: unique symbol; }
|
package/dist/index.d.ts
CHANGED
|
@@ -153,19 +153,6 @@ export declare class SessionRecord {
|
|
|
153
153
|
localRegistrationId(): number;
|
|
154
154
|
remoteRegistrationId(): number;
|
|
155
155
|
hasCurrentState(): boolean;
|
|
156
|
-
/**
|
|
157
|
-
* Returns true if this session was marked as needing a PNI signature and has not received a
|
|
158
|
-
* reply.
|
|
159
|
-
*
|
|
160
|
-
* Precondition: `this.hasCurrentState()`
|
|
161
|
-
*/
|
|
162
|
-
needsPniSignature(): boolean;
|
|
163
|
-
/**
|
|
164
|
-
* Marks whether this session needs a PNI signature included in outgoing messages.
|
|
165
|
-
*
|
|
166
|
-
* Precondition: `this.hasCurrentState()`
|
|
167
|
-
*/
|
|
168
|
-
setNeedsPniSignature(needsPniSignature: boolean): void;
|
|
169
156
|
currentRatchetKeyMatches(key: PublicKey): boolean;
|
|
170
157
|
}
|
|
171
158
|
export declare class ServerCertificate {
|
|
@@ -334,6 +321,15 @@ export declare function sealedSenderMultiRecipientEncrypt(content: UnidentifiedS
|
|
|
334
321
|
export declare function sealedSenderMultiRecipientMessageForSingleRecipient(message: Buffer): Buffer;
|
|
335
322
|
export declare function sealedSenderDecryptMessage(message: Buffer, trustRoot: PublicKey, timestamp: number, localE164: string | null, localUuid: string, localDeviceId: number, sessionStore: SessionStore, identityStore: IdentityKeyStore, prekeyStore: PreKeyStore, signedPrekeyStore: SignedPreKeyStore): Promise<SealedSenderDecryptionResult>;
|
|
336
323
|
export declare function sealedSenderDecryptToUsmc(message: Buffer, identityStore: IdentityKeyStore): Promise<UnidentifiedSenderMessageContent>;
|
|
324
|
+
export declare class Cds2Client {
|
|
325
|
+
readonly _nativeHandle: Native.Cds2ClientState;
|
|
326
|
+
private constructor();
|
|
327
|
+
static new_NOT_FOR_PRODUCTION(mrenclave: Buffer, trustedCaCert: Buffer, attestationMsg: Buffer, earliestValidTimestamp: Date): Cds2Client;
|
|
328
|
+
initialRequest(): Buffer;
|
|
329
|
+
completeHandshake(buffer: Buffer): void;
|
|
330
|
+
establishedSend(buffer: Buffer): Buffer;
|
|
331
|
+
establishedRecv(buffer: Buffer): Buffer;
|
|
332
|
+
}
|
|
337
333
|
export declare class HsmEnclaveClient {
|
|
338
334
|
readonly _nativeHandle: Native.HsmEnclaveClient;
|
|
339
335
|
private constructor();
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,11 @@
|
|
|
5
5
|
//
|
|
6
6
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
7
|
if (k2 === undefined) k2 = k;
|
|
8
|
-
Object.
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
9
13
|
}) : (function(o, m, k, k2) {
|
|
10
14
|
if (k2 === undefined) k2 = k;
|
|
11
15
|
o[k2] = m[k];
|
|
@@ -23,7 +27,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
23
27
|
});
|
|
24
28
|
};
|
|
25
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.initLogger = exports.LogLevel = exports.HsmEnclaveClient = exports.sealedSenderDecryptToUsmc = exports.sealedSenderDecryptMessage = exports.sealedSenderMultiRecipientMessageForSingleRecipient = exports.sealedSenderMultiRecipientEncrypt = exports.sealedSenderEncrypt = exports.sealedSenderEncryptMessage = exports.signalDecryptPreKey = exports.signalDecrypt = exports.signalEncrypt = exports.processPreKeyBundle = exports.DecryptionErrorMessage = exports.PlaintextContent = exports.CiphertextMessage = exports.SealedSenderDecryptionResult = exports.groupDecrypt = exports.groupEncrypt = exports.SenderKeyStore = exports.SignedPreKeyStore = exports.PreKeyStore = exports.IdentityKeyStore = exports.SessionStore = exports.UnidentifiedSenderMessageContent = exports.SenderKeyMessage = exports.processSenderKeyDistributionMessage = exports.SenderKeyDistributionMessage = exports.SenderCertificate = exports.SenderKeyRecord = exports.ServerCertificate = exports.SessionRecord = exports.PreKeySignalMessage = exports.SignalMessage = exports.SignedPreKeyRecord = exports.PreKeyRecord = exports.PreKeyBundle = exports.IdentityKeyPair = exports.PrivateKey = exports.PublicKey = exports.Aes256GcmSiv = exports.Fingerprint = exports.DisplayableFingerprint = exports.ScannableFingerprint = exports.hkdf = exports.HKDF = exports.ContentHint = exports.Direction = exports.CiphertextMessageType = void 0;
|
|
30
|
+
exports.initLogger = exports.LogLevel = exports.HsmEnclaveClient = exports.Cds2Client = exports.sealedSenderDecryptToUsmc = exports.sealedSenderDecryptMessage = exports.sealedSenderMultiRecipientMessageForSingleRecipient = exports.sealedSenderMultiRecipientEncrypt = exports.sealedSenderEncrypt = exports.sealedSenderEncryptMessage = exports.signalDecryptPreKey = exports.signalDecrypt = exports.signalEncrypt = exports.processPreKeyBundle = exports.DecryptionErrorMessage = exports.PlaintextContent = exports.CiphertextMessage = exports.SealedSenderDecryptionResult = exports.groupDecrypt = exports.groupEncrypt = exports.SenderKeyStore = exports.SignedPreKeyStore = exports.PreKeyStore = exports.IdentityKeyStore = exports.SessionStore = exports.UnidentifiedSenderMessageContent = exports.SenderKeyMessage = exports.processSenderKeyDistributionMessage = exports.SenderKeyDistributionMessage = exports.SenderCertificate = exports.SenderKeyRecord = exports.ServerCertificate = exports.SessionRecord = exports.PreKeySignalMessage = exports.SignalMessage = exports.SignedPreKeyRecord = exports.PreKeyRecord = exports.PreKeyBundle = exports.IdentityKeyPair = exports.PrivateKey = exports.PublicKey = exports.Aes256GcmSiv = exports.Fingerprint = exports.DisplayableFingerprint = exports.ScannableFingerprint = exports.hkdf = exports.HKDF = exports.ContentHint = exports.Direction = exports.CiphertextMessageType = void 0;
|
|
27
31
|
const uuid = require("uuid");
|
|
28
32
|
const Errors = require("./Errors");
|
|
29
33
|
__exportStar(require("./Errors"), exports);
|
|
@@ -379,23 +383,6 @@ class SessionRecord {
|
|
|
379
383
|
hasCurrentState() {
|
|
380
384
|
return Native.SessionRecord_HasCurrentState(this);
|
|
381
385
|
}
|
|
382
|
-
/**
|
|
383
|
-
* Returns true if this session was marked as needing a PNI signature and has not received a
|
|
384
|
-
* reply.
|
|
385
|
-
*
|
|
386
|
-
* Precondition: `this.hasCurrentState()`
|
|
387
|
-
*/
|
|
388
|
-
needsPniSignature() {
|
|
389
|
-
return Native.SessionRecord_NeedsPniSignature(this);
|
|
390
|
-
}
|
|
391
|
-
/**
|
|
392
|
-
* Marks whether this session needs a PNI signature included in outgoing messages.
|
|
393
|
-
*
|
|
394
|
-
* Precondition: `this.hasCurrentState()`
|
|
395
|
-
*/
|
|
396
|
-
setNeedsPniSignature(needsPniSignature) {
|
|
397
|
-
Native.SessionRecord_SetNeedsPniSignature(this, needsPniSignature);
|
|
398
|
-
}
|
|
399
386
|
currentRatchetKeyMatches(key) {
|
|
400
387
|
return Native.SessionRecord_CurrentRatchetKeyMatches(this, key);
|
|
401
388
|
}
|
|
@@ -864,6 +851,27 @@ function sealedSenderDecryptToUsmc(message, identityStore) {
|
|
|
864
851
|
});
|
|
865
852
|
}
|
|
866
853
|
exports.sealedSenderDecryptToUsmc = sealedSenderDecryptToUsmc;
|
|
854
|
+
class Cds2Client {
|
|
855
|
+
constructor(nativeHandle) {
|
|
856
|
+
this._nativeHandle = nativeHandle;
|
|
857
|
+
}
|
|
858
|
+
static new_NOT_FOR_PRODUCTION(mrenclave, trustedCaCert, attestationMsg, earliestValidTimestamp) {
|
|
859
|
+
return new Cds2Client(Native.Cds2ClientState_New(mrenclave, trustedCaCert, attestationMsg, earliestValidTimestamp.getTime()));
|
|
860
|
+
}
|
|
861
|
+
initialRequest() {
|
|
862
|
+
return Native.Cds2ClientState_InitialRequest(this);
|
|
863
|
+
}
|
|
864
|
+
completeHandshake(buffer) {
|
|
865
|
+
return Native.Cds2ClientState_CompleteHandshake(this, buffer);
|
|
866
|
+
}
|
|
867
|
+
establishedSend(buffer) {
|
|
868
|
+
return Native.Cds2ClientState_EstablishedSend(this, buffer);
|
|
869
|
+
}
|
|
870
|
+
establishedRecv(buffer) {
|
|
871
|
+
return Native.Cds2ClientState_EstablishedRecv(this, buffer);
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
exports.Cds2Client = Cds2Client;
|
|
867
875
|
class HsmEnclaveClient {
|
|
868
876
|
constructor(nativeHandle) {
|
|
869
877
|
this._nativeHandle = nativeHandle;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import ByteArray from './internal/ByteArray';
|
|
3
3
|
import NotarySignature from './NotarySignature';
|
|
4
4
|
export default class ServerPublicParams extends ByteArray {
|
|
5
|
+
private readonly __type?;
|
|
5
6
|
constructor(contents: Buffer);
|
|
6
7
|
verifySignature(message: Buffer, notarySignature: NotarySignature): void;
|
|
7
8
|
}
|
|
@@ -3,6 +3,7 @@ import ByteArray from './internal/ByteArray';
|
|
|
3
3
|
import ServerPublicParams from './ServerPublicParams';
|
|
4
4
|
import NotarySignature from './NotarySignature';
|
|
5
5
|
export default class ServerSecretParams extends ByteArray {
|
|
6
|
+
private readonly __type?;
|
|
6
7
|
static generate(): ServerSecretParams;
|
|
7
8
|
static generateWithRandom(random: Buffer): ServerSecretParams;
|
|
8
9
|
constructor(contents: Buffer);
|
|
@@ -11,6 +11,9 @@ const Constants_1 = require("./internal/Constants");
|
|
|
11
11
|
const ServerPublicParams_1 = require("./ServerPublicParams");
|
|
12
12
|
const NotarySignature_1 = require("./NotarySignature");
|
|
13
13
|
class ServerSecretParams extends ByteArray_1.default {
|
|
14
|
+
constructor(contents) {
|
|
15
|
+
super(contents, Native.ServerSecretParams_CheckValidContents);
|
|
16
|
+
}
|
|
14
17
|
static generate() {
|
|
15
18
|
const random = (0, crypto_1.randomBytes)(Constants_1.RANDOM_LENGTH);
|
|
16
19
|
return ServerSecretParams.generateWithRandom(random);
|
|
@@ -18,9 +21,6 @@ class ServerSecretParams extends ByteArray_1.default {
|
|
|
18
21
|
static generateWithRandom(random) {
|
|
19
22
|
return new ServerSecretParams(Native.ServerSecretParams_GenerateDeterministic(random));
|
|
20
23
|
}
|
|
21
|
-
constructor(contents) {
|
|
22
|
-
super(contents, Native.ServerSecretParams_CheckValidContents);
|
|
23
|
-
}
|
|
24
24
|
getPublicParams() {
|
|
25
25
|
return new ServerPublicParams_1.default(Native.ServerSecretParams_GetPublicParams(this.contents));
|
|
26
26
|
}
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
import ByteArray from '../internal/ByteArray';
|
|
3
3
|
import UuidCiphertext from '../groups/UuidCiphertext';
|
|
4
4
|
export default class AuthCredentialPresentation extends ByteArray {
|
|
5
|
+
private readonly __type?;
|
|
5
6
|
constructor(contents: Buffer);
|
|
6
7
|
getUuidCiphertext(): UuidCiphertext;
|
|
7
|
-
|
|
8
|
+
getPniCiphertext(): UuidCiphertext | null;
|
|
9
|
+
getRedemptionTime(): Date;
|
|
8
10
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
//
|
|
3
|
-
// Copyright 2020-
|
|
3
|
+
// Copyright 2020-2022 Signal Messenger, LLC.
|
|
4
4
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
5
5
|
//
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -14,8 +14,15 @@ class AuthCredentialPresentation extends ByteArray_1.default {
|
|
|
14
14
|
getUuidCiphertext() {
|
|
15
15
|
return new UuidCiphertext_1.default(Native.AuthCredentialPresentation_GetUuidCiphertext(this.contents));
|
|
16
16
|
}
|
|
17
|
+
getPniCiphertext() {
|
|
18
|
+
const ciphertextBytes = Native.AuthCredentialPresentation_GetPniCiphertext(this.contents);
|
|
19
|
+
if (ciphertextBytes === null) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
return new UuidCiphertext_1.default(ciphertextBytes);
|
|
23
|
+
}
|
|
17
24
|
getRedemptionTime() {
|
|
18
|
-
return Native.AuthCredentialPresentation_GetRedemptionTime(this.contents);
|
|
25
|
+
return new Date(1000 * Native.AuthCredentialPresentation_GetRedemptionTime(this.contents));
|
|
19
26
|
}
|
|
20
27
|
}
|
|
21
28
|
exports.default = AuthCredentialPresentation;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//
|
|
3
|
+
// Copyright 2022 Signal Messenger, LLC.
|
|
4
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
5
|
+
//
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const ByteArray_1 = require("../internal/ByteArray");
|
|
8
|
+
const Native = require("../../../Native");
|
|
9
|
+
class AuthCredentialWithPni extends ByteArray_1.default {
|
|
10
|
+
constructor(contents) {
|
|
11
|
+
super(contents, Native.AuthCredentialWithPni_CheckValidContents);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.default = AuthCredentialWithPni;
|
|
15
|
+
//# sourceMappingURL=AuthCredentialWithPni.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//
|
|
3
|
+
// Copyright 2022 Signal Messenger, LLC.
|
|
4
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
5
|
+
//
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const ByteArray_1 = require("../internal/ByteArray");
|
|
8
|
+
const Native = require("../../../Native");
|
|
9
|
+
class AuthCredentialWithPniResponse extends ByteArray_1.default {
|
|
10
|
+
constructor(contents) {
|
|
11
|
+
super(contents, Native.AuthCredentialWithPniResponse_CheckValidContents);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.default = AuthCredentialWithPniResponse;
|
|
15
|
+
//# sourceMappingURL=AuthCredentialWithPniResponse.js.map
|
|
@@ -3,12 +3,22 @@ import ServerPublicParams from '../ServerPublicParams';
|
|
|
3
3
|
import AuthCredential from './AuthCredential';
|
|
4
4
|
import AuthCredentialPresentation from './AuthCredentialPresentation';
|
|
5
5
|
import AuthCredentialResponse from './AuthCredentialResponse';
|
|
6
|
+
import AuthCredentialWithPni from './AuthCredentialWithPni';
|
|
7
|
+
import AuthCredentialWithPniResponse from './AuthCredentialWithPniResponse';
|
|
6
8
|
import GroupSecretParams from '../groups/GroupSecretParams';
|
|
7
9
|
import { UUIDType } from '../internal/UUIDUtil';
|
|
8
10
|
export default class ClientZkAuthOperations {
|
|
9
11
|
serverPublicParams: ServerPublicParams;
|
|
10
12
|
constructor(serverPublicParams: ServerPublicParams);
|
|
11
13
|
receiveAuthCredential(uuid: UUIDType, redemptionTime: number, authCredentialResponse: AuthCredentialResponse): AuthCredential;
|
|
14
|
+
/**
|
|
15
|
+
* Produces the AuthCredentialWithPni from a server-generated AuthCredentialWithPniResponse.
|
|
16
|
+
*
|
|
17
|
+
* @param redemptionTime - This is provided by the server as an integer, and should be passed through directly.
|
|
18
|
+
*/
|
|
19
|
+
receiveAuthCredentialWithPni(aci: UUIDType, pni: UUIDType, redemptionTime: number, authCredentialResponse: AuthCredentialWithPniResponse): AuthCredentialWithPni;
|
|
12
20
|
createAuthCredentialPresentation(groupSecretParams: GroupSecretParams, authCredential: AuthCredential): AuthCredentialPresentation;
|
|
13
21
|
createAuthCredentialPresentationWithRandom(random: Buffer, groupSecretParams: GroupSecretParams, authCredential: AuthCredential): AuthCredentialPresentation;
|
|
22
|
+
createAuthCredentialWithPniPresentation(groupSecretParams: GroupSecretParams, authCredential: AuthCredentialWithPni): AuthCredentialPresentation;
|
|
23
|
+
createAuthCredentialWithPniPresentationWithRandom(random: Buffer, groupSecretParams: GroupSecretParams, authCredential: AuthCredentialWithPni): AuthCredentialPresentation;
|
|
14
24
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
//
|
|
3
|
-
// Copyright 2020-
|
|
3
|
+
// Copyright 2020-2022 Signal Messenger, LLC.
|
|
4
4
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
5
5
|
//
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -9,6 +9,7 @@ const Native = require("../../../Native");
|
|
|
9
9
|
const Constants_1 = require("../internal/Constants");
|
|
10
10
|
const AuthCredential_1 = require("./AuthCredential");
|
|
11
11
|
const AuthCredentialPresentation_1 = require("./AuthCredentialPresentation");
|
|
12
|
+
const AuthCredentialWithPni_1 = require("./AuthCredentialWithPni");
|
|
12
13
|
const UUIDUtil_1 = require("../internal/UUIDUtil");
|
|
13
14
|
class ClientZkAuthOperations {
|
|
14
15
|
constructor(serverPublicParams) {
|
|
@@ -17,6 +18,14 @@ class ClientZkAuthOperations {
|
|
|
17
18
|
receiveAuthCredential(uuid, redemptionTime, authCredentialResponse) {
|
|
18
19
|
return new AuthCredential_1.default(Native.ServerPublicParams_ReceiveAuthCredential(this.serverPublicParams.getContents(), (0, UUIDUtil_1.fromUUID)(uuid), redemptionTime, authCredentialResponse.getContents()));
|
|
19
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Produces the AuthCredentialWithPni from a server-generated AuthCredentialWithPniResponse.
|
|
23
|
+
*
|
|
24
|
+
* @param redemptionTime - This is provided by the server as an integer, and should be passed through directly.
|
|
25
|
+
*/
|
|
26
|
+
receiveAuthCredentialWithPni(aci, pni, redemptionTime, authCredentialResponse) {
|
|
27
|
+
return new AuthCredentialWithPni_1.default(Native.ServerPublicParams_ReceiveAuthCredentialWithPni(this.serverPublicParams.getContents(), (0, UUIDUtil_1.fromUUID)(aci), (0, UUIDUtil_1.fromUUID)(pni), redemptionTime, authCredentialResponse.getContents()));
|
|
28
|
+
}
|
|
20
29
|
createAuthCredentialPresentation(groupSecretParams, authCredential) {
|
|
21
30
|
const random = (0, crypto_1.randomBytes)(Constants_1.RANDOM_LENGTH);
|
|
22
31
|
return this.createAuthCredentialPresentationWithRandom(random, groupSecretParams, authCredential);
|
|
@@ -24,6 +33,13 @@ class ClientZkAuthOperations {
|
|
|
24
33
|
createAuthCredentialPresentationWithRandom(random, groupSecretParams, authCredential) {
|
|
25
34
|
return new AuthCredentialPresentation_1.default(Native.ServerPublicParams_CreateAuthCredentialPresentationDeterministic(this.serverPublicParams.getContents(), random, groupSecretParams.getContents(), authCredential.getContents()));
|
|
26
35
|
}
|
|
36
|
+
createAuthCredentialWithPniPresentation(groupSecretParams, authCredential) {
|
|
37
|
+
const random = (0, crypto_1.randomBytes)(Constants_1.RANDOM_LENGTH);
|
|
38
|
+
return this.createAuthCredentialWithPniPresentationWithRandom(random, groupSecretParams, authCredential);
|
|
39
|
+
}
|
|
40
|
+
createAuthCredentialWithPniPresentationWithRandom(random, groupSecretParams, authCredential) {
|
|
41
|
+
return new AuthCredentialPresentation_1.default(Native.ServerPublicParams_CreateAuthCredentialWithPniPresentationDeterministic(this.serverPublicParams.getContents(), random, groupSecretParams.getContents(), authCredential.getContents()));
|
|
42
|
+
}
|
|
27
43
|
}
|
|
28
44
|
exports.default = ClientZkAuthOperations;
|
|
29
45
|
//# sourceMappingURL=ClientZkAuthOperations.js.map
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import ServerSecretParams from '../ServerSecretParams';
|
|
3
3
|
import AuthCredentialResponse from './AuthCredentialResponse';
|
|
4
4
|
import AuthCredentialPresentation from './AuthCredentialPresentation';
|
|
5
|
+
import AuthCredentialWithPniResponse from './AuthCredentialWithPniResponse';
|
|
5
6
|
import GroupPublicParams from '../groups/GroupPublicParams';
|
|
6
7
|
import { UUIDType } from '../internal/UUIDUtil';
|
|
7
8
|
export default class ServerZkAuthOperations {
|
|
@@ -9,5 +10,7 @@ export default class ServerZkAuthOperations {
|
|
|
9
10
|
constructor(serverSecretParams: ServerSecretParams);
|
|
10
11
|
issueAuthCredential(uuid: UUIDType, redemptionTime: number): AuthCredentialResponse;
|
|
11
12
|
issueAuthCredentialWithRandom(random: Buffer, uuid: UUIDType, redemptionTime: number): AuthCredentialResponse;
|
|
13
|
+
issueAuthCredentialWithPni(aci: UUIDType, pni: UUIDType, redemptionTime: number): AuthCredentialWithPniResponse;
|
|
14
|
+
issueAuthCredentialWithPniWithRandom(random: Buffer, aci: UUIDType, pni: UUIDType, redemptionTime: number): AuthCredentialWithPniResponse;
|
|
12
15
|
verifyAuthCredentialPresentation(groupPublicParams: GroupPublicParams, authCredentialPresentation: AuthCredentialPresentation): void;
|
|
13
16
|
}
|