@signalapp/libsignal-client 0.17.0 → 0.19.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 +27 -9
- package/dist/index.d.ts +2 -14
- package/dist/index.js +7 -20
- 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 +2 -2
- 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,15 +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;
|
|
58
64
|
export function Cds2ClientState_CompleteHandshake(cli: Wrapper<Cds2ClientState>, handshakeReceived: Buffer): void;
|
|
59
65
|
export function Cds2ClientState_EstablishedRecv(cli: Wrapper<Cds2ClientState>, receivedCiphertext: Buffer): Buffer;
|
|
60
66
|
export function Cds2ClientState_EstablishedSend(cli: Wrapper<Cds2ClientState>, plaintextToSend: Buffer): Buffer;
|
|
61
67
|
export function Cds2ClientState_InitialRequest(obj: Wrapper<Cds2ClientState>): Buffer;
|
|
62
|
-
export function Cds2ClientState_New(mrenclave: Buffer,
|
|
68
|
+
export function Cds2ClientState_New(mrenclave: Buffer, attestationMsg: Buffer, currentTimestamp: Timestamp): Cds2ClientState;
|
|
63
69
|
export function CiphertextMessage_FromPlaintextContent(m: Wrapper<PlaintextContent>): CiphertextMessage;
|
|
64
70
|
export function CiphertextMessage_Serialize(obj: Wrapper<CiphertextMessage>): Buffer;
|
|
65
71
|
export function CiphertextMessage_Type(msg: Wrapper<CiphertextMessage>): number;
|
|
@@ -70,6 +76,9 @@ export function DecryptionErrorMessage_GetDeviceId(obj: Wrapper<DecryptionErrorM
|
|
|
70
76
|
export function DecryptionErrorMessage_GetRatchetKey(m: Wrapper<DecryptionErrorMessage>): PublicKey | null;
|
|
71
77
|
export function DecryptionErrorMessage_GetTimestamp(obj: Wrapper<DecryptionErrorMessage>): Timestamp;
|
|
72
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;
|
|
73
82
|
export function Fingerprint_DisplayString(obj: Wrapper<Fingerprint>): string;
|
|
74
83
|
export function Fingerprint_New(iterations: number, version: number, localIdentifier: Buffer, localKey: Wrapper<PublicKey>, remoteIdentifier: Buffer, remoteKey: Wrapper<PublicKey>): Fingerprint;
|
|
75
84
|
export function Fingerprint_ScannableEncoding(obj: Wrapper<Fingerprint>): Buffer;
|
|
@@ -95,6 +104,7 @@ export function HsmEnclaveClient_EstablishedRecv(cli: Wrapper<HsmEnclaveClient>,
|
|
|
95
104
|
export function HsmEnclaveClient_EstablishedSend(cli: Wrapper<HsmEnclaveClient>, plaintextToSend: Buffer): Buffer;
|
|
96
105
|
export function HsmEnclaveClient_InitialRequest(obj: Wrapper<HsmEnclaveClient>): Buffer;
|
|
97
106
|
export function HsmEnclaveClient_New(trustedPublicKey: Buffer, trustedCodeHashes: Buffer): HsmEnclaveClient;
|
|
107
|
+
export function IdentityKeyPair_Deserialize(buffer: Buffer): {publicKey:PublicKey,privateKey:PrivateKey};
|
|
98
108
|
export function IdentityKeyPair_Serialize(publicKey: Wrapper<PublicKey>, privateKey: Wrapper<PrivateKey>): Buffer;
|
|
99
109
|
export function IdentityKeyPair_SignAlternateIdentity(publicKey: Wrapper<PublicKey>, privateKey: Wrapper<PrivateKey>, otherIdentity: Wrapper<PublicKey>): Buffer;
|
|
100
110
|
export function IdentityKey_VerifyAlternateIdentity(publicKey: Wrapper<PublicKey>, otherIdentity: Wrapper<PublicKey>, signature: Buffer): boolean;
|
|
@@ -160,7 +170,7 @@ export function PublicKey_GetPublicKeyBytes(obj: Wrapper<PublicKey>): Buffer;
|
|
|
160
170
|
export function PublicKey_Serialize(obj: Wrapper<PublicKey>): Buffer;
|
|
161
171
|
export function PublicKey_Verify(key: Wrapper<PublicKey>, message: Buffer, signature: Buffer): boolean;
|
|
162
172
|
export function ReceiptCredentialPresentation_CheckValidContents(buffer: Buffer): void;
|
|
163
|
-
export function ReceiptCredentialPresentation_GetReceiptExpirationTime(presentation: Serialized<ReceiptCredentialPresentation>):
|
|
173
|
+
export function ReceiptCredentialPresentation_GetReceiptExpirationTime(presentation: Serialized<ReceiptCredentialPresentation>): Timestamp;
|
|
164
174
|
export function ReceiptCredentialPresentation_GetReceiptLevel(presentation: Serialized<ReceiptCredentialPresentation>): Buffer;
|
|
165
175
|
export function ReceiptCredentialPresentation_GetReceiptSerial(presentation: Serialized<ReceiptCredentialPresentation>): Buffer;
|
|
166
176
|
export function ReceiptCredentialRequestContext_CheckValidContents(buffer: Buffer): void;
|
|
@@ -168,7 +178,7 @@ export function ReceiptCredentialRequestContext_GetRequest(requestContext: Seria
|
|
|
168
178
|
export function ReceiptCredentialRequest_CheckValidContents(buffer: Buffer): void;
|
|
169
179
|
export function ReceiptCredentialResponse_CheckValidContents(buffer: Buffer): void;
|
|
170
180
|
export function ReceiptCredential_CheckValidContents(buffer: Buffer): void;
|
|
171
|
-
export function ReceiptCredential_GetReceiptExpirationTime(receiptCredential: Serialized<ReceiptCredential>):
|
|
181
|
+
export function ReceiptCredential_GetReceiptExpirationTime(receiptCredential: Serialized<ReceiptCredential>): Timestamp;
|
|
172
182
|
export function ReceiptCredential_GetReceiptLevel(receiptCredential: Serialized<ReceiptCredential>): Buffer;
|
|
173
183
|
export function ScannableFingerprint_Compare(fprint1: Buffer, fprint2: Buffer): boolean;
|
|
174
184
|
export function SealedSenderDecryptionResult_GetDeviceId(obj: Wrapper<SealedSenderDecryptionResult>): number;
|
|
@@ -220,6 +230,8 @@ export function ServerCertificate_GetSignature(obj: Wrapper<ServerCertificate>):
|
|
|
220
230
|
export function ServerCertificate_New(keyId: number, serverKey: Wrapper<PublicKey>, trustRoot: Wrapper<PrivateKey>): ServerCertificate;
|
|
221
231
|
export function ServerPublicParams_CheckValidContents(buffer: Buffer): void;
|
|
222
232
|
export function ServerPublicParams_CreateAuthCredentialPresentationDeterministic(serverPublicParams: Serialized<ServerPublicParams>, randomness: Buffer, groupSecretParams: Serialized<GroupSecretParams>, authCredential: Serialized<AuthCredential>): Buffer;
|
|
233
|
+
export function ServerPublicParams_CreateAuthCredentialWithPniPresentationDeterministic(serverPublicParams: Serialized<ServerPublicParams>, randomness: Buffer, groupSecretParams: Serialized<GroupSecretParams>, authCredential: Serialized<AuthCredentialWithPni>): Buffer;
|
|
234
|
+
export function ServerPublicParams_CreateExpiringProfileKeyCredentialPresentationDeterministic(serverPublicParams: Serialized<ServerPublicParams>, randomness: Buffer, groupSecretParams: Serialized<GroupSecretParams>, profileKeyCredential: Serialized<ExpiringProfileKeyCredential>): Buffer;
|
|
223
235
|
export function ServerPublicParams_CreatePniCredentialPresentationDeterministic(serverPublicParams: Serialized<ServerPublicParams>, randomness: Buffer, groupSecretParams: Serialized<GroupSecretParams>, pniCredential: Serialized<PniCredential>): Buffer;
|
|
224
236
|
export function ServerPublicParams_CreatePniCredentialRequestContextDeterministic(serverPublicParams: Serialized<ServerPublicParams>, randomness: Buffer, aci: Uuid, pni: Uuid, profileKey: Serialized<ProfileKey>): Serialized<PniCredentialRequestContext>;
|
|
225
237
|
export function ServerPublicParams_CreateProfileKeyCredentialPresentationDeterministic(serverPublicParams: Serialized<ServerPublicParams>, randomness: Buffer, groupSecretParams: Serialized<GroupSecretParams>, profileKeyCredential: Serialized<ProfileKeyCredential>): Buffer;
|
|
@@ -227,6 +239,8 @@ export function ServerPublicParams_CreateProfileKeyCredentialRequestContextDeter
|
|
|
227
239
|
export function ServerPublicParams_CreateReceiptCredentialPresentationDeterministic(serverPublicParams: Serialized<ServerPublicParams>, randomness: Buffer, receiptCredential: Serialized<ReceiptCredential>): Serialized<ReceiptCredentialPresentation>;
|
|
228
240
|
export function ServerPublicParams_CreateReceiptCredentialRequestContextDeterministic(serverPublicParams: Serialized<ServerPublicParams>, randomness: Buffer, receiptSerial: Buffer): Serialized<ReceiptCredentialRequestContext>;
|
|
229
241
|
export function ServerPublicParams_ReceiveAuthCredential(params: Serialized<ServerPublicParams>, uuid: Uuid, redemptionTime: number, response: Serialized<AuthCredentialResponse>): Serialized<AuthCredential>;
|
|
242
|
+
export function ServerPublicParams_ReceiveAuthCredentialWithPni(params: Serialized<ServerPublicParams>, aci: Uuid, pni: Uuid, redemptionTime: Timestamp, response: Serialized<AuthCredentialWithPniResponse>): Serialized<AuthCredentialWithPni>;
|
|
243
|
+
export function ServerPublicParams_ReceiveExpiringProfileKeyCredential(serverPublicParams: Serialized<ServerPublicParams>, requestContext: Serialized<ProfileKeyCredentialRequestContext>, response: Serialized<ExpiringProfileKeyCredentialResponse>, currentTimeInSeconds: Timestamp): Serialized<ExpiringProfileKeyCredential>;
|
|
230
244
|
export function ServerPublicParams_ReceivePniCredential(serverPublicParams: Serialized<ServerPublicParams>, requestContext: Serialized<PniCredentialRequestContext>, response: Serialized<PniCredentialResponse>): Serialized<PniCredential>;
|
|
231
245
|
export function ServerPublicParams_ReceiveProfileKeyCredential(serverPublicParams: Serialized<ServerPublicParams>, requestContext: Serialized<ProfileKeyCredentialRequestContext>, response: Serialized<ProfileKeyCredentialResponse>): Serialized<ProfileKeyCredential>;
|
|
232
246
|
export function ServerPublicParams_ReceiveReceiptCredential(serverPublicParams: Serialized<ServerPublicParams>, requestContext: Serialized<ReceiptCredentialRequestContext>, response: Serialized<ReceiptCredentialResponse>): Serialized<ReceiptCredential>;
|
|
@@ -235,13 +249,15 @@ export function ServerSecretParams_CheckValidContents(buffer: Buffer): void;
|
|
|
235
249
|
export function ServerSecretParams_GenerateDeterministic(randomness: Buffer): Serialized<ServerSecretParams>;
|
|
236
250
|
export function ServerSecretParams_GetPublicParams(params: Serialized<ServerSecretParams>): Serialized<ServerPublicParams>;
|
|
237
251
|
export function ServerSecretParams_IssueAuthCredentialDeterministic(serverSecretParams: Serialized<ServerSecretParams>, randomness: Buffer, uuid: Uuid, redemptionTime: number): Serialized<AuthCredentialResponse>;
|
|
252
|
+
export function ServerSecretParams_IssueAuthCredentialWithPniDeterministic(serverSecretParams: Serialized<ServerSecretParams>, randomness: Buffer, aci: Uuid, pni: Uuid, redemptionTime: Timestamp): Serialized<AuthCredentialWithPniResponse>;
|
|
253
|
+
export function ServerSecretParams_IssueExpiringProfileKeyCredentialDeterministic(serverSecretParams: Serialized<ServerSecretParams>, randomness: Buffer, request: Serialized<ProfileKeyCredentialRequest>, uuid: Uuid, commitment: Serialized<ProfileKeyCommitment>, expirationInSeconds: Timestamp): Serialized<ExpiringProfileKeyCredentialResponse>;
|
|
238
254
|
export function ServerSecretParams_IssuePniCredentialDeterministic(serverSecretParams: Serialized<ServerSecretParams>, randomness: Buffer, request: Serialized<ProfileKeyCredentialRequest>, aci: Uuid, pni: Uuid, commitment: Serialized<ProfileKeyCommitment>): Serialized<PniCredentialResponse>;
|
|
239
255
|
export function ServerSecretParams_IssueProfileKeyCredentialDeterministic(serverSecretParams: Serialized<ServerSecretParams>, randomness: Buffer, request: Serialized<ProfileKeyCredentialRequest>, uuid: Uuid, commitment: Serialized<ProfileKeyCommitment>): Serialized<ProfileKeyCredentialResponse>;
|
|
240
|
-
export function ServerSecretParams_IssueReceiptCredentialDeterministic(serverSecretParams: Serialized<ServerSecretParams>, randomness: Buffer, request: Serialized<ReceiptCredentialRequest>, receiptExpirationTime:
|
|
256
|
+
export function ServerSecretParams_IssueReceiptCredentialDeterministic(serverSecretParams: Serialized<ServerSecretParams>, randomness: Buffer, request: Serialized<ReceiptCredentialRequest>, receiptExpirationTime: Timestamp, receiptLevel: Buffer): Serialized<ReceiptCredentialResponse>;
|
|
241
257
|
export function ServerSecretParams_SignDeterministic(params: Serialized<ServerSecretParams>, randomness: Buffer, message: Buffer): Buffer;
|
|
242
258
|
export function ServerSecretParams_VerifyAuthCredentialPresentation(serverSecretParams: Serialized<ServerSecretParams>, groupPublicParams: Serialized<GroupPublicParams>, presentationBytes: Buffer): void;
|
|
243
259
|
export function ServerSecretParams_VerifyPniCredentialPresentation(serverSecretParams: Serialized<ServerSecretParams>, groupPublicParams: Serialized<GroupPublicParams>, presentationBytes: Buffer): void;
|
|
244
|
-
export function ServerSecretParams_VerifyProfileKeyCredentialPresentation(serverSecretParams: Serialized<ServerSecretParams>, groupPublicParams: Serialized<GroupPublicParams>, presentationBytes: Buffer): void;
|
|
260
|
+
export function ServerSecretParams_VerifyProfileKeyCredentialPresentation(serverSecretParams: Serialized<ServerSecretParams>, groupPublicParams: Serialized<GroupPublicParams>, presentationBytes: Buffer, currentTimeInSeconds: Timestamp): void;
|
|
245
261
|
export function ServerSecretParams_VerifyReceiptCredentialPresentation(serverSecretParams: Serialized<ServerSecretParams>, presentation: Serialized<ReceiptCredentialPresentation>): void;
|
|
246
262
|
export function SessionBuilder_ProcessPreKeyBundle(bundle: Wrapper<PreKeyBundle>, protocolAddress: Wrapper<ProtocolAddress>, sessionStore: SessionStore, identityKeyStore: IdentityKeyStore, ctx: null): Promise<void>;
|
|
247
263
|
export function SessionCipher_DecryptPreKeySignalMessage(message: Wrapper<PreKeySignalMessage>, protocolAddress: Wrapper<ProtocolAddress>, sessionStore: SessionStore, identityKeyStore: IdentityKeyStore, prekeyStore: PreKeyStore, signedPrekeyStore: SignedPreKeyStore, ctx: null): Promise<Buffer>;
|
|
@@ -253,9 +269,7 @@ export function SessionRecord_Deserialize(data: Buffer): SessionRecord;
|
|
|
253
269
|
export function SessionRecord_GetLocalRegistrationId(obj: Wrapper<SessionRecord>): number;
|
|
254
270
|
export function SessionRecord_GetRemoteRegistrationId(obj: Wrapper<SessionRecord>): number;
|
|
255
271
|
export function SessionRecord_HasCurrentState(obj: Wrapper<SessionRecord>): boolean;
|
|
256
|
-
export function SessionRecord_NeedsPniSignature(obj: Wrapper<SessionRecord>): boolean;
|
|
257
272
|
export function SessionRecord_Serialize(obj: Wrapper<SessionRecord>): Buffer;
|
|
258
|
-
export function SessionRecord_SetNeedsPniSignature(s: Wrapper<SessionRecord>, needsPniSignature: boolean): void;
|
|
259
273
|
export function SignalMessage_Deserialize(data: Buffer): SignalMessage;
|
|
260
274
|
export function SignalMessage_GetBody(obj: Wrapper<SignalMessage>): Buffer;
|
|
261
275
|
export function SignalMessage_GetCounter(obj: Wrapper<SignalMessage>): number;
|
|
@@ -284,9 +298,13 @@ export function initLogger(maxLevel: LogLevel, callback: (level: LogLevel, targe
|
|
|
284
298
|
interface Aes256GcmSiv { readonly __type: unique symbol; }
|
|
285
299
|
interface AuthCredential { readonly __type: unique symbol; }
|
|
286
300
|
interface AuthCredentialResponse { readonly __type: unique symbol; }
|
|
301
|
+
interface AuthCredentialWithPni { readonly __type: unique symbol; }
|
|
302
|
+
interface AuthCredentialWithPniResponse { readonly __type: unique symbol; }
|
|
287
303
|
interface Cds2ClientState { readonly __type: unique symbol; }
|
|
288
304
|
interface CiphertextMessage { readonly __type: unique symbol; }
|
|
289
305
|
interface DecryptionErrorMessage { readonly __type: unique symbol; }
|
|
306
|
+
interface ExpiringProfileKeyCredential { readonly __type: unique symbol; }
|
|
307
|
+
interface ExpiringProfileKeyCredentialResponse { readonly __type: unique symbol; }
|
|
290
308
|
interface Fingerprint { readonly __type: unique symbol; }
|
|
291
309
|
interface GroupMasterKey { readonly __type: unique symbol; }
|
|
292
310
|
interface GroupPublicParams { readonly __type: unique symbol; }
|
package/dist/index.d.ts
CHANGED
|
@@ -81,6 +81,7 @@ export declare class IdentityKeyPair {
|
|
|
81
81
|
readonly privateKey: PrivateKey;
|
|
82
82
|
constructor(publicKey: PublicKey, privateKey: PrivateKey);
|
|
83
83
|
static generate(): IdentityKeyPair;
|
|
84
|
+
static deserialize(buffer: Buffer): IdentityKeyPair;
|
|
84
85
|
serialize(): Buffer;
|
|
85
86
|
signAlternateIdentity(other: PublicKey): Buffer;
|
|
86
87
|
}
|
|
@@ -153,19 +154,6 @@ export declare class SessionRecord {
|
|
|
153
154
|
localRegistrationId(): number;
|
|
154
155
|
remoteRegistrationId(): number;
|
|
155
156
|
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
157
|
currentRatchetKeyMatches(key: PublicKey): boolean;
|
|
170
158
|
}
|
|
171
159
|
export declare class ServerCertificate {
|
|
@@ -337,7 +325,7 @@ export declare function sealedSenderDecryptToUsmc(message: Buffer, identityStore
|
|
|
337
325
|
export declare class Cds2Client {
|
|
338
326
|
readonly _nativeHandle: Native.Cds2ClientState;
|
|
339
327
|
private constructor();
|
|
340
|
-
static
|
|
328
|
+
static new(mrenclave: Buffer, attestationMsg: Buffer, currentTimestamp: Date): Cds2Client;
|
|
341
329
|
initialRequest(): Buffer;
|
|
342
330
|
completeHandshake(buffer: Buffer): void;
|
|
343
331
|
establishedSend(buffer: Buffer): Buffer;
|
package/dist/index.js
CHANGED
|
@@ -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
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
@@ -195,6 +195,10 @@ class IdentityKeyPair {
|
|
|
195
195
|
const privateKey = PrivateKey.generate();
|
|
196
196
|
return new IdentityKeyPair(privateKey.getPublicKey(), privateKey);
|
|
197
197
|
}
|
|
198
|
+
static deserialize(buffer) {
|
|
199
|
+
const { privateKey, publicKey } = Native.IdentityKeyPair_Deserialize(buffer);
|
|
200
|
+
return new IdentityKeyPair(PublicKey._fromNativeHandle(publicKey), PrivateKey._fromNativeHandle(privateKey));
|
|
201
|
+
}
|
|
198
202
|
serialize() {
|
|
199
203
|
return Native.IdentityKeyPair_Serialize(this.publicKey, this.privateKey);
|
|
200
204
|
}
|
|
@@ -383,23 +387,6 @@ class SessionRecord {
|
|
|
383
387
|
hasCurrentState() {
|
|
384
388
|
return Native.SessionRecord_HasCurrentState(this);
|
|
385
389
|
}
|
|
386
|
-
/**
|
|
387
|
-
* Returns true if this session was marked as needing a PNI signature and has not received a
|
|
388
|
-
* reply.
|
|
389
|
-
*
|
|
390
|
-
* Precondition: `this.hasCurrentState()`
|
|
391
|
-
*/
|
|
392
|
-
needsPniSignature() {
|
|
393
|
-
return Native.SessionRecord_NeedsPniSignature(this);
|
|
394
|
-
}
|
|
395
|
-
/**
|
|
396
|
-
* Marks whether this session needs a PNI signature included in outgoing messages.
|
|
397
|
-
*
|
|
398
|
-
* Precondition: `this.hasCurrentState()`
|
|
399
|
-
*/
|
|
400
|
-
setNeedsPniSignature(needsPniSignature) {
|
|
401
|
-
Native.SessionRecord_SetNeedsPniSignature(this, needsPniSignature);
|
|
402
|
-
}
|
|
403
390
|
currentRatchetKeyMatches(key) {
|
|
404
391
|
return Native.SessionRecord_CurrentRatchetKeyMatches(this, key);
|
|
405
392
|
}
|
|
@@ -872,8 +859,8 @@ class Cds2Client {
|
|
|
872
859
|
constructor(nativeHandle) {
|
|
873
860
|
this._nativeHandle = nativeHandle;
|
|
874
861
|
}
|
|
875
|
-
static
|
|
876
|
-
return new Cds2Client(Native.Cds2ClientState_New(mrenclave,
|
|
862
|
+
static new(mrenclave, attestationMsg, currentTimestamp) {
|
|
863
|
+
return new Cds2Client(Native.Cds2ClientState_New(mrenclave, attestationMsg, currentTimestamp.getTime()));
|
|
877
864
|
}
|
|
878
865
|
initialRequest() {
|
|
879
866
|
return Native.Cds2ClientState_InitialRequest(this);
|
|
@@ -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';
|
package/dist/zkgroup/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
5
5
|
//
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.ReceiptSerial = exports.ReceiptCredentialResponse = exports.ReceiptCredentialRequestContext = exports.ReceiptCredentialRequest = exports.ReceiptCredentialPresentation = exports.ReceiptCredential = exports.ServerZkReceiptOperations = exports.ClientZkReceiptOperations = exports.PniCredentialResponse = exports.PniCredentialRequestContext = exports.PniCredentialPresentation = exports.PniCredential = exports.ProfileKeyVersion = exports.ProfileKeyCredentialResponse = exports.ProfileKeyCredentialRequestContext = exports.ProfileKeyCredentialRequest = exports.ProfileKeyCredentialPresentation = exports.ProfileKeyCredential = exports.ProfileKeyCommitment = exports.ProfileKey = exports.ServerZkProfileOperations = exports.ClientZkProfileOperations = exports.UuidCiphertext = exports.ProfileKeyCiphertext = exports.GroupSecretParams = exports.GroupPublicParams = exports.GroupMasterKey = exports.GroupIdentifier = exports.ClientZkGroupCipher = exports.AuthCredentialPresentation = exports.AuthCredentialResponse = exports.AuthCredential = exports.ServerZkAuthOperations = exports.ClientZkAuthOperations = exports.NotarySignature = exports.ServerSecretParams = exports.ServerPublicParams = void 0;
|
|
7
|
+
exports.ReceiptSerial = exports.ReceiptCredentialResponse = exports.ReceiptCredentialRequestContext = exports.ReceiptCredentialRequest = exports.ReceiptCredentialPresentation = exports.ReceiptCredential = exports.ServerZkReceiptOperations = exports.ClientZkReceiptOperations = exports.PniCredentialResponse = exports.PniCredentialRequestContext = exports.PniCredentialPresentation = exports.PniCredential = exports.ExpiringProfileKeyCredentialResponse = exports.ExpiringProfileKeyCredential = exports.ProfileKeyVersion = exports.ProfileKeyCredentialResponse = exports.ProfileKeyCredentialRequestContext = exports.ProfileKeyCredentialRequest = exports.ProfileKeyCredentialPresentation = exports.ProfileKeyCredential = exports.ProfileKeyCommitment = exports.ProfileKey = exports.ServerZkProfileOperations = exports.ClientZkProfileOperations = exports.UuidCiphertext = exports.ProfileKeyCiphertext = exports.GroupSecretParams = exports.GroupPublicParams = exports.GroupMasterKey = exports.GroupIdentifier = exports.ClientZkGroupCipher = exports.AuthCredentialWithPniResponse = exports.AuthCredentialWithPni = exports.AuthCredentialPresentation = exports.AuthCredentialResponse = exports.AuthCredential = exports.ServerZkAuthOperations = exports.ClientZkAuthOperations = exports.NotarySignature = exports.ServerSecretParams = exports.ServerPublicParams = void 0;
|
|
8
8
|
// Root
|
|
9
9
|
var ServerPublicParams_1 = require("./ServerPublicParams");
|
|
10
10
|
Object.defineProperty(exports, "ServerPublicParams", { enumerable: true, get: function () { return ServerPublicParams_1.default; } });
|
|
@@ -23,6 +23,10 @@ var AuthCredentialResponse_1 = require("./auth/AuthCredentialResponse");
|
|
|
23
23
|
Object.defineProperty(exports, "AuthCredentialResponse", { enumerable: true, get: function () { return AuthCredentialResponse_1.default; } });
|
|
24
24
|
var AuthCredentialPresentation_1 = require("./auth/AuthCredentialPresentation");
|
|
25
25
|
Object.defineProperty(exports, "AuthCredentialPresentation", { enumerable: true, get: function () { return AuthCredentialPresentation_1.default; } });
|
|
26
|
+
var AuthCredentialWithPni_1 = require("./auth/AuthCredentialWithPni");
|
|
27
|
+
Object.defineProperty(exports, "AuthCredentialWithPni", { enumerable: true, get: function () { return AuthCredentialWithPni_1.default; } });
|
|
28
|
+
var AuthCredentialWithPniResponse_1 = require("./auth/AuthCredentialWithPniResponse");
|
|
29
|
+
Object.defineProperty(exports, "AuthCredentialWithPniResponse", { enumerable: true, get: function () { return AuthCredentialWithPniResponse_1.default; } });
|
|
26
30
|
// Groups
|
|
27
31
|
var ClientZkGroupCipher_1 = require("./groups/ClientZkGroupCipher");
|
|
28
32
|
Object.defineProperty(exports, "ClientZkGroupCipher", { enumerable: true, get: function () { return ClientZkGroupCipher_1.default; } });
|
|
@@ -59,6 +63,10 @@ var ProfileKeyCredentialResponse_1 = require("./profiles/ProfileKeyCredentialRes
|
|
|
59
63
|
Object.defineProperty(exports, "ProfileKeyCredentialResponse", { enumerable: true, get: function () { return ProfileKeyCredentialResponse_1.default; } });
|
|
60
64
|
var ProfileKeyVersion_1 = require("./profiles/ProfileKeyVersion");
|
|
61
65
|
Object.defineProperty(exports, "ProfileKeyVersion", { enumerable: true, get: function () { return ProfileKeyVersion_1.default; } });
|
|
66
|
+
var ExpiringProfileKeyCredential_1 = require("./profiles/ExpiringProfileKeyCredential");
|
|
67
|
+
Object.defineProperty(exports, "ExpiringProfileKeyCredential", { enumerable: true, get: function () { return ExpiringProfileKeyCredential_1.default; } });
|
|
68
|
+
var ExpiringProfileKeyCredentialResponse_1 = require("./profiles/ExpiringProfileKeyCredentialResponse");
|
|
69
|
+
Object.defineProperty(exports, "ExpiringProfileKeyCredentialResponse", { enumerable: true, get: function () { return ExpiringProfileKeyCredentialResponse_1.default; } });
|
|
62
70
|
var PniCredential_1 = require("./profiles/PniCredential");
|
|
63
71
|
Object.defineProperty(exports, "PniCredential", { enumerable: true, get: function () { return PniCredential_1.default; } });
|
|
64
72
|
var PniCredentialPresentation_1 = require("./profiles/PniCredentialPresentation");
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import ServerPublicParams from '../ServerPublicParams';
|
|
3
3
|
import GroupSecretParams from '../groups/GroupSecretParams';
|
|
4
|
+
import ExpiringProfileKeyCredential from './ExpiringProfileKeyCredential';
|
|
5
|
+
import ExpiringProfileKeyCredentialResponse from './ExpiringProfileKeyCredentialResponse';
|
|
4
6
|
import PniCredential from './PniCredential';
|
|
5
7
|
import PniCredentialPresentation from './PniCredentialPresentation';
|
|
6
8
|
import PniCredentialRequestContext from './PniCredentialRequestContext';
|
|
@@ -16,12 +18,30 @@ export default class ClientZkProfileOperations {
|
|
|
16
18
|
constructor(serverPublicParams: ServerPublicParams);
|
|
17
19
|
createProfileKeyCredentialRequestContext(uuid: UUIDType, profileKey: ProfileKey): ProfileKeyCredentialRequestContext;
|
|
18
20
|
createProfileKeyCredentialRequestContextWithRandom(random: Buffer, uuid: UUIDType, profileKey: ProfileKey): ProfileKeyCredentialRequestContext;
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated Superseded by AuthCredentialWithPni + ProfileKeyCredential
|
|
23
|
+
*/
|
|
19
24
|
createPniCredentialRequestContext(aci: UUIDType, pni: UUIDType, profileKey: ProfileKey): PniCredentialRequestContext;
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated Superseded by AuthCredentialWithPni + ProfileKeyCredential
|
|
27
|
+
*/
|
|
20
28
|
createPniCredentialRequestContextWithRandom(random: Buffer, aci: UUIDType, pni: UUIDType, profileKey: ProfileKey): PniCredentialRequestContext;
|
|
21
29
|
receiveProfileKeyCredential(profileKeyCredentialRequestContext: ProfileKeyCredentialRequestContext, profileKeyCredentialResponse: ProfileKeyCredentialResponse): ProfileKeyCredential;
|
|
30
|
+
receiveExpiringProfileKeyCredential(profileKeyCredentialRequestContext: ProfileKeyCredentialRequestContext, profileKeyCredentialResponse: ExpiringProfileKeyCredentialResponse, now?: Date): ExpiringProfileKeyCredential;
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated Superseded by AuthCredentialWithPni + ProfileKeyCredential
|
|
33
|
+
*/
|
|
22
34
|
receivePniCredential(requestContext: PniCredentialRequestContext, response: PniCredentialResponse): PniCredential;
|
|
23
35
|
createProfileKeyCredentialPresentation(groupSecretParams: GroupSecretParams, profileKeyCredential: ProfileKeyCredential): ProfileKeyCredentialPresentation;
|
|
24
36
|
createProfileKeyCredentialPresentationWithRandom(random: Buffer, groupSecretParams: GroupSecretParams, profileKeyCredential: ProfileKeyCredential): ProfileKeyCredentialPresentation;
|
|
37
|
+
createExpiringProfileKeyCredentialPresentation(groupSecretParams: GroupSecretParams, profileKeyCredential: ExpiringProfileKeyCredential): ProfileKeyCredentialPresentation;
|
|
38
|
+
createExpiringProfileKeyCredentialPresentationWithRandom(random: Buffer, groupSecretParams: GroupSecretParams, profileKeyCredential: ExpiringProfileKeyCredential): ProfileKeyCredentialPresentation;
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated Superseded by AuthCredentialWithPni + ProfileKeyCredential
|
|
41
|
+
*/
|
|
25
42
|
createPniCredentialPresentation(groupSecretParams: GroupSecretParams, credential: PniCredential): PniCredentialPresentation;
|
|
43
|
+
/**
|
|
44
|
+
* @deprecated Superseded by AuthCredentialWithPni + ProfileKeyCredential
|
|
45
|
+
*/
|
|
26
46
|
createPniCredentialPresentationWithRandom(random: Buffer, groupSecretParams: GroupSecretParams, credential: PniCredential): PniCredentialPresentation;
|
|
27
47
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
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 });
|
|
7
7
|
const crypto_1 = require("crypto");
|
|
8
8
|
const Constants_1 = require("../internal/Constants");
|
|
9
9
|
const Native = require("../../../Native");
|
|
10
|
+
const ExpiringProfileKeyCredential_1 = require("./ExpiringProfileKeyCredential");
|
|
10
11
|
const PniCredential_1 = require("./PniCredential");
|
|
11
12
|
const PniCredentialPresentation_1 = require("./PniCredentialPresentation");
|
|
12
13
|
const PniCredentialRequestContext_1 = require("./PniCredentialRequestContext");
|
|
@@ -25,16 +26,28 @@ class ClientZkProfileOperations {
|
|
|
25
26
|
createProfileKeyCredentialRequestContextWithRandom(random, uuid, profileKey) {
|
|
26
27
|
return new ProfileKeyCredentialRequestContext_1.default(Native.ServerPublicParams_CreateProfileKeyCredentialRequestContextDeterministic(this.serverPublicParams.getContents(), random, (0, UUIDUtil_1.fromUUID)(uuid), profileKey.getContents()));
|
|
27
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated Superseded by AuthCredentialWithPni + ProfileKeyCredential
|
|
31
|
+
*/
|
|
28
32
|
createPniCredentialRequestContext(aci, pni, profileKey) {
|
|
29
33
|
const random = (0, crypto_1.randomBytes)(Constants_1.RANDOM_LENGTH);
|
|
30
34
|
return this.createPniCredentialRequestContextWithRandom(random, aci, pni, profileKey);
|
|
31
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated Superseded by AuthCredentialWithPni + ProfileKeyCredential
|
|
38
|
+
*/
|
|
32
39
|
createPniCredentialRequestContextWithRandom(random, aci, pni, profileKey) {
|
|
33
40
|
return new PniCredentialRequestContext_1.default(Native.ServerPublicParams_CreatePniCredentialRequestContextDeterministic(this.serverPublicParams.getContents(), random, (0, UUIDUtil_1.fromUUID)(aci), (0, UUIDUtil_1.fromUUID)(pni), profileKey.getContents()));
|
|
34
41
|
}
|
|
35
42
|
receiveProfileKeyCredential(profileKeyCredentialRequestContext, profileKeyCredentialResponse) {
|
|
36
43
|
return new ProfileKeyCredential_1.default(Native.ServerPublicParams_ReceiveProfileKeyCredential(this.serverPublicParams.getContents(), profileKeyCredentialRequestContext.getContents(), profileKeyCredentialResponse.getContents()));
|
|
37
44
|
}
|
|
45
|
+
receiveExpiringProfileKeyCredential(profileKeyCredentialRequestContext, profileKeyCredentialResponse, now = new Date()) {
|
|
46
|
+
return new ExpiringProfileKeyCredential_1.default(Native.ServerPublicParams_ReceiveExpiringProfileKeyCredential(this.serverPublicParams.getContents(), profileKeyCredentialRequestContext.getContents(), profileKeyCredentialResponse.getContents(), Math.floor(now.getTime() / 1000)));
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* @deprecated Superseded by AuthCredentialWithPni + ProfileKeyCredential
|
|
50
|
+
*/
|
|
38
51
|
receivePniCredential(requestContext, response) {
|
|
39
52
|
return new PniCredential_1.default(Native.ServerPublicParams_ReceivePniCredential(this.serverPublicParams.getContents(), requestContext.getContents(), response.getContents()));
|
|
40
53
|
}
|
|
@@ -45,10 +58,23 @@ class ClientZkProfileOperations {
|
|
|
45
58
|
createProfileKeyCredentialPresentationWithRandom(random, groupSecretParams, profileKeyCredential) {
|
|
46
59
|
return new ProfileKeyCredentialPresentation_1.default(Native.ServerPublicParams_CreateProfileKeyCredentialPresentationDeterministic(this.serverPublicParams.getContents(), random, groupSecretParams.getContents(), profileKeyCredential.getContents()));
|
|
47
60
|
}
|
|
61
|
+
createExpiringProfileKeyCredentialPresentation(groupSecretParams, profileKeyCredential) {
|
|
62
|
+
const random = (0, crypto_1.randomBytes)(Constants_1.RANDOM_LENGTH);
|
|
63
|
+
return this.createExpiringProfileKeyCredentialPresentationWithRandom(random, groupSecretParams, profileKeyCredential);
|
|
64
|
+
}
|
|
65
|
+
createExpiringProfileKeyCredentialPresentationWithRandom(random, groupSecretParams, profileKeyCredential) {
|
|
66
|
+
return new ProfileKeyCredentialPresentation_1.default(Native.ServerPublicParams_CreateExpiringProfileKeyCredentialPresentationDeterministic(this.serverPublicParams.getContents(), random, groupSecretParams.getContents(), profileKeyCredential.getContents()));
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* @deprecated Superseded by AuthCredentialWithPni + ProfileKeyCredential
|
|
70
|
+
*/
|
|
48
71
|
createPniCredentialPresentation(groupSecretParams, credential) {
|
|
49
72
|
const random = (0, crypto_1.randomBytes)(Constants_1.RANDOM_LENGTH);
|
|
50
73
|
return this.createPniCredentialPresentationWithRandom(random, groupSecretParams, credential);
|
|
51
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* @deprecated Superseded by AuthCredentialWithPni + ProfileKeyCredential
|
|
77
|
+
*/
|
|
52
78
|
createPniCredentialPresentationWithRandom(random, groupSecretParams, credential) {
|
|
53
79
|
return new PniCredentialPresentation_1.default(Native.ServerPublicParams_CreatePniCredentialPresentationDeterministic(this.serverPublicParams.getContents(), random, groupSecretParams.getContents(), credential.getContents()));
|
|
54
80
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
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 ExpiringProfileKeyCredential extends ByteArray_1.default {
|
|
10
|
+
constructor(contents) {
|
|
11
|
+
super(contents, Native.ExpiringProfileKeyCredential_CheckValidContents);
|
|
12
|
+
}
|
|
13
|
+
getExpirationTime() {
|
|
14
|
+
return new Date(1000 *
|
|
15
|
+
Native.ExpiringProfileKeyCredential_GetExpirationTime(this.contents));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.default = ExpiringProfileKeyCredential;
|
|
19
|
+
//# sourceMappingURL=ExpiringProfileKeyCredential.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 ExpiringProfileKeyCredentialResponse extends ByteArray_1.default {
|
|
10
|
+
constructor(contents) {
|
|
11
|
+
super(contents, Native.ExpiringProfileKeyCredentialResponse_CheckValidContents);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.default = ExpiringProfileKeyCredentialResponse;
|
|
15
|
+
//# sourceMappingURL=ExpiringProfileKeyCredentialResponse.js.map
|
|
@@ -3,6 +3,7 @@ import ByteArray from '../internal/ByteArray';
|
|
|
3
3
|
import UuidCiphertext from '../groups/UuidCiphertext';
|
|
4
4
|
import ProfileKeyCiphertext from '../groups/ProfileKeyCiphertext';
|
|
5
5
|
export default class PniCredentialPresentation extends ByteArray {
|
|
6
|
+
private readonly __type?;
|
|
6
7
|
constructor(contents: Buffer);
|
|
7
8
|
getAciCiphertext(): UuidCiphertext;
|
|
8
9
|
getPniCiphertext(): UuidCiphertext;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import ByteArray from '../internal/ByteArray';
|
|
3
3
|
import ProfileKeyCredentialRequest from './ProfileKeyCredentialRequest';
|
|
4
4
|
export default class PniCredentialRequestContext extends ByteArray {
|
|
5
|
+
private readonly __type?;
|
|
5
6
|
constructor(contents: Buffer);
|
|
6
7
|
getRequest(): ProfileKeyCredentialRequest;
|
|
7
8
|
}
|
|
@@ -4,6 +4,7 @@ import ProfileKeyCommitment from './ProfileKeyCommitment';
|
|
|
4
4
|
import ProfileKeyVersion from './ProfileKeyVersion';
|
|
5
5
|
import { UUIDType } from '../internal/UUIDUtil';
|
|
6
6
|
export default class ProfileKey extends ByteArray {
|
|
7
|
+
private readonly __type?;
|
|
7
8
|
static SIZE: number;
|
|
8
9
|
constructor(contents: Buffer);
|
|
9
10
|
getCommitment(uuid: UUIDType): ProfileKeyCommitment;
|
|
@@ -3,6 +3,7 @@ import ByteArray from '../internal/ByteArray';
|
|
|
3
3
|
import UuidCiphertext from '../groups/UuidCiphertext';
|
|
4
4
|
import ProfileKeyCiphertext from '../groups/ProfileKeyCiphertext';
|
|
5
5
|
export default class ProfileKeyCredentialPresentation extends ByteArray {
|
|
6
|
+
private readonly __type?;
|
|
6
7
|
constructor(contents: Buffer);
|
|
7
8
|
getUuidCiphertext(): UuidCiphertext;
|
|
8
9
|
getProfileKeyCiphertext(): ProfileKeyCiphertext;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import ByteArray from '../internal/ByteArray';
|
|
3
3
|
import ProfileKeyCredentialRequest from './ProfileKeyCredentialRequest';
|
|
4
4
|
export default class ProfileKeyCredentialRequestContext extends ByteArray {
|
|
5
|
+
private readonly __type?;
|
|
5
6
|
constructor(contents: Buffer);
|
|
6
7
|
getRequest(): ProfileKeyCredentialRequest;
|
|
7
8
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import ServerSecretParams from '../ServerSecretParams';
|
|
3
3
|
import GroupPublicParams from '../groups/GroupPublicParams';
|
|
4
|
+
import ExpiringProfileKeyCredentialResponse from './ExpiringProfileKeyCredentialResponse';
|
|
4
5
|
import PniCredentialPresentation from './PniCredentialPresentation';
|
|
5
6
|
import PniCredentialResponse from './PniCredentialResponse';
|
|
6
7
|
import ProfileKeyCommitment from './ProfileKeyCommitment';
|
|
@@ -13,8 +14,19 @@ export default class ServerZkProfileOperations {
|
|
|
13
14
|
constructor(serverSecretParams: ServerSecretParams);
|
|
14
15
|
issueProfileKeyCredential(profileKeyCredentialRequest: ProfileKeyCredentialRequest, uuid: UUIDType, profileKeyCommitment: ProfileKeyCommitment): ProfileKeyCredentialResponse;
|
|
15
16
|
issueProfileKeyCredentialWithRandom(random: Buffer, profileKeyCredentialRequest: ProfileKeyCredentialRequest, uuid: UUIDType, profileKeyCommitment: ProfileKeyCommitment): ProfileKeyCredentialResponse;
|
|
17
|
+
issueExpiringProfileKeyCredential(profileKeyCredentialRequest: ProfileKeyCredentialRequest, uuid: UUIDType, profileKeyCommitment: ProfileKeyCommitment, expirationInSeconds: number): ExpiringProfileKeyCredentialResponse;
|
|
18
|
+
issueExpiringProfileKeyCredentialWithRandom(random: Buffer, profileKeyCredentialRequest: ProfileKeyCredentialRequest, uuid: UUIDType, profileKeyCommitment: ProfileKeyCommitment, expirationInSeconds: number): ExpiringProfileKeyCredentialResponse;
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated Superseded by AuthCredentialWithPni + ProfileKeyCredential
|
|
21
|
+
*/
|
|
16
22
|
issuePniCredential(profileKeyCredentialRequest: ProfileKeyCredentialRequest, aci: UUIDType, pni: UUIDType, profileKeyCommitment: ProfileKeyCommitment): PniCredentialResponse;
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated Superseded by AuthCredentialWithPni + ProfileKeyCredential
|
|
25
|
+
*/
|
|
17
26
|
issuePniCredentialWithRandom(random: Buffer, profileKeyCredentialRequest: ProfileKeyCredentialRequest, aci: UUIDType, pni: UUIDType, profileKeyCommitment: ProfileKeyCommitment): PniCredentialResponse;
|
|
18
|
-
verifyProfileKeyCredentialPresentation(groupPublicParams: GroupPublicParams, profileKeyCredentialPresentation: ProfileKeyCredentialPresentation): void;
|
|
27
|
+
verifyProfileKeyCredentialPresentation(groupPublicParams: GroupPublicParams, profileKeyCredentialPresentation: ProfileKeyCredentialPresentation, now?: Date): void;
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated Superseded by AuthCredentialWithPni + ProfileKeyCredential
|
|
30
|
+
*/
|
|
19
31
|
verifyPniCredentialPresentation(groupPublicParams: GroupPublicParams, presentation: PniCredentialPresentation): void;
|
|
20
32
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
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 });
|
|
7
7
|
const crypto_1 = require("crypto");
|
|
8
8
|
const Native = require("../../../Native");
|
|
9
9
|
const Constants_1 = require("../internal/Constants");
|
|
10
|
+
const ExpiringProfileKeyCredentialResponse_1 = require("./ExpiringProfileKeyCredentialResponse");
|
|
10
11
|
const PniCredentialResponse_1 = require("./PniCredentialResponse");
|
|
11
12
|
const ProfileKeyCredentialResponse_1 = require("./ProfileKeyCredentialResponse");
|
|
12
13
|
const UUIDUtil_1 = require("../internal/UUIDUtil");
|
|
@@ -21,16 +22,32 @@ class ServerZkProfileOperations {
|
|
|
21
22
|
issueProfileKeyCredentialWithRandom(random, profileKeyCredentialRequest, uuid, profileKeyCommitment) {
|
|
22
23
|
return new ProfileKeyCredentialResponse_1.default(Native.ServerSecretParams_IssueProfileKeyCredentialDeterministic(this.serverSecretParams.getContents(), random, profileKeyCredentialRequest.getContents(), (0, UUIDUtil_1.fromUUID)(uuid), profileKeyCommitment.getContents()));
|
|
23
24
|
}
|
|
25
|
+
issueExpiringProfileKeyCredential(profileKeyCredentialRequest, uuid, profileKeyCommitment, expirationInSeconds) {
|
|
26
|
+
const random = (0, crypto_1.randomBytes)(Constants_1.RANDOM_LENGTH);
|
|
27
|
+
return this.issueExpiringProfileKeyCredentialWithRandom(random, profileKeyCredentialRequest, uuid, profileKeyCommitment, expirationInSeconds);
|
|
28
|
+
}
|
|
29
|
+
issueExpiringProfileKeyCredentialWithRandom(random, profileKeyCredentialRequest, uuid, profileKeyCommitment, expirationInSeconds) {
|
|
30
|
+
return new ExpiringProfileKeyCredentialResponse_1.default(Native.ServerSecretParams_IssueExpiringProfileKeyCredentialDeterministic(this.serverSecretParams.getContents(), random, profileKeyCredentialRequest.getContents(), (0, UUIDUtil_1.fromUUID)(uuid), profileKeyCommitment.getContents(), expirationInSeconds));
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated Superseded by AuthCredentialWithPni + ProfileKeyCredential
|
|
34
|
+
*/
|
|
24
35
|
issuePniCredential(profileKeyCredentialRequest, aci, pni, profileKeyCommitment) {
|
|
25
36
|
const random = (0, crypto_1.randomBytes)(Constants_1.RANDOM_LENGTH);
|
|
26
37
|
return this.issuePniCredentialWithRandom(random, profileKeyCredentialRequest, aci, pni, profileKeyCommitment);
|
|
27
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated Superseded by AuthCredentialWithPni + ProfileKeyCredential
|
|
41
|
+
*/
|
|
28
42
|
issuePniCredentialWithRandom(random, profileKeyCredentialRequest, aci, pni, profileKeyCommitment) {
|
|
29
43
|
return new PniCredentialResponse_1.default(Native.ServerSecretParams_IssuePniCredentialDeterministic(this.serverSecretParams.getContents(), random, profileKeyCredentialRequest.getContents(), (0, UUIDUtil_1.fromUUID)(aci), (0, UUIDUtil_1.fromUUID)(pni), profileKeyCommitment.getContents()));
|
|
30
44
|
}
|
|
31
|
-
verifyProfileKeyCredentialPresentation(groupPublicParams, profileKeyCredentialPresentation) {
|
|
32
|
-
Native.ServerSecretParams_VerifyProfileKeyCredentialPresentation(this.serverSecretParams.getContents(), groupPublicParams.getContents(), profileKeyCredentialPresentation.getContents());
|
|
45
|
+
verifyProfileKeyCredentialPresentation(groupPublicParams, profileKeyCredentialPresentation, now = new Date()) {
|
|
46
|
+
Native.ServerSecretParams_VerifyProfileKeyCredentialPresentation(this.serverSecretParams.getContents(), groupPublicParams.getContents(), profileKeyCredentialPresentation.getContents(), Math.floor(now.getTime() / 1000));
|
|
33
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* @deprecated Superseded by AuthCredentialWithPni + ProfileKeyCredential
|
|
50
|
+
*/
|
|
34
51
|
verifyPniCredentialPresentation(groupPublicParams, presentation) {
|
|
35
52
|
Native.ServerSecretParams_VerifyPniCredentialPresentation(this.serverSecretParams.getContents(), groupPublicParams.getContents(), presentation.getContents());
|
|
36
53
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import ByteArray from '../internal/ByteArray';
|
|
3
3
|
export default class ReceiptCredential extends ByteArray {
|
|
4
|
+
private readonly __type?;
|
|
4
5
|
constructor(contents: Buffer);
|
|
5
|
-
getReceiptExpirationTime():
|
|
6
|
+
getReceiptExpirationTime(): number;
|
|
6
7
|
getReceiptLevel(): bigint;
|
|
7
8
|
}
|
|
@@ -11,7 +11,7 @@ class ReceiptCredential extends ByteArray_1.default {
|
|
|
11
11
|
super(contents, Native.ReceiptCredential_CheckValidContents);
|
|
12
12
|
}
|
|
13
13
|
getReceiptExpirationTime() {
|
|
14
|
-
return Native.ReceiptCredential_GetReceiptExpirationTime(this.contents)
|
|
14
|
+
return Native.ReceiptCredential_GetReceiptExpirationTime(this.contents);
|
|
15
15
|
}
|
|
16
16
|
getReceiptLevel() {
|
|
17
17
|
return Native.ReceiptCredential_GetReceiptLevel(this.contents).readBigUInt64BE();
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
import ByteArray from '../internal/ByteArray';
|
|
3
3
|
import ReceiptSerial from './ReceiptSerial';
|
|
4
4
|
export default class ReceiptCredentialPresentation extends ByteArray {
|
|
5
|
+
private readonly __type?;
|
|
5
6
|
static SIZE: number;
|
|
6
7
|
constructor(contents: Buffer);
|
|
7
|
-
getReceiptExpirationTime():
|
|
8
|
+
getReceiptExpirationTime(): number;
|
|
8
9
|
getReceiptLevel(): bigint;
|
|
9
10
|
getReceiptSerialBytes(): ReceiptSerial;
|
|
10
11
|
}
|
|
@@ -12,7 +12,7 @@ class ReceiptCredentialPresentation extends ByteArray_1.default {
|
|
|
12
12
|
super(contents, Native.ReceiptCredentialPresentation_CheckValidContents);
|
|
13
13
|
}
|
|
14
14
|
getReceiptExpirationTime() {
|
|
15
|
-
return Native.ReceiptCredentialPresentation_GetReceiptExpirationTime(this.contents)
|
|
15
|
+
return Native.ReceiptCredentialPresentation_GetReceiptExpirationTime(this.contents);
|
|
16
16
|
}
|
|
17
17
|
getReceiptLevel() {
|
|
18
18
|
return Native.ReceiptCredentialPresentation_GetReceiptLevel(this.contents).readBigUInt64BE();
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import ByteArray from '../internal/ByteArray';
|
|
3
3
|
import ReceiptCredentialRequest from './ReceiptCredentialRequest';
|
|
4
4
|
export default class ReceiptCredentialRequestContext extends ByteArray {
|
|
5
|
+
private readonly __type?;
|
|
5
6
|
static SIZE: number;
|
|
6
7
|
constructor(contents: Buffer);
|
|
7
8
|
getRequest(): ReceiptCredentialRequest;
|
|
@@ -6,7 +6,7 @@ import ReceiptCredentialPresentation from './ReceiptCredentialPresentation';
|
|
|
6
6
|
export default class ServerZkReceiptOperations {
|
|
7
7
|
serverSecretParams: ServerSecretParams;
|
|
8
8
|
constructor(serverSecretParams: ServerSecretParams);
|
|
9
|
-
issueReceiptCredential(receiptCredentialRequest: ReceiptCredentialRequest, receiptExpirationTime:
|
|
10
|
-
issueReceiptCredentialWithRandom(random: Buffer, receiptCredentialRequest: ReceiptCredentialRequest, receiptExpirationTime:
|
|
9
|
+
issueReceiptCredential(receiptCredentialRequest: ReceiptCredentialRequest, receiptExpirationTime: number, receiptLevel: bigint): ReceiptCredentialResponse;
|
|
10
|
+
issueReceiptCredentialWithRandom(random: Buffer, receiptCredentialRequest: ReceiptCredentialRequest, receiptExpirationTime: number, receiptLevel: bigint): ReceiptCredentialResponse;
|
|
11
11
|
verifyReceiptCredentialPresentation(receiptCredentialPresentation: ReceiptCredentialPresentation): void;
|
|
12
12
|
}
|
|
@@ -18,7 +18,7 @@ class ServerZkReceiptOperations {
|
|
|
18
18
|
return this.issueReceiptCredentialWithRandom(random, receiptCredentialRequest, receiptExpirationTime, receiptLevel);
|
|
19
19
|
}
|
|
20
20
|
issueReceiptCredentialWithRandom(random, receiptCredentialRequest, receiptExpirationTime, receiptLevel) {
|
|
21
|
-
return new ReceiptCredentialResponse_1.default(Native.ServerSecretParams_IssueReceiptCredentialDeterministic(this.serverSecretParams.getContents(), random, receiptCredentialRequest.getContents(),
|
|
21
|
+
return new ReceiptCredentialResponse_1.default(Native.ServerSecretParams_IssueReceiptCredentialDeterministic(this.serverSecretParams.getContents(), random, receiptCredentialRequest.getContents(), receiptExpirationTime, (0, BigIntUtil_1.bufferFromBigUInt64BE)(receiptLevel)));
|
|
22
22
|
}
|
|
23
23
|
verifyReceiptCredentialPresentation(receiptCredentialPresentation) {
|
|
24
24
|
Native.ServerSecretParams_VerifyReceiptCredentialPresentation(this.serverSecretParams.getContents(), receiptCredentialPresentation.getContents());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signalapp/libsignal-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.1",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/bindings": "^1.3.0",
|
|
33
|
-
"@types/chai": "^4.
|
|
33
|
+
"@types/chai": "^4.3.1",
|
|
34
34
|
"@types/chai-as-promised": "^7.1.3",
|
|
35
35
|
"@types/mocha": "^5.2.7",
|
|
36
36
|
"@types/node": "*",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|