@signalapp/libsignal-client 0.22.1 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/Native.d.ts +37 -31
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.js +5 -5
  4. package/dist/usernames.js +1 -0
  5. package/dist/zkgroup/GenericServerPublicParams.d.ts +6 -0
  6. package/dist/zkgroup/GenericServerPublicParams.js +15 -0
  7. package/dist/zkgroup/GenericServerSecretParams.d.ts +10 -0
  8. package/dist/zkgroup/GenericServerSecretParams.js +28 -0
  9. package/dist/zkgroup/calllinks/CallLinkAuthCredential.d.ts +12 -0
  10. package/dist/zkgroup/calllinks/CallLinkAuthCredential.js +26 -0
  11. package/dist/zkgroup/calllinks/CallLinkAuthCredentialPresentation.d.ts +11 -0
  12. package/dist/zkgroup/calllinks/CallLinkAuthCredentialPresentation.js +22 -0
  13. package/dist/zkgroup/calllinks/CallLinkAuthCredentialResponse.d.ts +13 -0
  14. package/dist/zkgroup/calllinks/CallLinkAuthCredentialResponse.js +29 -0
  15. package/dist/zkgroup/{profiles/PniCredential.d.ts → calllinks/CallLinkPublicParams.d.ts} +1 -1
  16. package/dist/zkgroup/{profiles/ProfileKeyCredential.js → calllinks/CallLinkPublicParams.js} +5 -5
  17. package/dist/zkgroup/calllinks/CallLinkSecretParams.d.ts +12 -0
  18. package/dist/zkgroup/calllinks/CallLinkSecretParams.js +26 -0
  19. package/dist/zkgroup/calllinks/CreateCallLinkCredential.d.ts +12 -0
  20. package/dist/zkgroup/calllinks/CreateCallLinkCredential.js +26 -0
  21. package/dist/zkgroup/calllinks/CreateCallLinkCredentialPresentation.d.ts +9 -0
  22. package/dist/zkgroup/calllinks/CreateCallLinkCredentialPresentation.js +18 -0
  23. package/dist/zkgroup/calllinks/CreateCallLinkCredentialRequest.d.ts +11 -0
  24. package/dist/zkgroup/calllinks/CreateCallLinkCredentialRequest.js +26 -0
  25. package/dist/zkgroup/calllinks/CreateCallLinkCredentialRequestContext.d.ts +15 -0
  26. package/dist/zkgroup/calllinks/CreateCallLinkCredentialRequestContext.js +33 -0
  27. package/dist/zkgroup/{profiles/ProfileKeyCredentialResponse.d.ts → calllinks/CreateCallLinkCredentialResponse.d.ts} +1 -1
  28. package/dist/zkgroup/calllinks/CreateCallLinkCredentialResponse.js +15 -0
  29. package/dist/zkgroup/index.d.ts +12 -6
  30. package/dist/zkgroup/index.js +26 -13
  31. package/dist/zkgroup/profiles/ClientZkProfileOperations.d.ts +0 -29
  32. package/dist/zkgroup/profiles/ClientZkProfileOperations.js +0 -46
  33. package/dist/zkgroup/profiles/ProfileKey.d.ts +1 -0
  34. package/dist/zkgroup/profiles/ProfileKey.js +3 -0
  35. package/dist/zkgroup/profiles/ServerZkProfileOperations.d.ts +0 -17
  36. package/dist/zkgroup/profiles/ServerZkProfileOperations.js +0 -28
  37. package/package.json +1 -1
  38. package/prebuilds/darwin-arm64/node.napi.node +0 -0
  39. package/prebuilds/darwin-x64/node.napi.node +0 -0
  40. package/prebuilds/linux-arm64/node.napi.node +0 -0
  41. package/prebuilds/linux-x64/node.napi.node +0 -0
  42. package/prebuilds/win32-arm64/node.napi.node +0 -0
  43. package/prebuilds/win32-x64/node.napi.node +0 -0
  44. package/dist/zkgroup/profiles/PniCredential.js +0 -15
  45. package/dist/zkgroup/profiles/PniCredentialPresentation.d.ts +0 -11
  46. package/dist/zkgroup/profiles/PniCredentialPresentation.js +0 -26
  47. package/dist/zkgroup/profiles/PniCredentialRequestContext.d.ts +0 -8
  48. package/dist/zkgroup/profiles/PniCredentialRequestContext.js +0 -19
  49. package/dist/zkgroup/profiles/PniCredentialResponse.d.ts +0 -6
  50. package/dist/zkgroup/profiles/PniCredentialResponse.js +0 -15
  51. package/dist/zkgroup/profiles/ProfileKeyCredential.d.ts +0 -6
  52. package/dist/zkgroup/profiles/ProfileKeyCredentialResponse.js +0 -15
package/Native.d.ts CHANGED
@@ -54,21 +54,41 @@ export function Aes256GcmSiv_Decrypt(aesGcmSiv: Wrapper<Aes256GcmSiv>, ctext: Bu
54
54
  export function Aes256GcmSiv_Encrypt(aesGcmSivObj: Wrapper<Aes256GcmSiv>, ptext: Buffer, nonce: Buffer, associatedData: Buffer): Buffer;
55
55
  export function Aes256GcmSiv_New(key: Buffer): Aes256GcmSiv;
56
56
  export function AuthCredentialPresentation_CheckValidContents(presentationBytes: Buffer): void;
57
- export function AuthCredentialPresentation_GetPniCiphertext(presentationBytes: Buffer): Buffer;
57
+ export function AuthCredentialPresentation_GetPniCiphertext(presentationBytes: Buffer): Buffer | null;
58
58
  export function AuthCredentialPresentation_GetRedemptionTime(presentationBytes: Buffer): Timestamp;
59
59
  export function AuthCredentialPresentation_GetUuidCiphertext(presentationBytes: Buffer): Serialized<UuidCiphertext>;
60
60
  export function AuthCredentialResponse_CheckValidContents(buffer: Buffer): void;
61
61
  export function AuthCredentialWithPniResponse_CheckValidContents(buffer: Buffer): void;
62
62
  export function AuthCredentialWithPni_CheckValidContents(buffer: Buffer): void;
63
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, attestationMsg: Buffer, currentTimestamp: Timestamp): Cds2ClientState;
64
+ export function CallLinkAuthCredentialPresentation_CheckValidContents(presentationBytes: Buffer): void;
65
+ export function CallLinkAuthCredentialPresentation_GetUserId(presentationBytes: Buffer): Serialized<UuidCiphertext>;
66
+ export function CallLinkAuthCredentialPresentation_Verify(presentationBytes: Buffer, now: Timestamp, serverParamsBytes: Buffer, callLinkParamsBytes: Buffer): void;
67
+ export function CallLinkAuthCredentialResponse_CheckValidContents(responseBytes: Buffer): void;
68
+ export function CallLinkAuthCredentialResponse_IssueDeterministic(userId: Uuid, redemptionTime: Timestamp, paramsBytes: Buffer, randomness: Buffer): Buffer;
69
+ export function CallLinkAuthCredentialResponse_Receive(responseBytes: Buffer, userId: Uuid, redemptionTime: Timestamp, paramsBytes: Buffer): Buffer;
70
+ export function CallLinkAuthCredential_CheckValidContents(credentialBytes: Buffer): void;
71
+ export function CallLinkAuthCredential_PresentDeterministic(credentialBytes: Buffer, userId: Uuid, redemptionTime: Timestamp, serverParamsBytes: Buffer, callLinkParamsBytes: Buffer, randomness: Buffer): Buffer;
72
+ export function CallLinkPublicParams_CheckValidContents(paramsBytes: Buffer): void;
73
+ export function CallLinkSecretParams_CheckValidContents(paramsBytes: Buffer): void;
74
+ export function CallLinkSecretParams_DecryptUserId(paramsBytes: Buffer, userId: Serialized<UuidCiphertext>): Uuid;
75
+ export function CallLinkSecretParams_DeriveFromRootKey(rootKey: Buffer): Buffer;
76
+ export function CallLinkSecretParams_GetPublicParams(paramsBytes: Buffer): Buffer;
77
+ export function Cds2ClientState_New(mrenclave: Buffer, attestationMsg: Buffer, currentTimestamp: Timestamp): SgxClientState;
69
78
  export function CiphertextMessage_FromPlaintextContent(m: Wrapper<PlaintextContent>): CiphertextMessage;
70
79
  export function CiphertextMessage_Serialize(obj: Wrapper<CiphertextMessage>): Buffer;
71
80
  export function CiphertextMessage_Type(msg: Wrapper<CiphertextMessage>): number;
81
+ export function CreateCallLinkCredentialPresentation_CheckValidContents(presentationBytes: Buffer): void;
82
+ export function CreateCallLinkCredentialPresentation_Verify(presentationBytes: Buffer, roomId: Buffer, now: Timestamp, serverParamsBytes: Buffer, callLinkParamsBytes: Buffer): void;
83
+ export function CreateCallLinkCredentialRequestContext_CheckValidContents(contextBytes: Buffer): void;
84
+ export function CreateCallLinkCredentialRequestContext_GetRequest(contextBytes: Buffer): Buffer;
85
+ export function CreateCallLinkCredentialRequestContext_NewDeterministic(roomId: Buffer, randomness: Buffer): Buffer;
86
+ export function CreateCallLinkCredentialRequestContext_ReceiveResponse(contextBytes: Buffer, responseBytes: Buffer, userId: Uuid, paramsBytes: Buffer): Buffer;
87
+ export function CreateCallLinkCredentialRequest_CheckValidContents(requestBytes: Buffer): void;
88
+ export function CreateCallLinkCredentialRequest_IssueDeterministic(requestBytes: Buffer, userId: Uuid, timestamp: Timestamp, paramsBytes: Buffer, randomness: Buffer): Buffer;
89
+ export function CreateCallLinkCredentialResponse_CheckValidContents(responseBytes: Buffer): void;
90
+ export function CreateCallLinkCredential_CheckValidContents(paramsBytes: Buffer): void;
91
+ export function CreateCallLinkCredential_PresentDeterministic(credentialBytes: Buffer, roomId: Buffer, userId: Uuid, serverParamsBytes: Buffer, callLinkParamsBytes: Buffer, randomness: Buffer): Buffer;
72
92
  export function DecryptionErrorMessage_Deserialize(data: Buffer): DecryptionErrorMessage;
73
93
  export function DecryptionErrorMessage_ExtractFromSerializedContent(bytes: Buffer): DecryptionErrorMessage;
74
94
  export function DecryptionErrorMessage_ForOriginalMessage(originalBytes: Buffer, originalType: number, originalTimestamp: Timestamp, originalSenderDeviceId: number): DecryptionErrorMessage;
@@ -82,6 +102,10 @@ export function ExpiringProfileKeyCredential_GetExpirationTime(credential: Seria
82
102
  export function Fingerprint_DisplayString(obj: Wrapper<Fingerprint>): string;
83
103
  export function Fingerprint_New(iterations: number, version: number, localIdentifier: Buffer, localKey: Wrapper<PublicKey>, remoteIdentifier: Buffer, remoteKey: Wrapper<PublicKey>): Fingerprint;
84
104
  export function Fingerprint_ScannableEncoding(obj: Wrapper<Fingerprint>): Buffer;
105
+ export function GenericServerPublicParams_CheckValidContents(paramsBytes: Buffer): void;
106
+ export function GenericServerSecretParams_CheckValidContents(paramsBytes: Buffer): void;
107
+ export function GenericServerSecretParams_GenerateDeterministic(randomness: Buffer): Buffer;
108
+ export function GenericServerSecretParams_GetPublicParams(paramsBytes: Buffer): Buffer;
85
109
  export function GroupCipher_DecryptMessage(sender: Wrapper<ProtocolAddress>, message: Buffer, store: SenderKeyStore, ctx: null): Promise<Buffer>;
86
110
  export function GroupCipher_EncryptMessage(sender: Wrapper<ProtocolAddress>, distributionId: Uuid, message: Buffer, store: SenderKeyStore, ctx: null): Promise<CiphertextMessage>;
87
111
  export function GroupMasterKey_CheckValidContents(buffer: Buffer): void;
@@ -112,14 +136,6 @@ export function PlaintextContent_Deserialize(data: Buffer): PlaintextContent;
112
136
  export function PlaintextContent_FromDecryptionErrorMessage(m: Wrapper<DecryptionErrorMessage>): PlaintextContent;
113
137
  export function PlaintextContent_GetBody(obj: Wrapper<PlaintextContent>): Buffer;
114
138
  export function PlaintextContent_Serialize(obj: Wrapper<PlaintextContent>): Buffer;
115
- export function PniCredentialPresentation_CheckValidContents(presentationBytes: Buffer): void;
116
- export function PniCredentialPresentation_GetAciCiphertext(presentationBytes: Buffer): Serialized<UuidCiphertext>;
117
- export function PniCredentialPresentation_GetPniCiphertext(presentationBytes: Buffer): Serialized<UuidCiphertext>;
118
- export function PniCredentialPresentation_GetProfileKeyCiphertext(presentationBytes: Buffer): Serialized<ProfileKeyCiphertext>;
119
- export function PniCredentialRequestContext_CheckValidContents(buffer: Buffer): void;
120
- export function PniCredentialRequestContext_GetRequest(context: Serialized<PniCredentialRequestContext>): Serialized<ProfileKeyCredentialRequest>;
121
- export function PniCredentialResponse_CheckValidContents(buffer: Buffer): void;
122
- export function PniCredential_CheckValidContents(buffer: Buffer): void;
123
139
  export function PreKeyBundle_GetDeviceId(obj: Wrapper<PreKeyBundle>): number;
124
140
  export function PreKeyBundle_GetIdentityKey(p: Wrapper<PreKeyBundle>): PublicKey;
125
141
  export function PreKeyBundle_GetPreKeyId(obj: Wrapper<PreKeyBundle>): number | null;
@@ -156,9 +172,8 @@ export function ProfileKeyCredentialPresentation_GetUuidCiphertext(presentationB
156
172
  export function ProfileKeyCredentialRequestContext_CheckValidContents(buffer: Buffer): void;
157
173
  export function ProfileKeyCredentialRequestContext_GetRequest(context: Serialized<ProfileKeyCredentialRequestContext>): Serialized<ProfileKeyCredentialRequest>;
158
174
  export function ProfileKeyCredentialRequest_CheckValidContents(buffer: Buffer): void;
159
- export function ProfileKeyCredentialResponse_CheckValidContents(buffer: Buffer): void;
160
- export function ProfileKeyCredential_CheckValidContents(buffer: Buffer): void;
161
175
  export function ProfileKey_CheckValidContents(buffer: Buffer): void;
176
+ export function ProfileKey_DeriveAccessKey(profileKey: Serialized<ProfileKey>): Buffer;
162
177
  export function ProfileKey_GetCommitment(profileKey: Serialized<ProfileKey>, uuid: Uuid): Serialized<ProfileKeyCommitment>;
163
178
  export function ProfileKey_GetProfileKeyVersion(profileKey: Serialized<ProfileKey>, uuid: Uuid): Buffer;
164
179
  export function ProtocolAddress_DeviceId(obj: Wrapper<ProtocolAddress>): number;
@@ -232,17 +247,12 @@ export function ServerPublicParams_CheckValidContents(buffer: Buffer): void;
232
247
  export function ServerPublicParams_CreateAuthCredentialPresentationDeterministic(serverPublicParams: Serialized<ServerPublicParams>, randomness: Buffer, groupSecretParams: Serialized<GroupSecretParams>, authCredential: Serialized<AuthCredential>): Buffer;
233
248
  export function ServerPublicParams_CreateAuthCredentialWithPniPresentationDeterministic(serverPublicParams: Serialized<ServerPublicParams>, randomness: Buffer, groupSecretParams: Serialized<GroupSecretParams>, authCredential: Serialized<AuthCredentialWithPni>): Buffer;
234
249
  export function ServerPublicParams_CreateExpiringProfileKeyCredentialPresentationDeterministic(serverPublicParams: Serialized<ServerPublicParams>, randomness: Buffer, groupSecretParams: Serialized<GroupSecretParams>, profileKeyCredential: Serialized<ExpiringProfileKeyCredential>): Buffer;
235
- export function ServerPublicParams_CreatePniCredentialPresentationDeterministic(serverPublicParams: Serialized<ServerPublicParams>, randomness: Buffer, groupSecretParams: Serialized<GroupSecretParams>, pniCredential: Serialized<PniCredential>): Buffer;
236
- export function ServerPublicParams_CreatePniCredentialRequestContextDeterministic(serverPublicParams: Serialized<ServerPublicParams>, randomness: Buffer, aci: Uuid, pni: Uuid, profileKey: Serialized<ProfileKey>): Serialized<PniCredentialRequestContext>;
237
- export function ServerPublicParams_CreateProfileKeyCredentialPresentationDeterministic(serverPublicParams: Serialized<ServerPublicParams>, randomness: Buffer, groupSecretParams: Serialized<GroupSecretParams>, profileKeyCredential: Serialized<ProfileKeyCredential>): Buffer;
238
250
  export function ServerPublicParams_CreateProfileKeyCredentialRequestContextDeterministic(serverPublicParams: Serialized<ServerPublicParams>, randomness: Buffer, uuid: Uuid, profileKey: Serialized<ProfileKey>): Serialized<ProfileKeyCredentialRequestContext>;
239
251
  export function ServerPublicParams_CreateReceiptCredentialPresentationDeterministic(serverPublicParams: Serialized<ServerPublicParams>, randomness: Buffer, receiptCredential: Serialized<ReceiptCredential>): Serialized<ReceiptCredentialPresentation>;
240
252
  export function ServerPublicParams_CreateReceiptCredentialRequestContextDeterministic(serverPublicParams: Serialized<ServerPublicParams>, randomness: Buffer, receiptSerial: Buffer): Serialized<ReceiptCredentialRequestContext>;
241
253
  export function ServerPublicParams_ReceiveAuthCredential(params: Serialized<ServerPublicParams>, uuid: Uuid, redemptionTime: number, response: Serialized<AuthCredentialResponse>): Serialized<AuthCredential>;
242
254
  export function ServerPublicParams_ReceiveAuthCredentialWithPni(params: Serialized<ServerPublicParams>, aci: Uuid, pni: Uuid, redemptionTime: Timestamp, response: Serialized<AuthCredentialWithPniResponse>): Serialized<AuthCredentialWithPni>;
243
255
  export function ServerPublicParams_ReceiveExpiringProfileKeyCredential(serverPublicParams: Serialized<ServerPublicParams>, requestContext: Serialized<ProfileKeyCredentialRequestContext>, response: Serialized<ExpiringProfileKeyCredentialResponse>, currentTimeInSeconds: Timestamp): Serialized<ExpiringProfileKeyCredential>;
244
- export function ServerPublicParams_ReceivePniCredential(serverPublicParams: Serialized<ServerPublicParams>, requestContext: Serialized<PniCredentialRequestContext>, response: Serialized<PniCredentialResponse>): Serialized<PniCredential>;
245
- export function ServerPublicParams_ReceiveProfileKeyCredential(serverPublicParams: Serialized<ServerPublicParams>, requestContext: Serialized<ProfileKeyCredentialRequestContext>, response: Serialized<ProfileKeyCredentialResponse>): Serialized<ProfileKeyCredential>;
246
256
  export function ServerPublicParams_ReceiveReceiptCredential(serverPublicParams: Serialized<ServerPublicParams>, requestContext: Serialized<ReceiptCredentialRequestContext>, response: Serialized<ReceiptCredentialResponse>): Serialized<ReceiptCredential>;
247
257
  export function ServerPublicParams_VerifySignature(serverPublicParams: Serialized<ServerPublicParams>, message: Buffer, notarySignature: Buffer): void;
248
258
  export function ServerSecretParams_CheckValidContents(buffer: Buffer): void;
@@ -251,12 +261,9 @@ export function ServerSecretParams_GetPublicParams(params: Serialized<ServerSecr
251
261
  export function ServerSecretParams_IssueAuthCredentialDeterministic(serverSecretParams: Serialized<ServerSecretParams>, randomness: Buffer, uuid: Uuid, redemptionTime: number): Serialized<AuthCredentialResponse>;
252
262
  export function ServerSecretParams_IssueAuthCredentialWithPniDeterministic(serverSecretParams: Serialized<ServerSecretParams>, randomness: Buffer, aci: Uuid, pni: Uuid, redemptionTime: Timestamp): Serialized<AuthCredentialWithPniResponse>;
253
263
  export function ServerSecretParams_IssueExpiringProfileKeyCredentialDeterministic(serverSecretParams: Serialized<ServerSecretParams>, randomness: Buffer, request: Serialized<ProfileKeyCredentialRequest>, uuid: Uuid, commitment: Serialized<ProfileKeyCommitment>, expirationInSeconds: Timestamp): Serialized<ExpiringProfileKeyCredentialResponse>;
254
- export function ServerSecretParams_IssuePniCredentialDeterministic(serverSecretParams: Serialized<ServerSecretParams>, randomness: Buffer, request: Serialized<ProfileKeyCredentialRequest>, aci: Uuid, pni: Uuid, commitment: Serialized<ProfileKeyCommitment>): Serialized<PniCredentialResponse>;
255
- export function ServerSecretParams_IssueProfileKeyCredentialDeterministic(serverSecretParams: Serialized<ServerSecretParams>, randomness: Buffer, request: Serialized<ProfileKeyCredentialRequest>, uuid: Uuid, commitment: Serialized<ProfileKeyCommitment>): Serialized<ProfileKeyCredentialResponse>;
256
264
  export function ServerSecretParams_IssueReceiptCredentialDeterministic(serverSecretParams: Serialized<ServerSecretParams>, randomness: Buffer, request: Serialized<ReceiptCredentialRequest>, receiptExpirationTime: Timestamp, receiptLevel: Buffer): Serialized<ReceiptCredentialResponse>;
257
265
  export function ServerSecretParams_SignDeterministic(params: Serialized<ServerSecretParams>, randomness: Buffer, message: Buffer): Buffer;
258
266
  export function ServerSecretParams_VerifyAuthCredentialPresentation(serverSecretParams: Serialized<ServerSecretParams>, groupPublicParams: Serialized<GroupPublicParams>, presentationBytes: Buffer, currentTimeInSeconds: Timestamp): void;
259
- export function ServerSecretParams_VerifyPniCredentialPresentation(serverSecretParams: Serialized<ServerSecretParams>, groupPublicParams: Serialized<GroupPublicParams>, presentationBytes: Buffer): void;
260
267
  export function ServerSecretParams_VerifyProfileKeyCredentialPresentation(serverSecretParams: Serialized<ServerSecretParams>, groupPublicParams: Serialized<GroupPublicParams>, presentationBytes: Buffer, currentTimeInSeconds: Timestamp): void;
261
268
  export function ServerSecretParams_VerifyReceiptCredentialPresentation(serverSecretParams: Serialized<ServerSecretParams>, presentation: Serialized<ReceiptCredentialPresentation>): void;
262
269
  export function SessionBuilder_ProcessPreKeyBundle(bundle: Wrapper<PreKeyBundle>, protocolAddress: Wrapper<ProtocolAddress>, sessionStore: SessionStore, identityKeyStore: IdentityKeyStore, ctx: null): Promise<void>;
@@ -270,6 +277,10 @@ export function SessionRecord_GetLocalRegistrationId(obj: Wrapper<SessionRecord>
270
277
  export function SessionRecord_GetRemoteRegistrationId(obj: Wrapper<SessionRecord>): number;
271
278
  export function SessionRecord_HasCurrentState(obj: Wrapper<SessionRecord>): boolean;
272
279
  export function SessionRecord_Serialize(obj: Wrapper<SessionRecord>): Buffer;
280
+ export function SgxClientState_CompleteHandshake(cli: Wrapper<SgxClientState>, handshakeReceived: Buffer): void;
281
+ export function SgxClientState_EstablishedRecv(cli: Wrapper<SgxClientState>, receivedCiphertext: Buffer): Buffer;
282
+ export function SgxClientState_EstablishedSend(cli: Wrapper<SgxClientState>, plaintextToSend: Buffer): Buffer;
283
+ export function SgxClientState_InitialRequest(obj: Wrapper<SgxClientState>): Buffer;
273
284
  export function SignalMessage_Deserialize(data: Buffer): SignalMessage;
274
285
  export function SignalMessage_GetBody(obj: Wrapper<SignalMessage>): Buffer;
275
286
  export function SignalMessage_GetCounter(obj: Wrapper<SignalMessage>): number;
@@ -288,7 +299,7 @@ export function SignedPreKeyRecord_Serialize(obj: Wrapper<SignedPreKeyRecord>):
288
299
  export function UnidentifiedSenderMessageContent_Deserialize(data: Buffer): UnidentifiedSenderMessageContent;
289
300
  export function UnidentifiedSenderMessageContent_GetContentHint(m: Wrapper<UnidentifiedSenderMessageContent>): number;
290
301
  export function UnidentifiedSenderMessageContent_GetContents(obj: Wrapper<UnidentifiedSenderMessageContent>): Buffer;
291
- export function UnidentifiedSenderMessageContent_GetGroupId(obj: Wrapper<UnidentifiedSenderMessageContent>): Buffer;
302
+ export function UnidentifiedSenderMessageContent_GetGroupId(obj: Wrapper<UnidentifiedSenderMessageContent>): Buffer | null;
292
303
  export function UnidentifiedSenderMessageContent_GetMsgType(m: Wrapper<UnidentifiedSenderMessageContent>): number;
293
304
  export function UnidentifiedSenderMessageContent_GetSenderCert(m: Wrapper<UnidentifiedSenderMessageContent>): SenderCertificate;
294
305
  export function UnidentifiedSenderMessageContent_New(message: Wrapper<CiphertextMessage>, sender: Wrapper<SenderCertificate>, contentHint: number, groupId: Buffer | null): UnidentifiedSenderMessageContent;
@@ -304,7 +315,6 @@ interface AuthCredential { readonly __type: unique symbol; }
304
315
  interface AuthCredentialResponse { readonly __type: unique symbol; }
305
316
  interface AuthCredentialWithPni { readonly __type: unique symbol; }
306
317
  interface AuthCredentialWithPniResponse { readonly __type: unique symbol; }
307
- interface Cds2ClientState { readonly __type: unique symbol; }
308
318
  interface CiphertextMessage { readonly __type: unique symbol; }
309
319
  interface DecryptionErrorMessage { readonly __type: unique symbol; }
310
320
  interface ExpiringProfileKeyCredential { readonly __type: unique symbol; }
@@ -315,9 +325,6 @@ interface GroupPublicParams { readonly __type: unique symbol; }
315
325
  interface GroupSecretParams { readonly __type: unique symbol; }
316
326
  interface HsmEnclaveClient { readonly __type: unique symbol; }
317
327
  interface PlaintextContent { readonly __type: unique symbol; }
318
- interface PniCredential { readonly __type: unique symbol; }
319
- interface PniCredentialRequestContext { readonly __type: unique symbol; }
320
- interface PniCredentialResponse { readonly __type: unique symbol; }
321
328
  interface PreKeyBundle { readonly __type: unique symbol; }
322
329
  interface PreKeyRecord { readonly __type: unique symbol; }
323
330
  interface PreKeySignalMessage { readonly __type: unique symbol; }
@@ -325,10 +332,8 @@ interface PrivateKey { readonly __type: unique symbol; }
325
332
  interface ProfileKey { readonly __type: unique symbol; }
326
333
  interface ProfileKeyCiphertext { readonly __type: unique symbol; }
327
334
  interface ProfileKeyCommitment { readonly __type: unique symbol; }
328
- interface ProfileKeyCredential { readonly __type: unique symbol; }
329
335
  interface ProfileKeyCredentialRequest { readonly __type: unique symbol; }
330
336
  interface ProfileKeyCredentialRequestContext { readonly __type: unique symbol; }
331
- interface ProfileKeyCredentialResponse { readonly __type: unique symbol; }
332
337
  interface ProtocolAddress { readonly __type: unique symbol; }
333
338
  interface PublicKey { readonly __type: unique symbol; }
334
339
  interface ReceiptCredential { readonly __type: unique symbol; }
@@ -345,6 +350,7 @@ interface ServerCertificate { readonly __type: unique symbol; }
345
350
  interface ServerPublicParams { readonly __type: unique symbol; }
346
351
  interface ServerSecretParams { readonly __type: unique symbol; }
347
352
  interface SessionRecord { readonly __type: unique symbol; }
353
+ interface SgxClientState { readonly __type: unique symbol; }
348
354
  interface SignalMessage { readonly __type: unique symbol; }
349
355
  interface SignedPreKeyRecord { readonly __type: unique symbol; }
350
356
  interface UnidentifiedSenderMessageContent { readonly __type: unique symbol; }
package/dist/index.d.ts CHANGED
@@ -324,7 +324,7 @@ export declare function sealedSenderMultiRecipientMessageForSingleRecipient(mess
324
324
  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>;
325
325
  export declare function sealedSenderDecryptToUsmc(message: Buffer, identityStore: IdentityKeyStore): Promise<UnidentifiedSenderMessageContent>;
326
326
  export declare class Cds2Client {
327
- readonly _nativeHandle: Native.Cds2ClientState;
327
+ readonly _nativeHandle: Native.SgxClientState;
328
328
  private constructor();
329
329
  static new(mrenclave: Buffer, attestationMsg: Buffer, currentTimestamp: Date): Cds2Client;
330
330
  initialRequest(): Buffer;
package/dist/index.js CHANGED
@@ -865,16 +865,16 @@ class Cds2Client {
865
865
  return new Cds2Client(Native.Cds2ClientState_New(mrenclave, attestationMsg, currentTimestamp.getTime()));
866
866
  }
867
867
  initialRequest() {
868
- return Native.Cds2ClientState_InitialRequest(this);
868
+ return Native.SgxClientState_InitialRequest(this);
869
869
  }
870
870
  completeHandshake(buffer) {
871
- return Native.Cds2ClientState_CompleteHandshake(this, buffer);
871
+ return Native.SgxClientState_CompleteHandshake(this, buffer);
872
872
  }
873
873
  establishedSend(buffer) {
874
- return Native.Cds2ClientState_EstablishedSend(this, buffer);
874
+ return Native.SgxClientState_EstablishedSend(this, buffer);
875
875
  }
876
876
  establishedRecv(buffer) {
877
- return Native.Cds2ClientState_EstablishedRecv(this, buffer);
877
+ return Native.SgxClientState_EstablishedRecv(this, buffer);
878
878
  }
879
879
  }
880
880
  exports.Cds2Client = Cds2Client;
@@ -951,7 +951,7 @@ function initLogger(maxLevel, callback) {
951
951
  level = LogLevel.Trace;
952
952
  break;
953
953
  default:
954
- callback(LogLevel.Warn, 'signal-client', 'index.ts', 0, 'unknown log level ' + nativeLevel + '; treating as error');
954
+ callback(LogLevel.Warn, 'signal-client', 'index.ts', 0, `unknown log level ${nativeLevel}; treating as error`);
955
955
  level = LogLevel.Error;
956
956
  break;
957
957
  }
package/dist/usernames.js CHANGED
@@ -5,6 +5,7 @@
5
5
  //
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.verifyProof = exports.generateProofWithRandom = exports.generateProof = exports.hash = exports.generateCandidates = void 0;
8
+ /* eslint @typescript-eslint/no-shadow: ["error", { "allow": ["hash"] }] */
8
9
  const crypto_1 = require("crypto");
9
10
  const Constants_1 = require("./zkgroup/internal/Constants");
10
11
  const Native = require("../Native");
@@ -0,0 +1,6 @@
1
+ /// <reference types="node" />
2
+ import ByteArray from './internal/ByteArray';
3
+ export default class GenericServerPublicParams extends ByteArray {
4
+ private readonly __type?;
5
+ constructor(contents: Buffer);
6
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ //
3
+ // Copyright 2020-2021 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 GenericServerPublicParams extends ByteArray_1.default {
10
+ constructor(contents) {
11
+ super(contents, Native.GenericServerPublicParams_CheckValidContents);
12
+ }
13
+ }
14
+ exports.default = GenericServerPublicParams;
15
+ //# sourceMappingURL=GenericServerPublicParams.js.map
@@ -0,0 +1,10 @@
1
+ /// <reference types="node" />
2
+ import ByteArray from './internal/ByteArray';
3
+ import GenericServerPublicParams from './GenericServerPublicParams';
4
+ export default class GenericServerSecretParams extends ByteArray {
5
+ private readonly __type?;
6
+ static generate(): GenericServerSecretParams;
7
+ static generateWithRandom(random: Buffer): GenericServerSecretParams;
8
+ constructor(contents: Buffer);
9
+ getPublicParams(): GenericServerPublicParams;
10
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ //
3
+ // Copyright 2023 Signal Messenger, LLC.
4
+ // SPDX-License-Identifier: AGPL-3.0-only
5
+ //
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const crypto_1 = require("crypto");
8
+ const Native = require("../../Native");
9
+ const ByteArray_1 = require("./internal/ByteArray");
10
+ const Constants_1 = require("./internal/Constants");
11
+ const GenericServerPublicParams_1 = require("./GenericServerPublicParams");
12
+ class GenericServerSecretParams extends ByteArray_1.default {
13
+ static generate() {
14
+ const random = (0, crypto_1.randomBytes)(Constants_1.RANDOM_LENGTH);
15
+ return GenericServerSecretParams.generateWithRandom(random);
16
+ }
17
+ static generateWithRandom(random) {
18
+ return new GenericServerSecretParams(Native.GenericServerSecretParams_GenerateDeterministic(random));
19
+ }
20
+ constructor(contents) {
21
+ super(contents, Native.GenericServerSecretParams_CheckValidContents);
22
+ }
23
+ getPublicParams() {
24
+ return new GenericServerPublicParams_1.default(Native.GenericServerSecretParams_GetPublicParams(this.contents));
25
+ }
26
+ }
27
+ exports.default = GenericServerSecretParams;
28
+ //# sourceMappingURL=GenericServerSecretParams.js.map
@@ -0,0 +1,12 @@
1
+ /// <reference types="node" />
2
+ import ByteArray from '../internal/ByteArray';
3
+ import CallLinkSecretParams from './CallLinkSecretParams';
4
+ import CallLinkAuthCredentialPresentation from './CallLinkAuthCredentialPresentation';
5
+ import GenericServerPublicParams from '../GenericServerPublicParams';
6
+ import { UUIDType } from '../internal/UUIDUtil';
7
+ export default class CallLinkAuthCredential extends ByteArray {
8
+ private readonly __type?;
9
+ constructor(contents: Buffer);
10
+ present(userId: UUIDType, redemptionTime: number, serverParams: GenericServerPublicParams, callLinkParams: CallLinkSecretParams): CallLinkAuthCredentialPresentation;
11
+ presentWithRandom(userId: UUIDType, redemptionTime: number, serverParams: GenericServerPublicParams, callLinkParams: CallLinkSecretParams, random: Buffer): CallLinkAuthCredentialPresentation;
12
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ //
3
+ // Copyright 2023 Signal Messenger, LLC.
4
+ // SPDX-License-Identifier: AGPL-3.0-only
5
+ //
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const crypto_1 = require("crypto");
8
+ const ByteArray_1 = require("../internal/ByteArray");
9
+ const Constants_1 = require("../internal/Constants");
10
+ const Native = require("../../../Native");
11
+ const CallLinkAuthCredentialPresentation_1 = require("./CallLinkAuthCredentialPresentation");
12
+ const UUIDUtil_1 = require("../internal/UUIDUtil");
13
+ class CallLinkAuthCredential extends ByteArray_1.default {
14
+ constructor(contents) {
15
+ super(contents, Native.CallLinkAuthCredential_CheckValidContents);
16
+ }
17
+ present(userId, redemptionTime, serverParams, callLinkParams) {
18
+ const random = (0, crypto_1.randomBytes)(Constants_1.RANDOM_LENGTH);
19
+ return this.presentWithRandom(userId, redemptionTime, serverParams, callLinkParams, random);
20
+ }
21
+ presentWithRandom(userId, redemptionTime, serverParams, callLinkParams, random) {
22
+ return new CallLinkAuthCredentialPresentation_1.default(Native.CallLinkAuthCredential_PresentDeterministic(this.contents, (0, UUIDUtil_1.fromUUID)(userId), redemptionTime, serverParams.contents, callLinkParams.contents, random));
23
+ }
24
+ }
25
+ exports.default = CallLinkAuthCredential;
26
+ //# sourceMappingURL=CallLinkAuthCredential.js.map
@@ -0,0 +1,11 @@
1
+ /// <reference types="node" />
2
+ import ByteArray from '../internal/ByteArray';
3
+ import CallLinkPublicParams from './CallLinkPublicParams';
4
+ import GenericServerSecretParams from '../GenericServerSecretParams';
5
+ import UuidCiphertext from '../groups/UuidCiphertext';
6
+ export default class CallLinkAuthCredentialPresentation extends ByteArray {
7
+ private readonly __type?;
8
+ constructor(contents: Buffer);
9
+ verify(serverParams: GenericServerSecretParams, callLinkParams: CallLinkPublicParams, now?: Date): void;
10
+ getUserId(): UuidCiphertext;
11
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ //
3
+ // Copyright 2023 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
+ const UuidCiphertext_1 = require("../groups/UuidCiphertext");
10
+ class CallLinkAuthCredentialPresentation extends ByteArray_1.default {
11
+ constructor(contents) {
12
+ super(contents, Native.CallLinkAuthCredentialPresentation_CheckValidContents);
13
+ }
14
+ verify(serverParams, callLinkParams, now = new Date()) {
15
+ Native.CallLinkAuthCredentialPresentation_Verify(this.contents, Math.floor(now.getTime() / 1000), serverParams.contents, callLinkParams.contents);
16
+ }
17
+ getUserId() {
18
+ return new UuidCiphertext_1.default(Native.CallLinkAuthCredentialPresentation_GetUserId(this.contents));
19
+ }
20
+ }
21
+ exports.default = CallLinkAuthCredentialPresentation;
22
+ //# sourceMappingURL=CallLinkAuthCredentialPresentation.js.map
@@ -0,0 +1,13 @@
1
+ /// <reference types="node" />
2
+ import ByteArray from '../internal/ByteArray';
3
+ import { UUIDType } from '../internal/UUIDUtil';
4
+ import GenericServerSecretParams from '../GenericServerSecretParams';
5
+ import GenericServerPublicParams from '../GenericServerPublicParams';
6
+ import CallLinkAuthCredential from './CallLinkAuthCredential';
7
+ export default class CallLinkAuthCredentialResponse extends ByteArray {
8
+ private readonly __type?;
9
+ constructor(contents: Buffer);
10
+ static issueCredential(userId: UUIDType, redemptionTime: number, params: GenericServerSecretParams): CallLinkAuthCredentialResponse;
11
+ static issueCredentialWithRandom(userId: UUIDType, redemptionTime: number, params: GenericServerSecretParams, random: Buffer): CallLinkAuthCredentialResponse;
12
+ receive(userId: UUIDType, redemptionTime: number, params: GenericServerPublicParams): CallLinkAuthCredential;
13
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ //
3
+ // Copyright 2023 Signal Messenger, LLC.
4
+ // SPDX-License-Identifier: AGPL-3.0-only
5
+ //
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const crypto_1 = require("crypto");
8
+ const ByteArray_1 = require("../internal/ByteArray");
9
+ const Native = require("../../../Native");
10
+ const Constants_1 = require("../internal/Constants");
11
+ const UUIDUtil_1 = require("../internal/UUIDUtil");
12
+ const CallLinkAuthCredential_1 = require("./CallLinkAuthCredential");
13
+ class CallLinkAuthCredentialResponse extends ByteArray_1.default {
14
+ constructor(contents) {
15
+ super(contents, Native.CallLinkAuthCredentialResponse_CheckValidContents);
16
+ }
17
+ static issueCredential(userId, redemptionTime, params) {
18
+ const random = (0, crypto_1.randomBytes)(Constants_1.RANDOM_LENGTH);
19
+ return this.issueCredentialWithRandom(userId, redemptionTime, params, random);
20
+ }
21
+ static issueCredentialWithRandom(userId, redemptionTime, params, random) {
22
+ return new CallLinkAuthCredentialResponse(Native.CallLinkAuthCredentialResponse_IssueDeterministic((0, UUIDUtil_1.fromUUID)(userId), redemptionTime, params.contents, random));
23
+ }
24
+ receive(userId, redemptionTime, params) {
25
+ return new CallLinkAuthCredential_1.default(Native.CallLinkAuthCredentialResponse_Receive(this.contents, (0, UUIDUtil_1.fromUUID)(userId), redemptionTime, params.contents));
26
+ }
27
+ }
28
+ exports.default = CallLinkAuthCredentialResponse;
29
+ //# sourceMappingURL=CallLinkAuthCredentialResponse.js.map
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import ByteArray from '../internal/ByteArray';
3
- export default class PniCredential extends ByteArray {
3
+ export default class CallLinkPublicParams extends ByteArray {
4
4
  private readonly __type?;
5
5
  constructor(contents: Buffer);
6
6
  }
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
  //
3
- // Copyright 2020-2021 Signal Messenger, LLC.
3
+ // Copyright 2023 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 ByteArray_1 = require("../internal/ByteArray");
8
8
  const Native = require("../../../Native");
9
- class ProfileKeyCredential extends ByteArray_1.default {
9
+ class CallLinkPublicParams extends ByteArray_1.default {
10
10
  constructor(contents) {
11
- super(contents, Native.ProfileKeyCredential_CheckValidContents);
11
+ super(contents, Native.CallLinkPublicParams_CheckValidContents);
12
12
  }
13
13
  }
14
- exports.default = ProfileKeyCredential;
15
- //# sourceMappingURL=ProfileKeyCredential.js.map
14
+ exports.default = CallLinkPublicParams;
15
+ //# sourceMappingURL=CallLinkPublicParams.js.map
@@ -0,0 +1,12 @@
1
+ /// <reference types="node" />
2
+ import ByteArray from '../internal/ByteArray';
3
+ import CallLinkPublicParams from './CallLinkPublicParams';
4
+ import UuidCiphertext from '../groups/UuidCiphertext';
5
+ import { UUIDType } from '../internal/UUIDUtil';
6
+ export default class CallLinkSecretParams extends ByteArray {
7
+ private readonly __type?;
8
+ static deriveFromRootKey(callLinkRootKey: Buffer): CallLinkSecretParams;
9
+ constructor(contents: Buffer);
10
+ getPublicParams(): CallLinkPublicParams;
11
+ decryptUserId(userId: UuidCiphertext): UUIDType;
12
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ //
3
+ // Copyright 2023 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
+ const CallLinkPublicParams_1 = require("./CallLinkPublicParams");
10
+ const UUIDUtil_1 = require("../internal/UUIDUtil");
11
+ class CallLinkSecretParams extends ByteArray_1.default {
12
+ static deriveFromRootKey(callLinkRootKey) {
13
+ return new CallLinkSecretParams(Native.CallLinkSecretParams_DeriveFromRootKey(callLinkRootKey));
14
+ }
15
+ constructor(contents) {
16
+ super(contents, Native.CallLinkSecretParams_CheckValidContents);
17
+ }
18
+ getPublicParams() {
19
+ return new CallLinkPublicParams_1.default(Native.CallLinkSecretParams_GetPublicParams(this.contents));
20
+ }
21
+ decryptUserId(userId) {
22
+ return (0, UUIDUtil_1.toUUID)(Native.CallLinkSecretParams_DecryptUserId(this.contents, userId.contents));
23
+ }
24
+ }
25
+ exports.default = CallLinkSecretParams;
26
+ //# sourceMappingURL=CallLinkSecretParams.js.map
@@ -0,0 +1,12 @@
1
+ /// <reference types="node" />
2
+ import ByteArray from '../internal/ByteArray';
3
+ import CallLinkSecretParams from './CallLinkSecretParams';
4
+ import CreateCallLinkCredentialPresentation from './CreateCallLinkCredentialPresentation';
5
+ import GenericServerPublicParams from '../GenericServerPublicParams';
6
+ import { UUIDType } from '../internal/UUIDUtil';
7
+ export default class CreateCallLinkCredential extends ByteArray {
8
+ private readonly __type?;
9
+ constructor(contents: Buffer);
10
+ present(roomId: Buffer, userId: UUIDType, serverParams: GenericServerPublicParams, callLinkParams: CallLinkSecretParams): CreateCallLinkCredentialPresentation;
11
+ presentWithRandom(roomId: Buffer, userId: UUIDType, serverParams: GenericServerPublicParams, callLinkParams: CallLinkSecretParams, random: Buffer): CreateCallLinkCredentialPresentation;
12
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ //
3
+ // Copyright 2023 Signal Messenger, LLC.
4
+ // SPDX-License-Identifier: AGPL-3.0-only
5
+ //
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const crypto_1 = require("crypto");
8
+ const ByteArray_1 = require("../internal/ByteArray");
9
+ const Constants_1 = require("../internal/Constants");
10
+ const Native = require("../../../Native");
11
+ const CreateCallLinkCredentialPresentation_1 = require("./CreateCallLinkCredentialPresentation");
12
+ const UUIDUtil_1 = require("../internal/UUIDUtil");
13
+ class CreateCallLinkCredential extends ByteArray_1.default {
14
+ constructor(contents) {
15
+ super(contents, Native.CreateCallLinkCredential_CheckValidContents);
16
+ }
17
+ present(roomId, userId, serverParams, callLinkParams) {
18
+ const random = (0, crypto_1.randomBytes)(Constants_1.RANDOM_LENGTH);
19
+ return this.presentWithRandom(roomId, userId, serverParams, callLinkParams, random);
20
+ }
21
+ presentWithRandom(roomId, userId, serverParams, callLinkParams, random) {
22
+ return new CreateCallLinkCredentialPresentation_1.default(Native.CreateCallLinkCredential_PresentDeterministic(this.contents, roomId, (0, UUIDUtil_1.fromUUID)(userId), serverParams.contents, callLinkParams.contents, random));
23
+ }
24
+ }
25
+ exports.default = CreateCallLinkCredential;
26
+ //# sourceMappingURL=CreateCallLinkCredential.js.map
@@ -0,0 +1,9 @@
1
+ /// <reference types="node" />
2
+ import ByteArray from '../internal/ByteArray';
3
+ import CallLinkPublicParams from './CallLinkPublicParams';
4
+ import GenericServerSecretParams from '../GenericServerSecretParams';
5
+ export default class CreateCallLinkCredentialPresentation extends ByteArray {
6
+ private readonly __type?;
7
+ constructor(contents: Buffer);
8
+ verify(roomId: Buffer, serverParams: GenericServerSecretParams, callLinkParams: CallLinkPublicParams, now?: Date): void;
9
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ //
3
+ // Copyright 2023 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 CreateCallLinkCredentialPresentation extends ByteArray_1.default {
10
+ constructor(contents) {
11
+ super(contents, Native.CreateCallLinkCredentialPresentation_CheckValidContents);
12
+ }
13
+ verify(roomId, serverParams, callLinkParams, now = new Date()) {
14
+ Native.CreateCallLinkCredentialPresentation_Verify(this.contents, roomId, Math.floor(now.getTime() / 1000), serverParams.contents, callLinkParams.contents);
15
+ }
16
+ }
17
+ exports.default = CreateCallLinkCredentialPresentation;
18
+ //# sourceMappingURL=CreateCallLinkCredentialPresentation.js.map
@@ -0,0 +1,11 @@
1
+ /// <reference types="node" />
2
+ import ByteArray from '../internal/ByteArray';
3
+ import CreateCallLinkCredentialResponse from './CreateCallLinkCredentialResponse';
4
+ import GenericServerSecretParams from '../GenericServerSecretParams';
5
+ import { UUIDType } from '../internal/UUIDUtil';
6
+ export default class CreateCallLinkCredentialRequest extends ByteArray {
7
+ private readonly __type?;
8
+ constructor(contents: Buffer);
9
+ issueCredential(userId: UUIDType, timestamp: number, params: GenericServerSecretParams): CreateCallLinkCredentialResponse;
10
+ issueCredentialWithRandom(userId: UUIDType, timestamp: number, params: GenericServerSecretParams, random: Buffer): CreateCallLinkCredentialResponse;
11
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ //
3
+ // Copyright 2023 Signal Messenger, LLC.
4
+ // SPDX-License-Identifier: AGPL-3.0-only
5
+ //
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const crypto_1 = require("crypto");
8
+ const ByteArray_1 = require("../internal/ByteArray");
9
+ const Constants_1 = require("../internal/Constants");
10
+ const Native = require("../../../Native");
11
+ const CreateCallLinkCredentialResponse_1 = require("./CreateCallLinkCredentialResponse");
12
+ const UUIDUtil_1 = require("../internal/UUIDUtil");
13
+ class CreateCallLinkCredentialRequest extends ByteArray_1.default {
14
+ constructor(contents) {
15
+ super(contents, Native.CreateCallLinkCredentialRequest_CheckValidContents);
16
+ }
17
+ issueCredential(userId, timestamp, params) {
18
+ const random = (0, crypto_1.randomBytes)(Constants_1.RANDOM_LENGTH);
19
+ return this.issueCredentialWithRandom(userId, timestamp, params, random);
20
+ }
21
+ issueCredentialWithRandom(userId, timestamp, params, random) {
22
+ return new CreateCallLinkCredentialResponse_1.default(Native.CreateCallLinkCredentialRequest_IssueDeterministic(this.contents, (0, UUIDUtil_1.fromUUID)(userId), timestamp, params.contents, random));
23
+ }
24
+ }
25
+ exports.default = CreateCallLinkCredentialRequest;
26
+ //# sourceMappingURL=CreateCallLinkCredentialRequest.js.map
@@ -0,0 +1,15 @@
1
+ /// <reference types="node" />
2
+ import ByteArray from '../internal/ByteArray';
3
+ import CreateCallLinkCredentialRequest from './CreateCallLinkCredentialRequest';
4
+ import CreateCallLinkCredentialResponse from './CreateCallLinkCredentialResponse';
5
+ import CreateCallLinkCredential from './CreateCallLinkCredential';
6
+ import GenericServerPublicParams from '../GenericServerPublicParams';
7
+ import { UUIDType } from '../internal/UUIDUtil';
8
+ export default class CreateCallLinkCredentialRequestContext extends ByteArray {
9
+ private readonly __type?;
10
+ constructor(contents: Buffer);
11
+ static forRoomId(roomId: Buffer): CreateCallLinkCredentialRequestContext;
12
+ static forRoomIdWithRandom(roomId: Buffer, random: Buffer): CreateCallLinkCredentialRequestContext;
13
+ getRequest(): CreateCallLinkCredentialRequest;
14
+ receive(response: CreateCallLinkCredentialResponse, userId: UUIDType, params: GenericServerPublicParams): CreateCallLinkCredential;
15
+ }