@signalapp/libsignal-client 0.62.0 → 0.63.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Native.d.ts +83 -60
- package/dist/MessageBackup.d.ts +51 -0
- package/dist/MessageBackup.js +58 -1
- package/dist/acknowledgments.md +104 -1
- package/dist/net.d.ts +77 -2
- package/dist/net.js +149 -17
- package/dist/zkgroup/auth/ServerZkAuthOperations.d.ts +6 -0
- package/dist/zkgroup/auth/ServerZkAuthOperations.js +6 -0
- package/package.json +1 -1
- package/prebuilds/darwin-arm64/@signalapp+libsignal-client.node +0 -0
- package/prebuilds/darwin-x64/@signalapp+libsignal-client.node +0 -0
- package/prebuilds/linux-arm64/@signalapp+libsignal-client.node +0 -0
- package/prebuilds/linux-x64/@signalapp+libsignal-client.node +0 -0
- package/prebuilds/win32-arm64/@signalapp+libsignal-client.node +0 -0
- package/prebuilds/win32-x64/@signalapp+libsignal-client.node +0 -0
package/Native.d.ts
CHANGED
|
@@ -11,50 +11,53 @@ type Uuid = Buffer;
|
|
|
11
11
|
/// what's important is that it's an integer less than Number.MAX_SAFE_INTEGER.
|
|
12
12
|
type Timestamp = number;
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
// Rust code produces or consumes values that conform to these interface
|
|
15
|
+
// definitions. They must be kept in sync to prevent bridging errors.
|
|
16
|
+
|
|
17
|
+
type LookupResponse = {
|
|
15
18
|
entries: Map<string, LookupResponseEntry>;
|
|
16
19
|
debugPermitsUsed: number;
|
|
17
|
-
}
|
|
20
|
+
};
|
|
18
21
|
|
|
19
|
-
|
|
22
|
+
type LookupResponseEntry = {
|
|
20
23
|
readonly aci: string | undefined;
|
|
21
24
|
readonly pni: string | undefined;
|
|
22
|
-
}
|
|
25
|
+
};
|
|
23
26
|
|
|
24
|
-
|
|
27
|
+
type ChatResponse = {
|
|
25
28
|
status: number;
|
|
26
29
|
message: string | undefined;
|
|
27
30
|
headers: ReadonlyArray<[string, string]>;
|
|
28
31
|
body: Buffer | undefined;
|
|
29
|
-
}
|
|
32
|
+
};
|
|
30
33
|
|
|
31
|
-
|
|
34
|
+
type ChatServiceDebugInfo = {
|
|
32
35
|
ipType: number;
|
|
33
36
|
durationMillis: number;
|
|
34
37
|
connectionInfo: string;
|
|
35
|
-
}
|
|
38
|
+
};
|
|
36
39
|
|
|
37
|
-
|
|
40
|
+
type ResponseAndDebugInfo = {
|
|
38
41
|
response: ChatResponse;
|
|
39
42
|
debugInfo: ChatServiceDebugInfo;
|
|
40
|
-
}
|
|
43
|
+
};
|
|
41
44
|
|
|
42
|
-
|
|
45
|
+
type SealedSenderMultiRecipientMessageRecipient = {
|
|
43
46
|
deviceIds: number[];
|
|
44
47
|
registrationIds: number[];
|
|
45
48
|
rangeOffset: number;
|
|
46
49
|
rangeLen: number;
|
|
47
|
-
}
|
|
50
|
+
};
|
|
48
51
|
|
|
49
|
-
|
|
52
|
+
type SealedSenderMultiRecipientMessage = {
|
|
50
53
|
recipientMap: {
|
|
51
54
|
[serviceId: string]: SealedSenderMultiRecipientMessageRecipient;
|
|
52
55
|
};
|
|
53
56
|
excludedRecipients: string[];
|
|
54
57
|
offsetOfSharedData: number;
|
|
55
|
-
}
|
|
58
|
+
};
|
|
56
59
|
|
|
57
|
-
|
|
60
|
+
type IdentityKeyStore = {
|
|
58
61
|
_getIdentityKey(): Promise<PrivateKey>;
|
|
59
62
|
_getLocalRegistrationId(): Promise<number>;
|
|
60
63
|
_saveIdentity(name: ProtocolAddress, key: PublicKey): Promise<boolean>;
|
|
@@ -64,37 +67,37 @@ export abstract class IdentityKeyStore {
|
|
|
64
67
|
sending: boolean
|
|
65
68
|
): Promise<boolean>;
|
|
66
69
|
_getIdentity(name: ProtocolAddress): Promise<PublicKey | null>;
|
|
67
|
-
}
|
|
70
|
+
};
|
|
68
71
|
|
|
69
|
-
|
|
72
|
+
type SessionStore = {
|
|
70
73
|
_saveSession(addr: ProtocolAddress, record: SessionRecord): Promise<void>;
|
|
71
74
|
_getSession(addr: ProtocolAddress): Promise<SessionRecord | null>;
|
|
72
|
-
}
|
|
75
|
+
};
|
|
73
76
|
|
|
74
|
-
|
|
77
|
+
type PreKeyStore = {
|
|
75
78
|
_savePreKey(preKeyId: number, record: PreKeyRecord): Promise<void>;
|
|
76
79
|
_getPreKey(preKeyId: number): Promise<PreKeyRecord>;
|
|
77
80
|
_removePreKey(preKeyId: number): Promise<void>;
|
|
78
|
-
}
|
|
81
|
+
};
|
|
79
82
|
|
|
80
|
-
|
|
83
|
+
type SignedPreKeyStore = {
|
|
81
84
|
_saveSignedPreKey(
|
|
82
85
|
signedPreKeyId: number,
|
|
83
86
|
record: SignedPreKeyRecord
|
|
84
87
|
): Promise<void>;
|
|
85
88
|
_getSignedPreKey(signedPreKeyId: number): Promise<SignedPreKeyRecord>;
|
|
86
|
-
}
|
|
89
|
+
};
|
|
87
90
|
|
|
88
|
-
|
|
91
|
+
type KyberPreKeyStore = {
|
|
89
92
|
_saveKyberPreKey(
|
|
90
93
|
kyberPreKeyId: number,
|
|
91
94
|
record: KyberPreKeyRecord
|
|
92
95
|
): Promise<void>;
|
|
93
96
|
_getKyberPreKey(kyberPreKeyId: number): Promise<KyberPreKeyRecord>;
|
|
94
97
|
_markKyberPreKeyUsed(kyberPreKeyId: number): Promise<void>;
|
|
95
|
-
}
|
|
98
|
+
};
|
|
96
99
|
|
|
97
|
-
|
|
100
|
+
type SenderKeyStore = {
|
|
98
101
|
_saveSenderKey(
|
|
99
102
|
sender: ProtocolAddress,
|
|
100
103
|
distributionId: Uuid,
|
|
@@ -104,16 +107,16 @@ export abstract class SenderKeyStore {
|
|
|
104
107
|
sender: ProtocolAddress,
|
|
105
108
|
distributionId: Uuid
|
|
106
109
|
): Promise<SenderKeyRecord | null>;
|
|
107
|
-
}
|
|
110
|
+
};
|
|
108
111
|
|
|
109
|
-
|
|
112
|
+
type InputStream = {
|
|
110
113
|
_read(amount: number): Promise<Buffer>;
|
|
111
114
|
_skip(amount: number): Promise<void>;
|
|
112
|
-
}
|
|
115
|
+
};
|
|
113
116
|
|
|
114
|
-
|
|
117
|
+
type SyncInputStream = Buffer;
|
|
115
118
|
|
|
116
|
-
|
|
119
|
+
type ChatListener = {
|
|
117
120
|
_incoming_message(
|
|
118
121
|
envelope: Buffer,
|
|
119
122
|
timestamp: number,
|
|
@@ -124,16 +127,20 @@ export abstract class ChatListener {
|
|
|
124
127
|
// A LibSignalError or null, but not naming the type to avoid circular import dependencies.
|
|
125
128
|
reason: Error | null
|
|
126
129
|
): void;
|
|
127
|
-
}
|
|
130
|
+
};
|
|
128
131
|
|
|
129
132
|
type Wrapper<T> = Readonly<{
|
|
130
133
|
_nativeHandle: T;
|
|
131
134
|
}>;
|
|
132
135
|
|
|
133
|
-
|
|
136
|
+
type MessageBackupValidationOutcome = {
|
|
134
137
|
errorMessage: string | null;
|
|
135
138
|
unknownFieldMessages: Array<string>;
|
|
136
|
-
}
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
type CancellablePromise<T> = Promise<T> & {
|
|
142
|
+
_cancellationToken: bigint;
|
|
143
|
+
};
|
|
137
144
|
|
|
138
145
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
139
146
|
type Serialized<T> = Buffer;
|
|
@@ -153,6 +160,10 @@ export function AuthCredentialPresentation_GetRedemptionTime(presentationBytes:
|
|
|
153
160
|
export function AuthCredentialPresentation_GetUuidCiphertext(presentationBytes: Buffer): Serialized<UuidCiphertext>;
|
|
154
161
|
export function AuthCredentialWithPniResponse_CheckValidContents(bytes: Buffer): void;
|
|
155
162
|
export function AuthCredentialWithPni_CheckValidContents(bytes: Buffer): void;
|
|
163
|
+
export function AuthenticatedChatConnection_connect(asyncRuntime: Wrapper<TokioAsyncContext>, connectionManager: Wrapper<ConnectionManager>, username: string, password: string, receiveStories: boolean, listener: ChatListener | null): CancellablePromise<AuthenticatedChatConnection>;
|
|
164
|
+
export function AuthenticatedChatConnection_disconnect(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<AuthenticatedChatConnection>): CancellablePromise<void>;
|
|
165
|
+
export function AuthenticatedChatConnection_info(chat: Wrapper<AuthenticatedChatConnection>): ConnectionInfo;
|
|
166
|
+
export function AuthenticatedChatConnection_send(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<AuthenticatedChatConnection>, httpRequest: Wrapper<HttpRequest>, timeoutMillis: number): CancellablePromise<ChatResponse>;
|
|
156
167
|
export function BackupAuthCredentialPresentation_CheckValidContents(presentationBytes: Buffer): void;
|
|
157
168
|
export function BackupAuthCredentialPresentation_GetBackupId(presentationBytes: Buffer): Buffer;
|
|
158
169
|
export function BackupAuthCredentialPresentation_GetBackupLevel(presentationBytes: Buffer): number;
|
|
@@ -190,27 +201,29 @@ export function CallLinkSecretParams_DecryptUserId(paramsBytes: Buffer, userId:
|
|
|
190
201
|
export function CallLinkSecretParams_DeriveFromRootKey(rootKey: Buffer): Buffer;
|
|
191
202
|
export function CallLinkSecretParams_GetPublicParams(paramsBytes: Buffer): Buffer;
|
|
192
203
|
export function Cds2ClientState_New(mrenclave: Buffer, attestationMsg: Buffer, currentTimestamp: Timestamp): SgxClientState;
|
|
193
|
-
export function CdsiLookup_complete(asyncRuntime: Wrapper<TokioAsyncContext>, lookup: Wrapper<CdsiLookup>):
|
|
194
|
-
export function CdsiLookup_new(asyncRuntime: Wrapper<TokioAsyncContext>, connectionManager: Wrapper<ConnectionManager>, username: string, password: string, request: Wrapper<LookupRequest>):
|
|
204
|
+
export function CdsiLookup_complete(asyncRuntime: Wrapper<TokioAsyncContext>, lookup: Wrapper<CdsiLookup>): CancellablePromise<LookupResponse>;
|
|
205
|
+
export function CdsiLookup_new(asyncRuntime: Wrapper<TokioAsyncContext>, connectionManager: Wrapper<ConnectionManager>, username: string, password: string, request: Wrapper<LookupRequest>): CancellablePromise<CdsiLookup>;
|
|
195
206
|
export function CdsiLookup_token(lookup: Wrapper<CdsiLookup>): Buffer;
|
|
196
207
|
export function ChatService_SetListenerAuth(runtime: Wrapper<TokioAsyncContext>, chat: Wrapper<AuthChat>, listener: ChatListener | null): void;
|
|
197
208
|
export function ChatService_SetListenerUnauth(runtime: Wrapper<TokioAsyncContext>, chat: Wrapper<UnauthChat>, listener: ChatListener | null): void;
|
|
198
|
-
export function ChatService_auth_send(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<AuthChat>, httpRequest: Wrapper<HttpRequest>, timeoutMillis: number):
|
|
199
|
-
export function ChatService_auth_send_and_debug(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<AuthChat>, httpRequest: Wrapper<HttpRequest>, timeoutMillis: number):
|
|
200
|
-
export function ChatService_connect_auth(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<AuthChat>):
|
|
201
|
-
export function ChatService_connect_unauth(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<UnauthChat>):
|
|
202
|
-
export function ChatService_disconnect_auth(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<AuthChat>):
|
|
203
|
-
export function ChatService_disconnect_unauth(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<UnauthChat>):
|
|
209
|
+
export function ChatService_auth_send(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<AuthChat>, httpRequest: Wrapper<HttpRequest>, timeoutMillis: number): CancellablePromise<ChatResponse>;
|
|
210
|
+
export function ChatService_auth_send_and_debug(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<AuthChat>, httpRequest: Wrapper<HttpRequest>, timeoutMillis: number): CancellablePromise<ResponseAndDebugInfo>;
|
|
211
|
+
export function ChatService_connect_auth(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<AuthChat>): CancellablePromise<ChatServiceDebugInfo>;
|
|
212
|
+
export function ChatService_connect_unauth(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<UnauthChat>): CancellablePromise<ChatServiceDebugInfo>;
|
|
213
|
+
export function ChatService_disconnect_auth(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<AuthChat>): CancellablePromise<void>;
|
|
214
|
+
export function ChatService_disconnect_unauth(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<UnauthChat>): CancellablePromise<void>;
|
|
204
215
|
export function ChatService_new_auth(connectionManager: Wrapper<ConnectionManager>, username: string, password: string, receiveStories: boolean): AuthChat;
|
|
205
216
|
export function ChatService_new_unauth(connectionManager: Wrapper<ConnectionManager>): UnauthChat;
|
|
206
|
-
export function ChatService_unauth_send(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<UnauthChat>, httpRequest: Wrapper<HttpRequest>, timeoutMillis: number):
|
|
207
|
-
export function ChatService_unauth_send_and_debug(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<UnauthChat>, httpRequest: Wrapper<HttpRequest>, timeoutMillis: number):
|
|
217
|
+
export function ChatService_unauth_send(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<UnauthChat>, httpRequest: Wrapper<HttpRequest>, timeoutMillis: number): CancellablePromise<ChatResponse>;
|
|
218
|
+
export function ChatService_unauth_send_and_debug(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<UnauthChat>, httpRequest: Wrapper<HttpRequest>, timeoutMillis: number): CancellablePromise<ResponseAndDebugInfo>;
|
|
208
219
|
export function CiphertextMessage_FromPlaintextContent(m: Wrapper<PlaintextContent>): CiphertextMessage;
|
|
209
220
|
export function CiphertextMessage_Serialize(obj: Wrapper<CiphertextMessage>): Buffer;
|
|
210
221
|
export function CiphertextMessage_Type(msg: Wrapper<CiphertextMessage>): number;
|
|
211
222
|
export function ComparableBackup_GetComparableString(backup: Wrapper<ComparableBackup>): string;
|
|
212
223
|
export function ComparableBackup_GetUnknownFields(backup: Wrapper<ComparableBackup>): string[];
|
|
213
224
|
export function ComparableBackup_ReadUnencrypted(stream: InputStream, len: bigint, purpose: number): Promise<ComparableBackup>;
|
|
225
|
+
export function ConnectionInfo_ip_version(connectionInfo: Wrapper<ConnectionInfo>): number;
|
|
226
|
+
export function ConnectionInfo_local_port(connectionInfo: Wrapper<ConnectionInfo>): number;
|
|
214
227
|
export function ConnectionManager_clear_proxy(connectionManager: Wrapper<ConnectionManager>): void;
|
|
215
228
|
export function ConnectionManager_new(environment: number, userAgent: string): ConnectionManager;
|
|
216
229
|
export function ConnectionManager_on_network_change(connectionManager: Wrapper<ConnectionManager>): void;
|
|
@@ -316,7 +329,6 @@ export function LookupRequest_addAciAndAccessKey(request: Wrapper<LookupRequest>
|
|
|
316
329
|
export function LookupRequest_addE164(request: Wrapper<LookupRequest>, e164: string): void;
|
|
317
330
|
export function LookupRequest_addPreviousE164(request: Wrapper<LookupRequest>, e164: string): void;
|
|
318
331
|
export function LookupRequest_new(): LookupRequest;
|
|
319
|
-
export function LookupRequest_setReturnAcisWithoutUaks(request: Wrapper<LookupRequest>, returnAcisWithoutUaks: boolean): void;
|
|
320
332
|
export function LookupRequest_setToken(request: Wrapper<LookupRequest>, token: Buffer): void;
|
|
321
333
|
export function MessageBackupKey_FromAccountEntropyPool(accountEntropy: string, aci: Buffer): MessageBackupKey;
|
|
322
334
|
export function MessageBackupKey_FromBackupKeyAndBackupId(backupKey: Buffer, backupId: Buffer): MessageBackupKey;
|
|
@@ -326,6 +338,9 @@ export function MessageBackupKey_GetHmacKey(key: Wrapper<MessageBackupKey>): Buf
|
|
|
326
338
|
export function MessageBackupValidator_Validate(key: Wrapper<MessageBackupKey>, firstStream: InputStream, secondStream: InputStream, len: bigint, purpose: number): Promise<MessageBackupValidationOutcome>;
|
|
327
339
|
export function MinidumpToJSONString(buffer: Buffer): string;
|
|
328
340
|
export function Mp4Sanitizer_Sanitize(input: InputStream, len: bigint): Promise<SanitizedMetadata>;
|
|
341
|
+
export function OnlineBackupValidator_AddFrame(backup: Wrapper<OnlineBackupValidator>, frame: Buffer): void;
|
|
342
|
+
export function OnlineBackupValidator_Finalize(backup: Wrapper<OnlineBackupValidator>): void;
|
|
343
|
+
export function OnlineBackupValidator_New(backupInfoFrame: Buffer, purpose: number): OnlineBackupValidator;
|
|
329
344
|
export function PlaintextContent_Deserialize(data: Buffer): PlaintextContent;
|
|
330
345
|
export function PlaintextContent_FromDecryptionErrorMessage(m: Wrapper<DecryptionErrorMessage>): PlaintextContent;
|
|
331
346
|
export function PlaintextContent_GetBody(obj: Wrapper<PlaintextContent>): Buffer;
|
|
@@ -445,7 +460,7 @@ export function ServerCertificate_GetKeyId(obj: Wrapper<ServerCertificate>): num
|
|
|
445
460
|
export function ServerCertificate_GetSerialized(obj: Wrapper<ServerCertificate>): Buffer;
|
|
446
461
|
export function ServerCertificate_GetSignature(obj: Wrapper<ServerCertificate>): Buffer;
|
|
447
462
|
export function ServerCertificate_New(keyId: number, serverKey: Wrapper<PublicKey>, trustRoot: Wrapper<PrivateKey>): ServerCertificate;
|
|
448
|
-
export function ServerMessageAck_SendStatus(asyncRuntime: Wrapper<TokioAsyncContext>, ack: Wrapper<ServerMessageAck>, status: number):
|
|
463
|
+
export function ServerMessageAck_SendStatus(asyncRuntime: Wrapper<TokioAsyncContext>, ack: Wrapper<ServerMessageAck>, status: number): CancellablePromise<void>;
|
|
449
464
|
export function ServerPublicParams_CreateAuthCredentialWithPniPresentationDeterministic(serverPublicParams: Wrapper<ServerPublicParams>, randomness: Buffer, groupSecretParams: Serialized<GroupSecretParams>, authCredentialWithPniBytes: Buffer): Buffer;
|
|
450
465
|
export function ServerPublicParams_CreateExpiringProfileKeyCredentialPresentationDeterministic(serverPublicParams: Wrapper<ServerPublicParams>, randomness: Buffer, groupSecretParams: Serialized<GroupSecretParams>, profileKeyCredential: Serialized<ExpiringProfileKeyCredential>): Buffer;
|
|
451
466
|
export function ServerPublicParams_CreateProfileKeyCredentialRequestContextDeterministic(serverPublicParams: Wrapper<ServerPublicParams>, randomness: Buffer, userId: Buffer, profileKey: Serialized<ProfileKey>): Serialized<ProfileKeyCredentialRequestContext>;
|
|
@@ -505,11 +520,11 @@ export function SignedPreKeyRecord_GetSignature(obj: Wrapper<SignedPreKeyRecord>
|
|
|
505
520
|
export function SignedPreKeyRecord_GetTimestamp(obj: Wrapper<SignedPreKeyRecord>): Timestamp;
|
|
506
521
|
export function SignedPreKeyRecord_New(id: number, timestamp: Timestamp, pubKey: Wrapper<PublicKey>, privKey: Wrapper<PrivateKey>, signature: Buffer): SignedPreKeyRecord;
|
|
507
522
|
export function SignedPreKeyRecord_Serialize(obj: Wrapper<SignedPreKeyRecord>): Buffer;
|
|
508
|
-
export function Svr3Backup(asyncRuntime: Wrapper<TokioAsyncContext>, connectionManager: Wrapper<ConnectionManager>, secret: Buffer, password: string, maxTries: number, username: string, enclavePassword: string):
|
|
509
|
-
export function Svr3Remove(asyncRuntime: Wrapper<TokioAsyncContext>, connectionManager: Wrapper<ConnectionManager>, username: string, enclavePassword: string):
|
|
510
|
-
export function Svr3Restore(asyncRuntime: Wrapper<TokioAsyncContext>, connectionManager: Wrapper<ConnectionManager>, password: string, shareSet: Buffer, username: string, enclavePassword: string):
|
|
523
|
+
export function Svr3Backup(asyncRuntime: Wrapper<TokioAsyncContext>, connectionManager: Wrapper<ConnectionManager>, secret: Buffer, password: string, maxTries: number, username: string, enclavePassword: string): CancellablePromise<Buffer>;
|
|
524
|
+
export function Svr3Remove(asyncRuntime: Wrapper<TokioAsyncContext>, connectionManager: Wrapper<ConnectionManager>, username: string, enclavePassword: string): CancellablePromise<void>;
|
|
525
|
+
export function Svr3Restore(asyncRuntime: Wrapper<TokioAsyncContext>, connectionManager: Wrapper<ConnectionManager>, password: string, shareSet: Buffer, username: string, enclavePassword: string): CancellablePromise<Buffer>;
|
|
511
526
|
export function TESTING_CdsiLookupErrorConvert(errorDescription: string): void;
|
|
512
|
-
export function TESTING_CdsiLookupResponseConvert(asyncRuntime: Wrapper<TokioAsyncContext>):
|
|
527
|
+
export function TESTING_CdsiLookupResponseConvert(asyncRuntime: Wrapper<TokioAsyncContext>): CancellablePromise<LookupResponse>;
|
|
513
528
|
export function TESTING_ChatRequestGetBody(request: Wrapper<HttpRequest>): Buffer;
|
|
514
529
|
export function TESTING_ChatRequestGetHeaderValue(request: Wrapper<HttpRequest>, headerName: string): string;
|
|
515
530
|
export function TESTING_ChatRequestGetMethod(request: Wrapper<HttpRequest>): string;
|
|
@@ -523,30 +538,30 @@ export function TESTING_ChatService_InjectIntentionalDisconnect(chat: Wrapper<Au
|
|
|
523
538
|
export function TESTING_ChatService_InjectRawServerRequest(chat: Wrapper<AuthChat>, bytes: Buffer): void;
|
|
524
539
|
export function TESTING_ConnectionManager_newLocalOverride(userAgent: string, chatPort: number, cdsiPort: number, svr2Port: number, svr3SgxPort: number, svr3NitroPort: number, svr3Tpm2SnpPort: number, rootCertificateDer: Buffer): ConnectionManager;
|
|
525
540
|
export function TESTING_ErrorOnBorrowAsync(_input: null): Promise<void>;
|
|
526
|
-
export function TESTING_ErrorOnBorrowIo(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, _input: null):
|
|
541
|
+
export function TESTING_ErrorOnBorrowIo(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, _input: null): CancellablePromise<void>;
|
|
527
542
|
export function TESTING_ErrorOnBorrowSync(_input: null): void;
|
|
528
543
|
export function TESTING_ErrorOnReturnAsync(_needsCleanup: null): Promise<null>;
|
|
529
|
-
export function TESTING_ErrorOnReturnIo(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, _needsCleanup: null):
|
|
544
|
+
export function TESTING_ErrorOnReturnIo(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, _needsCleanup: null): CancellablePromise<null>;
|
|
530
545
|
export function TESTING_ErrorOnReturnSync(_needsCleanup: null): null;
|
|
531
|
-
export function TESTING_FutureFailure(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, _input: number):
|
|
532
|
-
export function TESTING_FutureProducesOtherPointerType(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, input: string):
|
|
533
|
-
export function TESTING_FutureProducesPointerType(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, input: number):
|
|
534
|
-
export function TESTING_FutureSuccess(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, input: number):
|
|
546
|
+
export function TESTING_FutureFailure(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, _input: number): CancellablePromise<number>;
|
|
547
|
+
export function TESTING_FutureProducesOtherPointerType(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, input: string): CancellablePromise<OtherTestingHandleType>;
|
|
548
|
+
export function TESTING_FutureProducesPointerType(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, input: number): CancellablePromise<TestingHandleType>;
|
|
549
|
+
export function TESTING_FutureSuccess(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, input: number): CancellablePromise<number>;
|
|
535
550
|
export function TESTING_InputStreamReadIntoZeroLengthSlice(capsAlphabetInput: InputStream): Promise<Buffer>;
|
|
536
551
|
export function TESTING_NonSuspendingBackgroundThreadRuntime_New(): NonSuspendingBackgroundThreadRuntime;
|
|
537
|
-
export function TESTING_OnlyCompletesByCancellation(asyncRuntime: Wrapper<TokioAsyncContext>):
|
|
552
|
+
export function TESTING_OnlyCompletesByCancellation(asyncRuntime: Wrapper<TokioAsyncContext>): CancellablePromise<void>;
|
|
538
553
|
export function TESTING_OtherTestingHandleType_getValue(handle: Wrapper<OtherTestingHandleType>): string;
|
|
539
554
|
export function TESTING_PanicInBodyAsync(_input: null): Promise<void>;
|
|
540
|
-
export function TESTING_PanicInBodyIo(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, _input: null):
|
|
555
|
+
export function TESTING_PanicInBodyIo(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, _input: null): CancellablePromise<void>;
|
|
541
556
|
export function TESTING_PanicInBodySync(_input: null): void;
|
|
542
557
|
export function TESTING_PanicOnBorrowAsync(_input: null): Promise<void>;
|
|
543
|
-
export function TESTING_PanicOnBorrowIo(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, _input: null):
|
|
558
|
+
export function TESTING_PanicOnBorrowIo(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, _input: null): CancellablePromise<void>;
|
|
544
559
|
export function TESTING_PanicOnBorrowSync(_input: null): void;
|
|
545
560
|
export function TESTING_PanicOnLoadAsync(_needsCleanup: null, _input: null): Promise<void>;
|
|
546
|
-
export function TESTING_PanicOnLoadIo(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, _needsCleanup: null, _input: null):
|
|
561
|
+
export function TESTING_PanicOnLoadIo(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, _needsCleanup: null, _input: null): CancellablePromise<void>;
|
|
547
562
|
export function TESTING_PanicOnLoadSync(_needsCleanup: null, _input: null): void;
|
|
548
563
|
export function TESTING_PanicOnReturnAsync(_needsCleanup: null): Promise<null>;
|
|
549
|
-
export function TESTING_PanicOnReturnIo(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, _needsCleanup: null):
|
|
564
|
+
export function TESTING_PanicOnReturnIo(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, _needsCleanup: null): CancellablePromise<null>;
|
|
550
565
|
export function TESTING_PanicOnReturnSync(_needsCleanup: null): null;
|
|
551
566
|
export function TESTING_ProcessBytestringArray(input: Buffer[]): Buffer[];
|
|
552
567
|
export function TESTING_ReturnStringArray(): string[];
|
|
@@ -554,6 +569,10 @@ export function TESTING_ServerMessageAck_Create(): ServerMessageAck;
|
|
|
554
569
|
export function TESTING_TestingHandleType_getValue(handle: Wrapper<TestingHandleType>): number;
|
|
555
570
|
export function TokioAsyncContext_cancel(context: Wrapper<TokioAsyncContext>, rawCancellationId: bigint): void;
|
|
556
571
|
export function TokioAsyncContext_new(): TokioAsyncContext;
|
|
572
|
+
export function UnauthenticatedChatConnection_connect(asyncRuntime: Wrapper<TokioAsyncContext>, connectionManager: Wrapper<ConnectionManager>, listener: ChatListener | null): CancellablePromise<UnauthenticatedChatConnection>;
|
|
573
|
+
export function UnauthenticatedChatConnection_disconnect(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<UnauthenticatedChatConnection>): CancellablePromise<void>;
|
|
574
|
+
export function UnauthenticatedChatConnection_info(chat: Wrapper<UnauthenticatedChatConnection>): ConnectionInfo;
|
|
575
|
+
export function UnauthenticatedChatConnection_send(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<UnauthenticatedChatConnection>, httpRequest: Wrapper<HttpRequest>, timeoutMillis: number): CancellablePromise<ChatResponse>;
|
|
557
576
|
export function UnidentifiedSenderMessageContent_Deserialize(data: Buffer): UnidentifiedSenderMessageContent;
|
|
558
577
|
export function UnidentifiedSenderMessageContent_GetContentHint(m: Wrapper<UnidentifiedSenderMessageContent>): number;
|
|
559
578
|
export function UnidentifiedSenderMessageContent_GetContents(obj: Wrapper<UnidentifiedSenderMessageContent>): Buffer;
|
|
@@ -578,10 +597,12 @@ export function initLogger(maxLevel: LogLevel, callback: (level: LogLevel, targe
|
|
|
578
597
|
export function test_only_fn_returns_123(): number;
|
|
579
598
|
interface Aes256GcmSiv { readonly __type: unique symbol; }
|
|
580
599
|
interface AuthChat { readonly __type: unique symbol; }
|
|
600
|
+
interface AuthenticatedChatConnection { readonly __type: unique symbol; }
|
|
581
601
|
interface CdsiLookup { readonly __type: unique symbol; }
|
|
582
602
|
interface CiphertextMessage { readonly __type: unique symbol; }
|
|
583
603
|
interface ComparableBackup { readonly __type: unique symbol; }
|
|
584
604
|
interface ComparableBackup { readonly __type: unique symbol; }
|
|
605
|
+
interface ConnectionInfo { readonly __type: unique symbol; }
|
|
585
606
|
interface ConnectionManager { readonly __type: unique symbol; }
|
|
586
607
|
interface DecryptionErrorMessage { readonly __type: unique symbol; }
|
|
587
608
|
interface ExpiringProfileKeyCredential { readonly __type: unique symbol; }
|
|
@@ -600,6 +621,7 @@ interface KyberSecretKey { readonly __type: unique symbol; }
|
|
|
600
621
|
interface LookupRequest { readonly __type: unique symbol; }
|
|
601
622
|
interface MessageBackupKey { readonly __type: unique symbol; }
|
|
602
623
|
interface NonSuspendingBackgroundThreadRuntime { readonly __type: unique symbol; }
|
|
624
|
+
interface OnlineBackupValidator { readonly __type: unique symbol; }
|
|
603
625
|
interface OtherTestingHandleType { readonly __type: unique symbol; }
|
|
604
626
|
interface PlaintextContent { readonly __type: unique symbol; }
|
|
605
627
|
interface PreKeyBundle { readonly __type: unique symbol; }
|
|
@@ -635,6 +657,7 @@ interface SignedPreKeyRecord { readonly __type: unique symbol; }
|
|
|
635
657
|
interface TestingHandleType { readonly __type: unique symbol; }
|
|
636
658
|
interface TokioAsyncContext { readonly __type: unique symbol; }
|
|
637
659
|
interface UnauthChat { readonly __type: unique symbol; }
|
|
660
|
+
interface UnauthenticatedChatConnection { readonly __type: unique symbol; }
|
|
638
661
|
interface UnidentifiedSenderMessageContent { readonly __type: unique symbol; }
|
|
639
662
|
interface UuidCiphertext { readonly __type: unique symbol; }
|
|
640
663
|
interface ValidatingMac { readonly __type: unique symbol; }
|
package/dist/MessageBackup.d.ts
CHANGED
|
@@ -81,8 +81,59 @@ export declare enum Purpose {
|
|
|
81
81
|
* @param length The exact length of the input stream.
|
|
82
82
|
* @returns The outcome of validation, including any errors and warnings.
|
|
83
83
|
* @throws IoError If an IO error on the input occurs.
|
|
84
|
+
*
|
|
85
|
+
* @see OnlineBackupValidator
|
|
84
86
|
*/
|
|
85
87
|
export declare function validate(backupKey: MessageBackupKey, purpose: Purpose, inputFactory: InputStreamFactory, length: bigint): Promise<ValidationOutcome>;
|
|
88
|
+
/**
|
|
89
|
+
* An alternative to {@link validate()} that validates a backup frame-by-frame.
|
|
90
|
+
*
|
|
91
|
+
* This is much faster than using `validate()` because it bypasses the decryption and decompression
|
|
92
|
+
* steps, but that also means it's validating less. Don't forget to call `finalize()`!
|
|
93
|
+
*
|
|
94
|
+
* Unlike `validate()`, unknown fields are treated as "soft" errors and logged, rather than
|
|
95
|
+
* collected and returned to the app for processing.
|
|
96
|
+
*
|
|
97
|
+
* # Example
|
|
98
|
+
*
|
|
99
|
+
* ```
|
|
100
|
+
* const validator = new OnlineBackupValidator(
|
|
101
|
+
* backupInfoProto.serialize(),
|
|
102
|
+
* Purpose.deviceTransfer)
|
|
103
|
+
* repeat {
|
|
104
|
+
* // ...generate Frames...
|
|
105
|
+
* validator.addFrame(frameProto.serialize())
|
|
106
|
+
* }
|
|
107
|
+
* validator.finalize() // don't forget this!
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
export declare class OnlineBackupValidator {
|
|
111
|
+
readonly _nativeHandle: Native.OnlineBackupValidator;
|
|
112
|
+
/**
|
|
113
|
+
* Initializes an OnlineBackupValidator from the given BackupInfo protobuf message.
|
|
114
|
+
*
|
|
115
|
+
* "Soft" errors will be logged, including unrecognized fields in the protobuf.
|
|
116
|
+
*
|
|
117
|
+
* @throws BackupValidationError on error
|
|
118
|
+
*/
|
|
119
|
+
constructor(backupInfo: Buffer, purpose: Purpose);
|
|
120
|
+
/**
|
|
121
|
+
* Processes a single Frame protobuf message.
|
|
122
|
+
*
|
|
123
|
+
* "Soft" errors will be logged, including unrecognized fields in the protobuf.
|
|
124
|
+
*
|
|
125
|
+
* @throws BackupValidationError on error
|
|
126
|
+
*/
|
|
127
|
+
addFrame(frame: Buffer): void;
|
|
128
|
+
/**
|
|
129
|
+
* Marks that a backup is complete, and does any final checks that require whole-file knowledge.
|
|
130
|
+
*
|
|
131
|
+
* "Soft" errors will be logged.
|
|
132
|
+
*
|
|
133
|
+
* @throws BackupValidationError on error
|
|
134
|
+
*/
|
|
135
|
+
finalize(): void;
|
|
136
|
+
}
|
|
86
137
|
/**
|
|
87
138
|
* An in-memory representation of a backup file used to compare contents.
|
|
88
139
|
*
|
package/dist/MessageBackup.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.ComparableBackup = exports.validate = exports.Purpose = exports.MessageBackupKey = exports.ValidationOutcome = void 0;
|
|
7
|
+
exports.ComparableBackup = exports.OnlineBackupValidator = exports.validate = exports.Purpose = exports.MessageBackupKey = exports.ValidationOutcome = void 0;
|
|
8
8
|
/**
|
|
9
9
|
* Message backup validation routines.
|
|
10
10
|
*
|
|
@@ -81,6 +81,8 @@ var Purpose;
|
|
|
81
81
|
* @param length The exact length of the input stream.
|
|
82
82
|
* @returns The outcome of validation, including any errors and warnings.
|
|
83
83
|
* @throws IoError If an IO error on the input occurs.
|
|
84
|
+
*
|
|
85
|
+
* @see OnlineBackupValidator
|
|
84
86
|
*/
|
|
85
87
|
async function validate(backupKey, purpose, inputFactory, length) {
|
|
86
88
|
const firstStream = inputFactory();
|
|
@@ -88,6 +90,61 @@ async function validate(backupKey, purpose, inputFactory, length) {
|
|
|
88
90
|
return new ValidationOutcome(await Native.MessageBackupValidator_Validate(backupKey, firstStream, secondStream, length, purpose));
|
|
89
91
|
}
|
|
90
92
|
exports.validate = validate;
|
|
93
|
+
/**
|
|
94
|
+
* An alternative to {@link validate()} that validates a backup frame-by-frame.
|
|
95
|
+
*
|
|
96
|
+
* This is much faster than using `validate()` because it bypasses the decryption and decompression
|
|
97
|
+
* steps, but that also means it's validating less. Don't forget to call `finalize()`!
|
|
98
|
+
*
|
|
99
|
+
* Unlike `validate()`, unknown fields are treated as "soft" errors and logged, rather than
|
|
100
|
+
* collected and returned to the app for processing.
|
|
101
|
+
*
|
|
102
|
+
* # Example
|
|
103
|
+
*
|
|
104
|
+
* ```
|
|
105
|
+
* const validator = new OnlineBackupValidator(
|
|
106
|
+
* backupInfoProto.serialize(),
|
|
107
|
+
* Purpose.deviceTransfer)
|
|
108
|
+
* repeat {
|
|
109
|
+
* // ...generate Frames...
|
|
110
|
+
* validator.addFrame(frameProto.serialize())
|
|
111
|
+
* }
|
|
112
|
+
* validator.finalize() // don't forget this!
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
class OnlineBackupValidator {
|
|
116
|
+
/**
|
|
117
|
+
* Initializes an OnlineBackupValidator from the given BackupInfo protobuf message.
|
|
118
|
+
*
|
|
119
|
+
* "Soft" errors will be logged, including unrecognized fields in the protobuf.
|
|
120
|
+
*
|
|
121
|
+
* @throws BackupValidationError on error
|
|
122
|
+
*/
|
|
123
|
+
constructor(backupInfo, purpose) {
|
|
124
|
+
this._nativeHandle = Native.OnlineBackupValidator_New(backupInfo, purpose);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Processes a single Frame protobuf message.
|
|
128
|
+
*
|
|
129
|
+
* "Soft" errors will be logged, including unrecognized fields in the protobuf.
|
|
130
|
+
*
|
|
131
|
+
* @throws BackupValidationError on error
|
|
132
|
+
*/
|
|
133
|
+
addFrame(frame) {
|
|
134
|
+
Native.OnlineBackupValidator_AddFrame(this, frame);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Marks that a backup is complete, and does any final checks that require whole-file knowledge.
|
|
138
|
+
*
|
|
139
|
+
* "Soft" errors will be logged.
|
|
140
|
+
*
|
|
141
|
+
* @throws BackupValidationError on error
|
|
142
|
+
*/
|
|
143
|
+
finalize() {
|
|
144
|
+
Native.OnlineBackupValidator_Finalize(this);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
exports.OnlineBackupValidator = OnlineBackupValidator;
|
|
91
148
|
/**
|
|
92
149
|
* An in-memory representation of a backup file used to compare contents.
|
|
93
150
|
*
|
package/dist/acknowledgments.md
CHANGED
|
@@ -2926,7 +2926,7 @@ DEALINGS IN THE SOFTWARE.
|
|
|
2926
2926
|
|
|
2927
2927
|
```
|
|
2928
2928
|
|
|
2929
|
-
## backtrace 0.3.74, cc 1.1.18, cfg-if 1.0.0, cmake 0.1.48, flate2 1.0.33, jobserver 0.1.32, openssl-probe 0.1.5, rustc-demangle 0.1.24, scoped-tls 1.0.1, socket2 0.5.7
|
|
2929
|
+
## backtrace 0.3.74, cc 1.1.18, cfg-if 1.0.0, cmake 0.1.48, flate2 1.0.33, jobserver 0.1.32, openssl-probe 0.1.5, pkg-config 0.3.31, rustc-demangle 0.1.24, scoped-tls 1.0.1, socket2 0.5.7
|
|
2930
2930
|
|
|
2931
2931
|
```
|
|
2932
2932
|
Copyright (c) 2014 Alex Crichton
|
|
@@ -2989,6 +2989,38 @@ DEALINGS IN THE SOFTWARE.
|
|
|
2989
2989
|
|
|
2990
2990
|
```
|
|
2991
2991
|
|
|
2992
|
+
## libz-sys 1.1.20
|
|
2993
|
+
|
|
2994
|
+
```
|
|
2995
|
+
Copyright (c) 2014 Alex Crichton
|
|
2996
|
+
Copyright (c) 2020 Josh Triplett
|
|
2997
|
+
|
|
2998
|
+
Permission is hereby granted, free of charge, to any
|
|
2999
|
+
person obtaining a copy of this software and associated
|
|
3000
|
+
documentation files (the "Software"), to deal in the
|
|
3001
|
+
Software without restriction, including without
|
|
3002
|
+
limitation the rights to use, copy, modify, merge,
|
|
3003
|
+
publish, distribute, sublicense, and/or sell copies of
|
|
3004
|
+
the Software, and to permit persons to whom the Software
|
|
3005
|
+
is furnished to do so, subject to the following
|
|
3006
|
+
conditions:
|
|
3007
|
+
|
|
3008
|
+
The above copyright notice and this permission notice
|
|
3009
|
+
shall be included in all copies or substantial portions
|
|
3010
|
+
of the Software.
|
|
3011
|
+
|
|
3012
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
|
3013
|
+
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
3014
|
+
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
3015
|
+
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
|
3016
|
+
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
3017
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
3018
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
|
3019
|
+
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
3020
|
+
DEALINGS IN THE SOFTWARE.
|
|
3021
|
+
|
|
3022
|
+
```
|
|
3023
|
+
|
|
2992
3024
|
## mio 1.0.2
|
|
2993
3025
|
|
|
2994
3026
|
```
|
|
@@ -3884,6 +3916,18 @@ DEALINGS IN THE SOFTWARE.
|
|
|
3884
3916
|
|
|
3885
3917
|
```
|
|
3886
3918
|
|
|
3919
|
+
## intmap 2.0.0
|
|
3920
|
+
|
|
3921
|
+
```
|
|
3922
|
+
Copyright (c) 2016 Jesper Axelsson
|
|
3923
|
+
|
|
3924
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
3925
|
+
|
|
3926
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
3927
|
+
|
|
3928
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
3929
|
+
```
|
|
3930
|
+
|
|
3887
3931
|
## utf8parse 0.2.2
|
|
3888
3932
|
|
|
3889
3933
|
```
|
|
@@ -4508,6 +4552,38 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
|
4508
4552
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
4509
4553
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
4510
4554
|
|
|
4555
|
+
```
|
|
4556
|
+
|
|
4557
|
+
## vcpkg 0.2.15
|
|
4558
|
+
|
|
4559
|
+
```
|
|
4560
|
+
Copyright (c) 2017 Jim McGrath
|
|
4561
|
+
|
|
4562
|
+
Permission is hereby granted, free of charge, to any
|
|
4563
|
+
person obtaining a copy of this software and associated
|
|
4564
|
+
documentation files (the "Software"), to deal in the
|
|
4565
|
+
Software without restriction, including without
|
|
4566
|
+
limitation the rights to use, copy, modify, merge,
|
|
4567
|
+
publish, distribute, sublicense, and/or sell copies of
|
|
4568
|
+
the Software, and to permit persons to whom the Software
|
|
4569
|
+
is furnished to do so, subject to the following
|
|
4570
|
+
conditions:
|
|
4571
|
+
|
|
4572
|
+
The above copyright notice and this permission notice
|
|
4573
|
+
shall be included in all copies or substantial portions
|
|
4574
|
+
of the Software.
|
|
4575
|
+
|
|
4576
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
|
4577
|
+
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
4578
|
+
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
4579
|
+
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
|
4580
|
+
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
4581
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
4582
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
|
4583
|
+
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
4584
|
+
DEALINGS IN THE SOFTWARE.
|
|
4585
|
+
|
|
4586
|
+
|
|
4511
4587
|
```
|
|
4512
4588
|
|
|
4513
4589
|
## foreign-types-macros 0.2.3, foreign-types-shared 0.3.1, foreign-types 0.5.0
|
|
@@ -6796,6 +6872,33 @@ SOFTWARE.
|
|
|
6796
6872
|
|
|
6797
6873
|
```
|
|
6798
6874
|
|
|
6875
|
+
## visibility 0.1.1
|
|
6876
|
+
|
|
6877
|
+
```
|
|
6878
|
+
MIT License
|
|
6879
|
+
|
|
6880
|
+
Copyright (c) 2024 Daniel Henry-Mantilla
|
|
6881
|
+
|
|
6882
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6883
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6884
|
+
in the Software without restriction, including without limitation the rights
|
|
6885
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
6886
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
6887
|
+
furnished to do so, subject to the following conditions:
|
|
6888
|
+
|
|
6889
|
+
The above copyright notice and this permission notice shall be included in all
|
|
6890
|
+
copies or substantial portions of the Software.
|
|
6891
|
+
|
|
6892
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
6893
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
6894
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
6895
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
6896
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
6897
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
6898
|
+
SOFTWARE.
|
|
6899
|
+
|
|
6900
|
+
```
|
|
6901
|
+
|
|
6799
6902
|
## cesu8 1.1.0, half 2.4.1, pqcrypto-internals 0.2.5, pqcrypto-kyber 0.7.9, pqcrypto-kyber 0.8.1, pqcrypto-traits 0.3.5
|
|
6800
6903
|
|
|
6801
6904
|
```
|
package/dist/net.d.ts
CHANGED
|
@@ -18,6 +18,9 @@ export type CDSRequestOptionsType = {
|
|
|
18
18
|
aci: string;
|
|
19
19
|
accessKey: string;
|
|
20
20
|
}>;
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated this option is ignored by the server.
|
|
23
|
+
*/
|
|
21
24
|
returnAcisWithoutUaks: boolean;
|
|
22
25
|
abortSignal?: AbortSignal;
|
|
23
26
|
};
|
|
@@ -43,7 +46,7 @@ export declare function newNativeHandle<T>(handle: T): Wrapper<T>;
|
|
|
43
46
|
export declare class TokioAsyncContext {
|
|
44
47
|
readonly _nativeHandle: Native.TokioAsyncContext;
|
|
45
48
|
constructor(handle: Native.TokioAsyncContext);
|
|
46
|
-
makeCancellable<T>(abortSignal: AbortSignal | undefined, promise:
|
|
49
|
+
makeCancellable<T>(abortSignal: AbortSignal | undefined, promise: Native.CancellablePromise<T>): Promise<T>;
|
|
47
50
|
}
|
|
48
51
|
export declare class ChatServerMessageAck {
|
|
49
52
|
private readonly asyncContext;
|
|
@@ -133,6 +136,61 @@ export type ChatService = {
|
|
|
133
136
|
abortSignal?: AbortSignal;
|
|
134
137
|
}): Promise<Native.ChatResponse>;
|
|
135
138
|
};
|
|
139
|
+
/**
|
|
140
|
+
* A connection to the Chat Service.
|
|
141
|
+
*
|
|
142
|
+
* Provides API methods to communicate with the remote service. Make sure to
|
|
143
|
+
* call {@link #disconnect()} when the instance is no longer needed.
|
|
144
|
+
*/
|
|
145
|
+
export type ChatConnection = {
|
|
146
|
+
/**
|
|
147
|
+
* Initiates termination of the underlying connection to the Chat Service. After the service is
|
|
148
|
+
* disconnected, it cannot be used again.
|
|
149
|
+
*/
|
|
150
|
+
disconnect(): Promise<void>;
|
|
151
|
+
/**
|
|
152
|
+
* Sends request to the Chat service.
|
|
153
|
+
*/
|
|
154
|
+
fetch(chatRequest: ChatRequest, options?: {
|
|
155
|
+
abortSignal?: AbortSignal;
|
|
156
|
+
}): Promise<Native.ChatResponse>;
|
|
157
|
+
/**
|
|
158
|
+
* Information about the connection to the Chat service.
|
|
159
|
+
*/
|
|
160
|
+
connectionInfo(): ConnectionInfo;
|
|
161
|
+
};
|
|
162
|
+
export interface ConnectionInfo {
|
|
163
|
+
localPort: number;
|
|
164
|
+
ipVersion: 'IPv4' | 'IPv6';
|
|
165
|
+
}
|
|
166
|
+
export declare class UnauthenticatedChatConnection implements ChatConnection {
|
|
167
|
+
private readonly asyncContext;
|
|
168
|
+
private readonly chatService;
|
|
169
|
+
private readonly chatListener;
|
|
170
|
+
static connect(asyncContext: TokioAsyncContext, connectionManager: ConnectionManager, listener: ConnectionEventsListener, options?: {
|
|
171
|
+
abortSignal?: AbortSignal;
|
|
172
|
+
}): Promise<UnauthenticatedChatConnection>;
|
|
173
|
+
private constructor();
|
|
174
|
+
fetch(chatRequest: ChatRequest, options?: {
|
|
175
|
+
abortSignal?: AbortSignal;
|
|
176
|
+
}): Promise<Native.ChatResponse>;
|
|
177
|
+
disconnect(): Promise<void>;
|
|
178
|
+
connectionInfo(): ConnectionInfo;
|
|
179
|
+
}
|
|
180
|
+
export declare class AuthenticatedChatConnection implements ChatConnection {
|
|
181
|
+
private readonly asyncContext;
|
|
182
|
+
private readonly chatService;
|
|
183
|
+
private readonly chatListener;
|
|
184
|
+
static connect(asyncContext: TokioAsyncContext, connectionManager: ConnectionManager, username: string, password: string, receiveStories: boolean, listener: ChatServiceListener, options?: {
|
|
185
|
+
abortSignal?: AbortSignal;
|
|
186
|
+
}): Promise<AuthenticatedChatConnection>;
|
|
187
|
+
private constructor();
|
|
188
|
+
fetch(chatRequest: ChatRequest, options?: {
|
|
189
|
+
abortSignal?: AbortSignal;
|
|
190
|
+
}): Promise<Native.ChatResponse>;
|
|
191
|
+
disconnect(): Promise<void>;
|
|
192
|
+
connectionInfo(): ConnectionInfo;
|
|
193
|
+
}
|
|
136
194
|
/**
|
|
137
195
|
* Provides API methods to connect and communicate with the Chat Service over an authenticated channel.
|
|
138
196
|
*/
|
|
@@ -206,6 +264,23 @@ export declare class Net {
|
|
|
206
264
|
* Creates a new instance of {@link UnauthenticatedChatService}.
|
|
207
265
|
*/
|
|
208
266
|
newUnauthenticatedChatService(listener: ConnectionEventsListener): UnauthenticatedChatService;
|
|
267
|
+
/**
|
|
268
|
+
*
|
|
269
|
+
* Creates a new instance of {@link UnauthenticatedChatConnection}.
|
|
270
|
+
* @param listener the listener for incoming events.
|
|
271
|
+
* @param options additional options to pass through.
|
|
272
|
+
* @param options.abortSignal an {@link AbortSignal} that will cancel the connection attempt.
|
|
273
|
+
* @returns the connected listener, if the connection succeeds.
|
|
274
|
+
*/
|
|
275
|
+
connectUnauthenticatedChat(listener: ConnectionEventsListener, options?: {
|
|
276
|
+
abortSignal?: AbortSignal;
|
|
277
|
+
}): Promise<UnauthenticatedChatConnection>;
|
|
278
|
+
/**
|
|
279
|
+
* Creates a new instance of {@link AuthenticatedChatConnection}.
|
|
280
|
+
*/
|
|
281
|
+
connectAuthenticatedChat(username: string, password: string, receiveStories: boolean, listener: ChatServiceListener, options?: {
|
|
282
|
+
abortSignal?: AbortSignal;
|
|
283
|
+
}): Promise<AuthenticatedChatConnection>;
|
|
209
284
|
/**
|
|
210
285
|
* Enables/disables IPv6 for all new connections (until changed).
|
|
211
286
|
*
|
|
@@ -246,7 +321,7 @@ export declare class Net {
|
|
|
246
321
|
* This will lead to, e.g. caches being cleared and cooldowns being reset.
|
|
247
322
|
*/
|
|
248
323
|
onNetworkChange(): void;
|
|
249
|
-
cdsiLookup({ username, password }: Readonly<ServiceAuth>, { e164s, acisAndAccessKeys,
|
|
324
|
+
cdsiLookup({ username, password }: Readonly<ServiceAuth>, { e164s, acisAndAccessKeys, abortSignal, }: ReadonlyDeep<CDSRequestOptionsType>): Promise<CDSResponseType<string, string>>;
|
|
250
325
|
}
|
|
251
326
|
/**
|
|
252
327
|
* This interface provides functionality for communicating with SVR3
|
package/dist/net.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.RestoredSecret = exports.Net = exports.buildHttpRequest = exports.UnauthenticatedChatService = exports.AuthenticatedChatService = exports.ChatServerMessageAck = exports.TokioAsyncContext = exports.newNativeHandle = exports.Environment = void 0;
|
|
7
|
+
exports.RestoredSecret = exports.Net = exports.buildHttpRequest = exports.UnauthenticatedChatService = exports.AuthenticatedChatService = exports.AuthenticatedChatConnection = exports.UnauthenticatedChatConnection = exports.ChatServerMessageAck = exports.TokioAsyncContext = exports.newNativeHandle = exports.Environment = void 0;
|
|
8
8
|
const Native = require("../Native");
|
|
9
9
|
const Address_1 = require("./Address");
|
|
10
10
|
const node_buffer_1 = require("node:buffer");
|
|
@@ -27,9 +27,7 @@ class TokioAsyncContext {
|
|
|
27
27
|
this._nativeHandle = handle;
|
|
28
28
|
}
|
|
29
29
|
makeCancellable(abortSignal, promise) {
|
|
30
|
-
if (abortSignal !== undefined
|
|
31
|
-
'_cancellationToken' in promise &&
|
|
32
|
-
typeof promise._cancellationToken === 'bigint') {
|
|
30
|
+
if (abortSignal !== undefined) {
|
|
33
31
|
const cancellationToken = promise._cancellationToken;
|
|
34
32
|
const cancel = () => {
|
|
35
33
|
Native.TokioAsyncContext_cancel(this, cancellationToken);
|
|
@@ -59,6 +57,108 @@ class ChatServerMessageAck {
|
|
|
59
57
|
}
|
|
60
58
|
}
|
|
61
59
|
exports.ChatServerMessageAck = ChatServerMessageAck;
|
|
60
|
+
class ConnectionInfoImpl {
|
|
61
|
+
constructor(_nativeHandle) {
|
|
62
|
+
this._nativeHandle = _nativeHandle;
|
|
63
|
+
}
|
|
64
|
+
get localPort() {
|
|
65
|
+
return Native.ConnectionInfo_local_port(this);
|
|
66
|
+
}
|
|
67
|
+
get ipVersion() {
|
|
68
|
+
const value = Native.ConnectionInfo_ip_version(this);
|
|
69
|
+
switch (value) {
|
|
70
|
+
case 1:
|
|
71
|
+
return 'IPv4';
|
|
72
|
+
case 2:
|
|
73
|
+
return 'IPv6';
|
|
74
|
+
default:
|
|
75
|
+
throw new TypeError(`ip type was unexpectedly ${value}`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
class UnauthenticatedChatConnection {
|
|
80
|
+
static async connect(asyncContext, connectionManager, listener, options) {
|
|
81
|
+
const nativeChatListener = makeNativeChatListener(asyncContext, listener);
|
|
82
|
+
const connect = Native.UnauthenticatedChatConnection_connect(asyncContext, connectionManager, new WeakListenerWrapper(nativeChatListener));
|
|
83
|
+
const chat = await asyncContext.makeCancellable(options?.abortSignal, connect);
|
|
84
|
+
return new UnauthenticatedChatConnection(asyncContext, newNativeHandle(chat), nativeChatListener);
|
|
85
|
+
}
|
|
86
|
+
constructor(asyncContext, chatService,
|
|
87
|
+
// Unused except to keep the listener alive since the Rust code only holds a
|
|
88
|
+
// weak reference to the same object.
|
|
89
|
+
chatListener) {
|
|
90
|
+
this.asyncContext = asyncContext;
|
|
91
|
+
this.chatService = chatService;
|
|
92
|
+
this.chatListener = chatListener;
|
|
93
|
+
}
|
|
94
|
+
fetch(chatRequest, options) {
|
|
95
|
+
return this.asyncContext.makeCancellable(options?.abortSignal, Native.UnauthenticatedChatConnection_send(this.asyncContext, this.chatService, buildHttpRequest(chatRequest), chatRequest.timeoutMillis ?? DEFAULT_CHAT_REQUEST_TIMEOUT_MILLIS));
|
|
96
|
+
}
|
|
97
|
+
disconnect() {
|
|
98
|
+
return Native.UnauthenticatedChatConnection_disconnect(this.asyncContext, this.chatService);
|
|
99
|
+
}
|
|
100
|
+
connectionInfo() {
|
|
101
|
+
return new ConnectionInfoImpl(Native.UnauthenticatedChatConnection_info(this.chatService));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
exports.UnauthenticatedChatConnection = UnauthenticatedChatConnection;
|
|
105
|
+
class AuthenticatedChatConnection {
|
|
106
|
+
static async connect(asyncContext, connectionManager, username, password, receiveStories, listener, options) {
|
|
107
|
+
const nativeChatListener = makeNativeChatListener(asyncContext, listener);
|
|
108
|
+
const connect = Native.AuthenticatedChatConnection_connect(asyncContext, connectionManager, username, password, receiveStories, new WeakListenerWrapper(nativeChatListener));
|
|
109
|
+
const chat = await asyncContext.makeCancellable(options?.abortSignal, connect);
|
|
110
|
+
return new AuthenticatedChatConnection(asyncContext, newNativeHandle(chat), nativeChatListener);
|
|
111
|
+
}
|
|
112
|
+
constructor(asyncContext, chatService,
|
|
113
|
+
// Unused except to keep the listener alive since the Rust code only holds a
|
|
114
|
+
// weak reference to the same object.
|
|
115
|
+
chatListener) {
|
|
116
|
+
this.asyncContext = asyncContext;
|
|
117
|
+
this.chatService = chatService;
|
|
118
|
+
this.chatListener = chatListener;
|
|
119
|
+
}
|
|
120
|
+
fetch(chatRequest, options) {
|
|
121
|
+
return this.asyncContext.makeCancellable(options?.abortSignal, Native.AuthenticatedChatConnection_send(this.asyncContext, this.chatService, buildHttpRequest(chatRequest), chatRequest.timeoutMillis ?? DEFAULT_CHAT_REQUEST_TIMEOUT_MILLIS));
|
|
122
|
+
}
|
|
123
|
+
disconnect() {
|
|
124
|
+
return Native.AuthenticatedChatConnection_disconnect(this.asyncContext, this.chatService);
|
|
125
|
+
}
|
|
126
|
+
connectionInfo() {
|
|
127
|
+
return new ConnectionInfoImpl(Native.AuthenticatedChatConnection_info(this.chatService));
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
exports.AuthenticatedChatConnection = AuthenticatedChatConnection;
|
|
131
|
+
/**
|
|
132
|
+
* Holds a {@link Native.ChatListener} by {@link WeakRef} and delegates
|
|
133
|
+
* `ChatListener` calls to it.
|
|
134
|
+
*
|
|
135
|
+
* This lets us avoid passing anything across the bridge that has a normal
|
|
136
|
+
* (strong) reference to the app-side listener. The danger is that the passed-in
|
|
137
|
+
* listener might gain a reference to the JS connection object; that would
|
|
138
|
+
* result in a reference cycle that Node can't clean up because one of the
|
|
139
|
+
* references is through a Rust `Box`.
|
|
140
|
+
*
|
|
141
|
+
* When constructing a connection, calling code should wrap an app-side listener
|
|
142
|
+
* in this type and pass it across the bridge, then hold its own strong
|
|
143
|
+
* reference to the same listener as a field. This ensures that if there is a
|
|
144
|
+
* reference cycle between the connection and app-side listener, that cycle is
|
|
145
|
+
* visible to the Node runtime, while still ensuring the passed-in listener
|
|
146
|
+
* stays alive as long as the connection does.
|
|
147
|
+
*/
|
|
148
|
+
class WeakListenerWrapper {
|
|
149
|
+
constructor(listener) {
|
|
150
|
+
this.listener = new WeakRef(listener);
|
|
151
|
+
}
|
|
152
|
+
_connection_interrupted(reason) {
|
|
153
|
+
this.listener.deref()?._connection_interrupted(reason);
|
|
154
|
+
}
|
|
155
|
+
_incoming_message(envelope, timestamp, ack) {
|
|
156
|
+
this.listener.deref()?._incoming_message(envelope, timestamp, ack);
|
|
157
|
+
}
|
|
158
|
+
_queue_empty() {
|
|
159
|
+
this.listener.deref()?._queue_empty();
|
|
160
|
+
}
|
|
161
|
+
}
|
|
62
162
|
/**
|
|
63
163
|
* Provides API methods to connect and communicate with the Chat Service over an authenticated channel.
|
|
64
164
|
*/
|
|
@@ -100,17 +200,7 @@ class UnauthenticatedChatService {
|
|
|
100
200
|
constructor(asyncContext, connectionManager, listener) {
|
|
101
201
|
this.asyncContext = asyncContext;
|
|
102
202
|
this.chatService = newNativeHandle(Native.ChatService_new_unauth(connectionManager));
|
|
103
|
-
const nativeChatListener =
|
|
104
|
-
_incoming_message(_envelope, _timestamp, _ack) {
|
|
105
|
-
throw new Error('Event not supported on unauthenticated connection');
|
|
106
|
-
},
|
|
107
|
-
_queue_empty() {
|
|
108
|
-
throw new Error('Event not supported on unauthenticated connection');
|
|
109
|
-
},
|
|
110
|
-
_connection_interrupted(cause) {
|
|
111
|
-
listener.onConnectionInterrupted(cause);
|
|
112
|
-
},
|
|
113
|
-
};
|
|
203
|
+
const nativeChatListener = makeNativeChatListener(asyncContext, listener);
|
|
114
204
|
Native.ChatService_SetListenerUnauth(asyncContext, this.chatService, nativeChatListener);
|
|
115
205
|
}
|
|
116
206
|
disconnect() {
|
|
@@ -127,6 +217,32 @@ class UnauthenticatedChatService {
|
|
|
127
217
|
}
|
|
128
218
|
}
|
|
129
219
|
exports.UnauthenticatedChatService = UnauthenticatedChatService;
|
|
220
|
+
function makeNativeChatListener(asyncContext, listener) {
|
|
221
|
+
if ('onQueueEmpty' in listener) {
|
|
222
|
+
return {
|
|
223
|
+
_incoming_message(envelope, timestamp, ack) {
|
|
224
|
+
listener.onIncomingMessage(envelope, timestamp, new ChatServerMessageAck(asyncContext, ack));
|
|
225
|
+
},
|
|
226
|
+
_queue_empty() {
|
|
227
|
+
listener.onQueueEmpty();
|
|
228
|
+
},
|
|
229
|
+
_connection_interrupted(cause) {
|
|
230
|
+
listener.onConnectionInterrupted(cause);
|
|
231
|
+
},
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
return {
|
|
235
|
+
_incoming_message(_envelope, _timestamp, _ack) {
|
|
236
|
+
throw new Error('Event not supported on unauthenticated connection');
|
|
237
|
+
},
|
|
238
|
+
_queue_empty() {
|
|
239
|
+
throw new Error('Event not supported on unauthenticated connection');
|
|
240
|
+
},
|
|
241
|
+
_connection_interrupted(cause) {
|
|
242
|
+
listener.onConnectionInterrupted(cause);
|
|
243
|
+
},
|
|
244
|
+
};
|
|
245
|
+
}
|
|
130
246
|
function buildHttpRequest(chatRequest) {
|
|
131
247
|
const { verb, path, body, headers } = chatRequest;
|
|
132
248
|
const bodyBuffer = body !== undefined ? node_buffer_1.Buffer.from(body) : null;
|
|
@@ -168,6 +284,23 @@ class Net {
|
|
|
168
284
|
newUnauthenticatedChatService(listener) {
|
|
169
285
|
return new UnauthenticatedChatService(this.asyncContext, this.connectionManager, listener);
|
|
170
286
|
}
|
|
287
|
+
/**
|
|
288
|
+
*
|
|
289
|
+
* Creates a new instance of {@link UnauthenticatedChatConnection}.
|
|
290
|
+
* @param listener the listener for incoming events.
|
|
291
|
+
* @param options additional options to pass through.
|
|
292
|
+
* @param options.abortSignal an {@link AbortSignal} that will cancel the connection attempt.
|
|
293
|
+
* @returns the connected listener, if the connection succeeds.
|
|
294
|
+
*/
|
|
295
|
+
async connectUnauthenticatedChat(listener, options) {
|
|
296
|
+
return UnauthenticatedChatConnection.connect(this.asyncContext, this.connectionManager, listener, options);
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Creates a new instance of {@link AuthenticatedChatConnection}.
|
|
300
|
+
*/
|
|
301
|
+
connectAuthenticatedChat(username, password, receiveStories, listener, options) {
|
|
302
|
+
return AuthenticatedChatConnection.connect(this.asyncContext, this.connectionManager, username, password, receiveStories, listener, options);
|
|
303
|
+
}
|
|
171
304
|
/**
|
|
172
305
|
* Enables/disables IPv6 for all new connections (until changed).
|
|
173
306
|
*
|
|
@@ -218,7 +351,7 @@ class Net {
|
|
|
218
351
|
onNetworkChange() {
|
|
219
352
|
Native.ConnectionManager_on_network_change(this.connectionManager);
|
|
220
353
|
}
|
|
221
|
-
async cdsiLookup({ username, password }, { e164s, acisAndAccessKeys,
|
|
354
|
+
async cdsiLookup({ username, password }, { e164s, acisAndAccessKeys, abortSignal, }) {
|
|
222
355
|
const request = newNativeHandle(Native.LookupRequest_new());
|
|
223
356
|
e164s.forEach((e164) => {
|
|
224
357
|
Native.LookupRequest_addE164(request, e164);
|
|
@@ -226,7 +359,6 @@ class Net {
|
|
|
226
359
|
acisAndAccessKeys.forEach(({ aci: aciStr, accessKey: accessKeyStr }) => {
|
|
227
360
|
Native.LookupRequest_addAciAndAccessKey(request, Address_1.Aci.parseFromServiceIdString(aciStr).getServiceIdFixedWidthBinary(), node_buffer_1.Buffer.from(accessKeyStr, 'base64'));
|
|
228
361
|
});
|
|
229
|
-
Native.LookupRequest_setReturnAcisWithoutUaks(request, returnAcisWithoutUaks);
|
|
230
362
|
const lookup = await this.asyncContext.makeCancellable(abortSignal, Native.CdsiLookup_new(this.asyncContext, this.connectionManager, username, password, request));
|
|
231
363
|
return await this.asyncContext.makeCancellable(abortSignal, Native.CdsiLookup_complete(this.asyncContext, newNativeHandle(lookup)));
|
|
232
364
|
}
|
|
@@ -7,7 +7,13 @@ import { Aci, Pni } from '../../Address';
|
|
|
7
7
|
export default class ServerZkAuthOperations {
|
|
8
8
|
serverSecretParams: ServerSecretParams;
|
|
9
9
|
constructor(serverSecretParams: ServerSecretParams);
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated These credentials are no longer supported by the server; use `issueAuthCredentialWithPniZkc` instead.
|
|
12
|
+
*/
|
|
10
13
|
issueAuthCredentialWithPniAsServiceId(aci: Aci, pni: Pni, redemptionTime: number): AuthCredentialWithPniResponse;
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated These credentials are no longer supported by the server; use `issueAuthCredentialWithPniZkc` instead.
|
|
16
|
+
*/
|
|
11
17
|
issueAuthCredentialWithPniAsServiceIdWithRandom(random: Buffer, aci: Aci, pni: Pni, redemptionTime: number): AuthCredentialWithPniResponse;
|
|
12
18
|
issueAuthCredentialWithPniZkc(aci: Aci, pni: Pni, redemptionTime: number): AuthCredentialWithPniResponse;
|
|
13
19
|
issueAuthCredentialWithPniZkcWithRandom(random: Buffer, aci: Aci, pni: Pni, redemptionTime: number): AuthCredentialWithPniResponse;
|
|
@@ -12,10 +12,16 @@ class ServerZkAuthOperations {
|
|
|
12
12
|
constructor(serverSecretParams) {
|
|
13
13
|
this.serverSecretParams = serverSecretParams;
|
|
14
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated These credentials are no longer supported by the server; use `issueAuthCredentialWithPniZkc` instead.
|
|
17
|
+
*/
|
|
15
18
|
issueAuthCredentialWithPniAsServiceId(aci, pni, redemptionTime) {
|
|
16
19
|
const random = (0, crypto_1.randomBytes)(Constants_1.RANDOM_LENGTH);
|
|
17
20
|
return this.issueAuthCredentialWithPniAsServiceIdWithRandom(random, aci, pni, redemptionTime);
|
|
18
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated These credentials are no longer supported by the server; use `issueAuthCredentialWithPniZkc` instead.
|
|
24
|
+
*/
|
|
19
25
|
issueAuthCredentialWithPniAsServiceIdWithRandom(random, aci, pni, redemptionTime) {
|
|
20
26
|
return new AuthCredentialWithPniResponse_1.default(Native.ServerSecretParams_IssueAuthCredentialWithPniAsServiceIdDeterministic(this.serverSecretParams, random, aci.getServiceIdFixedWidthBinary(), pni.getServiceIdFixedWidthBinary(), redemptionTime));
|
|
21
27
|
}
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|