@signalapp/libsignal-client 0.16.0 → 0.18.1
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 +31 -8
- 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/index.d.ts +4 -0
- package/dist/zkgroup/index.js +9 -1
- package/dist/zkgroup/profiles/ClientZkProfileOperations.d.ts +20 -0
- package/dist/zkgroup/profiles/ClientZkProfileOperations.js +27 -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 +13 -1
- package/dist/zkgroup/profiles/ServerZkProfileOperations.js +20 -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 {
|
|
@@ -51,10 +54,18 @@ export function Aes256GcmSiv_Decrypt(aesGcmSiv: Wrapper<Aes256GcmSiv>, ctext: Bu
|
|
|
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
56
|
export function AuthCredentialPresentation_CheckValidContents(presentationBytes: Buffer): void;
|
|
54
|
-
export function
|
|
57
|
+
export function AuthCredentialPresentation_GetPniCiphertext(presentationBytes: Buffer): Buffer;
|
|
58
|
+
export function AuthCredentialPresentation_GetRedemptionTime(presentationBytes: Buffer): Timestamp;
|
|
55
59
|
export function AuthCredentialPresentation_GetUuidCiphertext(presentationBytes: Buffer): Serialized<UuidCiphertext>;
|
|
56
60
|
export function AuthCredentialResponse_CheckValidContents(buffer: Buffer): void;
|
|
61
|
+
export function AuthCredentialWithPniResponse_CheckValidContents(buffer: Buffer): void;
|
|
62
|
+
export function AuthCredentialWithPni_CheckValidContents(buffer: Buffer): void;
|
|
57
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,6 +76,9 @@ 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;
|
|
@@ -155,7 +169,7 @@ 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
171
|
export function ReceiptCredentialPresentation_CheckValidContents(buffer: Buffer): void;
|
|
158
|
-
export function ReceiptCredentialPresentation_GetReceiptExpirationTime(presentation: Serialized<ReceiptCredentialPresentation>):
|
|
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
175
|
export function ReceiptCredentialRequestContext_CheckValidContents(buffer: Buffer): void;
|
|
@@ -163,7 +177,7 @@ export function ReceiptCredentialRequestContext_GetRequest(requestContext: Seria
|
|
|
163
177
|
export function ReceiptCredentialRequest_CheckValidContents(buffer: Buffer): void;
|
|
164
178
|
export function ReceiptCredentialResponse_CheckValidContents(buffer: Buffer): void;
|
|
165
179
|
export function ReceiptCredential_CheckValidContents(buffer: Buffer): void;
|
|
166
|
-
export function ReceiptCredential_GetReceiptExpirationTime(receiptCredential: Serialized<ReceiptCredential>):
|
|
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;
|
|
@@ -215,6 +229,8 @@ export function ServerCertificate_GetSignature(obj: Wrapper<ServerCertificate>):
|
|
|
215
229
|
export function ServerCertificate_New(keyId: number, serverKey: Wrapper<PublicKey>, trustRoot: Wrapper<PrivateKey>): ServerCertificate;
|
|
216
230
|
export function ServerPublicParams_CheckValidContents(buffer: Buffer): void;
|
|
217
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;
|
|
218
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
236
|
export function ServerPublicParams_CreateProfileKeyCredentialPresentationDeterministic(serverPublicParams: Serialized<ServerPublicParams>, randomness: Buffer, groupSecretParams: Serialized<GroupSecretParams>, profileKeyCredential: Serialized<ProfileKeyCredential>): Buffer;
|
|
@@ -222,6 +238,8 @@ export function ServerPublicParams_CreateProfileKeyCredentialRequestContextDeter
|
|
|
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>;
|
|
@@ -230,13 +248,15 @@ 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
257
|
export function ServerSecretParams_VerifyAuthCredentialPresentation(serverSecretParams: Serialized<ServerSecretParams>, groupPublicParams: Serialized<GroupPublicParams>, presentationBytes: Buffer): void;
|
|
238
258
|
export function ServerSecretParams_VerifyPniCredentialPresentation(serverSecretParams: Serialized<ServerSecretParams>, groupPublicParams: Serialized<GroupPublicParams>, presentationBytes: Buffer): void;
|
|
239
|
-
export function ServerSecretParams_VerifyProfileKeyCredentialPresentation(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;
|
|
@@ -279,8 +297,13 @@ export function initLogger(maxLevel: LogLevel, callback: (level: LogLevel, targe
|
|
|
279
297
|
interface Aes256GcmSiv { readonly __type: unique symbol; }
|
|
280
298
|
interface AuthCredential { readonly __type: unique symbol; }
|
|
281
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; }
|
|
282
303
|
interface CiphertextMessage { readonly __type: unique symbol; }
|
|
283
304
|
interface DecryptionErrorMessage { readonly __type: unique symbol; }
|
|
305
|
+
interface ExpiringProfileKeyCredential { readonly __type: unique symbol; }
|
|
306
|
+
interface ExpiringProfileKeyCredentialResponse { readonly __type: unique symbol; }
|
|
284
307
|
interface Fingerprint { readonly __type: unique symbol; }
|
|
285
308
|
interface GroupMasterKey { readonly __type: unique symbol; }
|
|
286
309
|
interface GroupPublicParams { 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
|
}
|
|
@@ -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 });
|
|
@@ -8,6 +8,7 @@ const crypto_1 = require("crypto");
|
|
|
8
8
|
const Constants_1 = require("../internal/Constants");
|
|
9
9
|
const Native = require("../../../Native");
|
|
10
10
|
const AuthCredentialResponse_1 = require("./AuthCredentialResponse");
|
|
11
|
+
const AuthCredentialWithPniResponse_1 = require("./AuthCredentialWithPniResponse");
|
|
11
12
|
const UUIDUtil_1 = require("../internal/UUIDUtil");
|
|
12
13
|
class ServerZkAuthOperations {
|
|
13
14
|
constructor(serverSecretParams) {
|
|
@@ -20,6 +21,13 @@ class ServerZkAuthOperations {
|
|
|
20
21
|
issueAuthCredentialWithRandom(random, uuid, redemptionTime) {
|
|
21
22
|
return new AuthCredentialResponse_1.default(Native.ServerSecretParams_IssueAuthCredentialDeterministic(this.serverSecretParams.getContents(), random, (0, UUIDUtil_1.fromUUID)(uuid), redemptionTime));
|
|
22
23
|
}
|
|
24
|
+
issueAuthCredentialWithPni(aci, pni, redemptionTime) {
|
|
25
|
+
const random = (0, crypto_1.randomBytes)(Constants_1.RANDOM_LENGTH);
|
|
26
|
+
return this.issueAuthCredentialWithPniWithRandom(random, aci, pni, redemptionTime);
|
|
27
|
+
}
|
|
28
|
+
issueAuthCredentialWithPniWithRandom(random, aci, pni, redemptionTime) {
|
|
29
|
+
return new AuthCredentialWithPniResponse_1.default(Native.ServerSecretParams_IssueAuthCredentialWithPniDeterministic(this.serverSecretParams.getContents(), random, (0, UUIDUtil_1.fromUUID)(aci), (0, UUIDUtil_1.fromUUID)(pni), redemptionTime));
|
|
30
|
+
}
|
|
23
31
|
verifyAuthCredentialPresentation(groupPublicParams, authCredentialPresentation) {
|
|
24
32
|
Native.ServerSecretParams_VerifyAuthCredentialPresentation(this.serverSecretParams.getContents(), groupPublicParams.getContents(), authCredentialPresentation.getContents());
|
|
25
33
|
}
|
|
@@ -3,6 +3,7 @@ import ByteArray from '../internal/ByteArray';
|
|
|
3
3
|
import GroupMasterKey from './GroupMasterKey';
|
|
4
4
|
import GroupPublicParams from './GroupPublicParams';
|
|
5
5
|
export default class GroupSecretParams extends ByteArray {
|
|
6
|
+
private readonly __type?;
|
|
6
7
|
static generate(): GroupSecretParams;
|
|
7
8
|
static generateWithRandom(random: Buffer): GroupSecretParams;
|
|
8
9
|
static deriveFromMasterKey(groupMasterKey: GroupMasterKey): GroupSecretParams;
|
|
@@ -11,6 +11,9 @@ const Constants_1 = require("../internal/Constants");
|
|
|
11
11
|
const GroupMasterKey_1 = require("./GroupMasterKey");
|
|
12
12
|
const GroupPublicParams_1 = require("./GroupPublicParams");
|
|
13
13
|
class GroupSecretParams extends ByteArray_1.default {
|
|
14
|
+
constructor(contents) {
|
|
15
|
+
super(contents, Native.GroupSecretParams_CheckValidContents);
|
|
16
|
+
}
|
|
14
17
|
static generate() {
|
|
15
18
|
const random = (0, crypto_1.randomBytes)(Constants_1.RANDOM_LENGTH);
|
|
16
19
|
return GroupSecretParams.generateWithRandom(random);
|
|
@@ -21,9 +24,6 @@ class GroupSecretParams extends ByteArray_1.default {
|
|
|
21
24
|
static deriveFromMasterKey(groupMasterKey) {
|
|
22
25
|
return new GroupSecretParams(Native.GroupSecretParams_DeriveFromMasterKey(groupMasterKey.getContents()));
|
|
23
26
|
}
|
|
24
|
-
constructor(contents) {
|
|
25
|
-
super(contents, Native.GroupSecretParams_CheckValidContents);
|
|
26
|
-
}
|
|
27
27
|
getMasterKey() {
|
|
28
28
|
return new GroupMasterKey_1.default(Native.GroupSecretParams_GetMasterKey(this.contents));
|
|
29
29
|
}
|
package/dist/zkgroup/index.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ export { default as ServerZkAuthOperations } from './auth/ServerZkAuthOperations
|
|
|
6
6
|
export { default as AuthCredential } from './auth/AuthCredential';
|
|
7
7
|
export { default as AuthCredentialResponse } from './auth/AuthCredentialResponse';
|
|
8
8
|
export { default as AuthCredentialPresentation } from './auth/AuthCredentialPresentation';
|
|
9
|
+
export { default as AuthCredentialWithPni } from './auth/AuthCredentialWithPni';
|
|
10
|
+
export { default as AuthCredentialWithPniResponse } from './auth/AuthCredentialWithPniResponse';
|
|
9
11
|
export { default as ClientZkGroupCipher } from './groups/ClientZkGroupCipher';
|
|
10
12
|
export { default as GroupIdentifier } from './groups/GroupIdentifier';
|
|
11
13
|
export { default as GroupMasterKey } from './groups/GroupMasterKey';
|
|
@@ -23,6 +25,8 @@ export { default as ProfileKeyCredentialRequest } from './profiles/ProfileKeyCre
|
|
|
23
25
|
export { default as ProfileKeyCredentialRequestContext } from './profiles/ProfileKeyCredentialRequestContext';
|
|
24
26
|
export { default as ProfileKeyCredentialResponse } from './profiles/ProfileKeyCredentialResponse';
|
|
25
27
|
export { default as ProfileKeyVersion } from './profiles/ProfileKeyVersion';
|
|
28
|
+
export { default as ExpiringProfileKeyCredential } from './profiles/ExpiringProfileKeyCredential';
|
|
29
|
+
export { default as ExpiringProfileKeyCredentialResponse } from './profiles/ExpiringProfileKeyCredentialResponse';
|
|
26
30
|
export { default as PniCredential } from './profiles/PniCredential';
|
|
27
31
|
export { default as PniCredentialPresentation } from './profiles/PniCredentialPresentation';
|
|
28
32
|
export { default as PniCredentialRequestContext } from './profiles/PniCredentialRequestContext';
|