@signalapp/libsignal-client 0.62.0 → 0.64.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 +85 -60
- package/dist/MessageBackup.d.ts +51 -0
- package/dist/MessageBackup.js +58 -1
- package/dist/acknowledgments.md +135 -7
- package/dist/net.d.ts +77 -2
- package/dist/net.js +153 -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,11 @@ 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): 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_init_listener(chat: Wrapper<AuthenticatedChatConnection>, listener: ChatListener): void;
|
|
167
|
+
export function AuthenticatedChatConnection_send(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<AuthenticatedChatConnection>, httpRequest: Wrapper<HttpRequest>, timeoutMillis: number): CancellablePromise<ChatResponse>;
|
|
156
168
|
export function BackupAuthCredentialPresentation_CheckValidContents(presentationBytes: Buffer): void;
|
|
157
169
|
export function BackupAuthCredentialPresentation_GetBackupId(presentationBytes: Buffer): Buffer;
|
|
158
170
|
export function BackupAuthCredentialPresentation_GetBackupLevel(presentationBytes: Buffer): number;
|
|
@@ -190,27 +202,29 @@ export function CallLinkSecretParams_DecryptUserId(paramsBytes: Buffer, userId:
|
|
|
190
202
|
export function CallLinkSecretParams_DeriveFromRootKey(rootKey: Buffer): Buffer;
|
|
191
203
|
export function CallLinkSecretParams_GetPublicParams(paramsBytes: Buffer): Buffer;
|
|
192
204
|
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>):
|
|
205
|
+
export function CdsiLookup_complete(asyncRuntime: Wrapper<TokioAsyncContext>, lookup: Wrapper<CdsiLookup>): CancellablePromise<LookupResponse>;
|
|
206
|
+
export function CdsiLookup_new(asyncRuntime: Wrapper<TokioAsyncContext>, connectionManager: Wrapper<ConnectionManager>, username: string, password: string, request: Wrapper<LookupRequest>): CancellablePromise<CdsiLookup>;
|
|
195
207
|
export function CdsiLookup_token(lookup: Wrapper<CdsiLookup>): Buffer;
|
|
196
208
|
export function ChatService_SetListenerAuth(runtime: Wrapper<TokioAsyncContext>, chat: Wrapper<AuthChat>, listener: ChatListener | null): void;
|
|
197
209
|
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>):
|
|
210
|
+
export function ChatService_auth_send(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<AuthChat>, httpRequest: Wrapper<HttpRequest>, timeoutMillis: number): CancellablePromise<ChatResponse>;
|
|
211
|
+
export function ChatService_auth_send_and_debug(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<AuthChat>, httpRequest: Wrapper<HttpRequest>, timeoutMillis: number): CancellablePromise<ResponseAndDebugInfo>;
|
|
212
|
+
export function ChatService_connect_auth(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<AuthChat>): CancellablePromise<ChatServiceDebugInfo>;
|
|
213
|
+
export function ChatService_connect_unauth(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<UnauthChat>): CancellablePromise<ChatServiceDebugInfo>;
|
|
214
|
+
export function ChatService_disconnect_auth(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<AuthChat>): CancellablePromise<void>;
|
|
215
|
+
export function ChatService_disconnect_unauth(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<UnauthChat>): CancellablePromise<void>;
|
|
204
216
|
export function ChatService_new_auth(connectionManager: Wrapper<ConnectionManager>, username: string, password: string, receiveStories: boolean): AuthChat;
|
|
205
217
|
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):
|
|
218
|
+
export function ChatService_unauth_send(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<UnauthChat>, httpRequest: Wrapper<HttpRequest>, timeoutMillis: number): CancellablePromise<ChatResponse>;
|
|
219
|
+
export function ChatService_unauth_send_and_debug(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<UnauthChat>, httpRequest: Wrapper<HttpRequest>, timeoutMillis: number): CancellablePromise<ResponseAndDebugInfo>;
|
|
208
220
|
export function CiphertextMessage_FromPlaintextContent(m: Wrapper<PlaintextContent>): CiphertextMessage;
|
|
209
221
|
export function CiphertextMessage_Serialize(obj: Wrapper<CiphertextMessage>): Buffer;
|
|
210
222
|
export function CiphertextMessage_Type(msg: Wrapper<CiphertextMessage>): number;
|
|
211
223
|
export function ComparableBackup_GetComparableString(backup: Wrapper<ComparableBackup>): string;
|
|
212
224
|
export function ComparableBackup_GetUnknownFields(backup: Wrapper<ComparableBackup>): string[];
|
|
213
225
|
export function ComparableBackup_ReadUnencrypted(stream: InputStream, len: bigint, purpose: number): Promise<ComparableBackup>;
|
|
226
|
+
export function ConnectionInfo_ip_version(connectionInfo: Wrapper<ConnectionInfo>): number;
|
|
227
|
+
export function ConnectionInfo_local_port(connectionInfo: Wrapper<ConnectionInfo>): number;
|
|
214
228
|
export function ConnectionManager_clear_proxy(connectionManager: Wrapper<ConnectionManager>): void;
|
|
215
229
|
export function ConnectionManager_new(environment: number, userAgent: string): ConnectionManager;
|
|
216
230
|
export function ConnectionManager_on_network_change(connectionManager: Wrapper<ConnectionManager>): void;
|
|
@@ -316,7 +330,6 @@ export function LookupRequest_addAciAndAccessKey(request: Wrapper<LookupRequest>
|
|
|
316
330
|
export function LookupRequest_addE164(request: Wrapper<LookupRequest>, e164: string): void;
|
|
317
331
|
export function LookupRequest_addPreviousE164(request: Wrapper<LookupRequest>, e164: string): void;
|
|
318
332
|
export function LookupRequest_new(): LookupRequest;
|
|
319
|
-
export function LookupRequest_setReturnAcisWithoutUaks(request: Wrapper<LookupRequest>, returnAcisWithoutUaks: boolean): void;
|
|
320
333
|
export function LookupRequest_setToken(request: Wrapper<LookupRequest>, token: Buffer): void;
|
|
321
334
|
export function MessageBackupKey_FromAccountEntropyPool(accountEntropy: string, aci: Buffer): MessageBackupKey;
|
|
322
335
|
export function MessageBackupKey_FromBackupKeyAndBackupId(backupKey: Buffer, backupId: Buffer): MessageBackupKey;
|
|
@@ -326,6 +339,9 @@ export function MessageBackupKey_GetHmacKey(key: Wrapper<MessageBackupKey>): Buf
|
|
|
326
339
|
export function MessageBackupValidator_Validate(key: Wrapper<MessageBackupKey>, firstStream: InputStream, secondStream: InputStream, len: bigint, purpose: number): Promise<MessageBackupValidationOutcome>;
|
|
327
340
|
export function MinidumpToJSONString(buffer: Buffer): string;
|
|
328
341
|
export function Mp4Sanitizer_Sanitize(input: InputStream, len: bigint): Promise<SanitizedMetadata>;
|
|
342
|
+
export function OnlineBackupValidator_AddFrame(backup: Wrapper<OnlineBackupValidator>, frame: Buffer): void;
|
|
343
|
+
export function OnlineBackupValidator_Finalize(backup: Wrapper<OnlineBackupValidator>): void;
|
|
344
|
+
export function OnlineBackupValidator_New(backupInfoFrame: Buffer, purpose: number): OnlineBackupValidator;
|
|
329
345
|
export function PlaintextContent_Deserialize(data: Buffer): PlaintextContent;
|
|
330
346
|
export function PlaintextContent_FromDecryptionErrorMessage(m: Wrapper<DecryptionErrorMessage>): PlaintextContent;
|
|
331
347
|
export function PlaintextContent_GetBody(obj: Wrapper<PlaintextContent>): Buffer;
|
|
@@ -445,7 +461,7 @@ export function ServerCertificate_GetKeyId(obj: Wrapper<ServerCertificate>): num
|
|
|
445
461
|
export function ServerCertificate_GetSerialized(obj: Wrapper<ServerCertificate>): Buffer;
|
|
446
462
|
export function ServerCertificate_GetSignature(obj: Wrapper<ServerCertificate>): Buffer;
|
|
447
463
|
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):
|
|
464
|
+
export function ServerMessageAck_SendStatus(asyncRuntime: Wrapper<TokioAsyncContext>, ack: Wrapper<ServerMessageAck>, status: number): CancellablePromise<void>;
|
|
449
465
|
export function ServerPublicParams_CreateAuthCredentialWithPniPresentationDeterministic(serverPublicParams: Wrapper<ServerPublicParams>, randomness: Buffer, groupSecretParams: Serialized<GroupSecretParams>, authCredentialWithPniBytes: Buffer): Buffer;
|
|
450
466
|
export function ServerPublicParams_CreateExpiringProfileKeyCredentialPresentationDeterministic(serverPublicParams: Wrapper<ServerPublicParams>, randomness: Buffer, groupSecretParams: Serialized<GroupSecretParams>, profileKeyCredential: Serialized<ExpiringProfileKeyCredential>): Buffer;
|
|
451
467
|
export function ServerPublicParams_CreateProfileKeyCredentialRequestContextDeterministic(serverPublicParams: Wrapper<ServerPublicParams>, randomness: Buffer, userId: Buffer, profileKey: Serialized<ProfileKey>): Serialized<ProfileKeyCredentialRequestContext>;
|
|
@@ -505,11 +521,11 @@ export function SignedPreKeyRecord_GetSignature(obj: Wrapper<SignedPreKeyRecord>
|
|
|
505
521
|
export function SignedPreKeyRecord_GetTimestamp(obj: Wrapper<SignedPreKeyRecord>): Timestamp;
|
|
506
522
|
export function SignedPreKeyRecord_New(id: number, timestamp: Timestamp, pubKey: Wrapper<PublicKey>, privKey: Wrapper<PrivateKey>, signature: Buffer): SignedPreKeyRecord;
|
|
507
523
|
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):
|
|
524
|
+
export function Svr3Backup(asyncRuntime: Wrapper<TokioAsyncContext>, connectionManager: Wrapper<ConnectionManager>, secret: Buffer, password: string, maxTries: number, username: string, enclavePassword: string): CancellablePromise<Buffer>;
|
|
525
|
+
export function Svr3Remove(asyncRuntime: Wrapper<TokioAsyncContext>, connectionManager: Wrapper<ConnectionManager>, username: string, enclavePassword: string): CancellablePromise<void>;
|
|
526
|
+
export function Svr3Restore(asyncRuntime: Wrapper<TokioAsyncContext>, connectionManager: Wrapper<ConnectionManager>, password: string, shareSet: Buffer, username: string, enclavePassword: string): CancellablePromise<Buffer>;
|
|
511
527
|
export function TESTING_CdsiLookupErrorConvert(errorDescription: string): void;
|
|
512
|
-
export function TESTING_CdsiLookupResponseConvert(asyncRuntime: Wrapper<TokioAsyncContext>):
|
|
528
|
+
export function TESTING_CdsiLookupResponseConvert(asyncRuntime: Wrapper<TokioAsyncContext>): CancellablePromise<LookupResponse>;
|
|
513
529
|
export function TESTING_ChatRequestGetBody(request: Wrapper<HttpRequest>): Buffer;
|
|
514
530
|
export function TESTING_ChatRequestGetHeaderValue(request: Wrapper<HttpRequest>, headerName: string): string;
|
|
515
531
|
export function TESTING_ChatRequestGetMethod(request: Wrapper<HttpRequest>): string;
|
|
@@ -523,30 +539,30 @@ export function TESTING_ChatService_InjectIntentionalDisconnect(chat: Wrapper<Au
|
|
|
523
539
|
export function TESTING_ChatService_InjectRawServerRequest(chat: Wrapper<AuthChat>, bytes: Buffer): void;
|
|
524
540
|
export function TESTING_ConnectionManager_newLocalOverride(userAgent: string, chatPort: number, cdsiPort: number, svr2Port: number, svr3SgxPort: number, svr3NitroPort: number, svr3Tpm2SnpPort: number, rootCertificateDer: Buffer): ConnectionManager;
|
|
525
541
|
export function TESTING_ErrorOnBorrowAsync(_input: null): Promise<void>;
|
|
526
|
-
export function TESTING_ErrorOnBorrowIo(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, _input: null):
|
|
542
|
+
export function TESTING_ErrorOnBorrowIo(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, _input: null): CancellablePromise<void>;
|
|
527
543
|
export function TESTING_ErrorOnBorrowSync(_input: null): void;
|
|
528
544
|
export function TESTING_ErrorOnReturnAsync(_needsCleanup: null): Promise<null>;
|
|
529
|
-
export function TESTING_ErrorOnReturnIo(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, _needsCleanup: null):
|
|
545
|
+
export function TESTING_ErrorOnReturnIo(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, _needsCleanup: null): CancellablePromise<null>;
|
|
530
546
|
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):
|
|
547
|
+
export function TESTING_FutureFailure(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, _input: number): CancellablePromise<number>;
|
|
548
|
+
export function TESTING_FutureProducesOtherPointerType(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, input: string): CancellablePromise<OtherTestingHandleType>;
|
|
549
|
+
export function TESTING_FutureProducesPointerType(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, input: number): CancellablePromise<TestingHandleType>;
|
|
550
|
+
export function TESTING_FutureSuccess(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, input: number): CancellablePromise<number>;
|
|
535
551
|
export function TESTING_InputStreamReadIntoZeroLengthSlice(capsAlphabetInput: InputStream): Promise<Buffer>;
|
|
536
552
|
export function TESTING_NonSuspendingBackgroundThreadRuntime_New(): NonSuspendingBackgroundThreadRuntime;
|
|
537
|
-
export function TESTING_OnlyCompletesByCancellation(asyncRuntime: Wrapper<TokioAsyncContext>):
|
|
553
|
+
export function TESTING_OnlyCompletesByCancellation(asyncRuntime: Wrapper<TokioAsyncContext>): CancellablePromise<void>;
|
|
538
554
|
export function TESTING_OtherTestingHandleType_getValue(handle: Wrapper<OtherTestingHandleType>): string;
|
|
539
555
|
export function TESTING_PanicInBodyAsync(_input: null): Promise<void>;
|
|
540
|
-
export function TESTING_PanicInBodyIo(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, _input: null):
|
|
556
|
+
export function TESTING_PanicInBodyIo(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, _input: null): CancellablePromise<void>;
|
|
541
557
|
export function TESTING_PanicInBodySync(_input: null): void;
|
|
542
558
|
export function TESTING_PanicOnBorrowAsync(_input: null): Promise<void>;
|
|
543
|
-
export function TESTING_PanicOnBorrowIo(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, _input: null):
|
|
559
|
+
export function TESTING_PanicOnBorrowIo(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, _input: null): CancellablePromise<void>;
|
|
544
560
|
export function TESTING_PanicOnBorrowSync(_input: null): void;
|
|
545
561
|
export function TESTING_PanicOnLoadAsync(_needsCleanup: null, _input: null): Promise<void>;
|
|
546
|
-
export function TESTING_PanicOnLoadIo(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, _needsCleanup: null, _input: null):
|
|
562
|
+
export function TESTING_PanicOnLoadIo(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, _needsCleanup: null, _input: null): CancellablePromise<void>;
|
|
547
563
|
export function TESTING_PanicOnLoadSync(_needsCleanup: null, _input: null): void;
|
|
548
564
|
export function TESTING_PanicOnReturnAsync(_needsCleanup: null): Promise<null>;
|
|
549
|
-
export function TESTING_PanicOnReturnIo(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, _needsCleanup: null):
|
|
565
|
+
export function TESTING_PanicOnReturnIo(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, _needsCleanup: null): CancellablePromise<null>;
|
|
550
566
|
export function TESTING_PanicOnReturnSync(_needsCleanup: null): null;
|
|
551
567
|
export function TESTING_ProcessBytestringArray(input: Buffer[]): Buffer[];
|
|
552
568
|
export function TESTING_ReturnStringArray(): string[];
|
|
@@ -554,6 +570,11 @@ export function TESTING_ServerMessageAck_Create(): ServerMessageAck;
|
|
|
554
570
|
export function TESTING_TestingHandleType_getValue(handle: Wrapper<TestingHandleType>): number;
|
|
555
571
|
export function TokioAsyncContext_cancel(context: Wrapper<TokioAsyncContext>, rawCancellationId: bigint): void;
|
|
556
572
|
export function TokioAsyncContext_new(): TokioAsyncContext;
|
|
573
|
+
export function UnauthenticatedChatConnection_connect(asyncRuntime: Wrapper<TokioAsyncContext>, connectionManager: Wrapper<ConnectionManager>): CancellablePromise<UnauthenticatedChatConnection>;
|
|
574
|
+
export function UnauthenticatedChatConnection_disconnect(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<UnauthenticatedChatConnection>): CancellablePromise<void>;
|
|
575
|
+
export function UnauthenticatedChatConnection_info(chat: Wrapper<UnauthenticatedChatConnection>): ConnectionInfo;
|
|
576
|
+
export function UnauthenticatedChatConnection_init_listener(chat: Wrapper<UnauthenticatedChatConnection>, listener: ChatListener): void;
|
|
577
|
+
export function UnauthenticatedChatConnection_send(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<UnauthenticatedChatConnection>, httpRequest: Wrapper<HttpRequest>, timeoutMillis: number): CancellablePromise<ChatResponse>;
|
|
557
578
|
export function UnidentifiedSenderMessageContent_Deserialize(data: Buffer): UnidentifiedSenderMessageContent;
|
|
558
579
|
export function UnidentifiedSenderMessageContent_GetContentHint(m: Wrapper<UnidentifiedSenderMessageContent>): number;
|
|
559
580
|
export function UnidentifiedSenderMessageContent_GetContents(obj: Wrapper<UnidentifiedSenderMessageContent>): Buffer;
|
|
@@ -578,10 +599,12 @@ export function initLogger(maxLevel: LogLevel, callback: (level: LogLevel, targe
|
|
|
578
599
|
export function test_only_fn_returns_123(): number;
|
|
579
600
|
interface Aes256GcmSiv { readonly __type: unique symbol; }
|
|
580
601
|
interface AuthChat { readonly __type: unique symbol; }
|
|
602
|
+
interface AuthenticatedChatConnection { readonly __type: unique symbol; }
|
|
581
603
|
interface CdsiLookup { readonly __type: unique symbol; }
|
|
582
604
|
interface CiphertextMessage { readonly __type: unique symbol; }
|
|
583
605
|
interface ComparableBackup { readonly __type: unique symbol; }
|
|
584
606
|
interface ComparableBackup { readonly __type: unique symbol; }
|
|
607
|
+
interface ConnectionInfo { readonly __type: unique symbol; }
|
|
585
608
|
interface ConnectionManager { readonly __type: unique symbol; }
|
|
586
609
|
interface DecryptionErrorMessage { readonly __type: unique symbol; }
|
|
587
610
|
interface ExpiringProfileKeyCredential { readonly __type: unique symbol; }
|
|
@@ -600,6 +623,7 @@ interface KyberSecretKey { readonly __type: unique symbol; }
|
|
|
600
623
|
interface LookupRequest { readonly __type: unique symbol; }
|
|
601
624
|
interface MessageBackupKey { readonly __type: unique symbol; }
|
|
602
625
|
interface NonSuspendingBackgroundThreadRuntime { readonly __type: unique symbol; }
|
|
626
|
+
interface OnlineBackupValidator { readonly __type: unique symbol; }
|
|
603
627
|
interface OtherTestingHandleType { readonly __type: unique symbol; }
|
|
604
628
|
interface PlaintextContent { readonly __type: unique symbol; }
|
|
605
629
|
interface PreKeyBundle { readonly __type: unique symbol; }
|
|
@@ -635,6 +659,7 @@ interface SignedPreKeyRecord { readonly __type: unique symbol; }
|
|
|
635
659
|
interface TestingHandleType { readonly __type: unique symbol; }
|
|
636
660
|
interface TokioAsyncContext { readonly __type: unique symbol; }
|
|
637
661
|
interface UnauthChat { readonly __type: unique symbol; }
|
|
662
|
+
interface UnauthenticatedChatConnection { readonly __type: unique symbol; }
|
|
638
663
|
interface UnidentifiedSenderMessageContent { readonly __type: unique symbol; }
|
|
639
664
|
interface UuidCiphertext { readonly __type: unique symbol; }
|
|
640
665
|
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
|
@@ -2117,7 +2117,7 @@ limitations under the License.
|
|
|
2117
2117
|
|
|
2118
2118
|
```
|
|
2119
2119
|
|
|
2120
|
-
## boring 4.
|
|
2120
|
+
## boring 4.13.0
|
|
2121
2121
|
|
|
2122
2122
|
```
|
|
2123
2123
|
Copyright 2011-2017 Google Inc.
|
|
@@ -2586,7 +2586,7 @@ express Statement of Purpose.
|
|
|
2586
2586
|
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
2587
2587
|
```
|
|
2588
2588
|
|
|
2589
|
-
## boring-sys 4.
|
|
2589
|
+
## boring-sys 4.13.0
|
|
2590
2590
|
|
|
2591
2591
|
```
|
|
2592
2592
|
/* Copyright (c) 2015, Google Inc.
|
|
@@ -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
|
|
@@ -2957,7 +2957,7 @@ DEALINGS IN THE SOFTWARE.
|
|
|
2957
2957
|
|
|
2958
2958
|
```
|
|
2959
2959
|
|
|
2960
|
-
## boring-sys 4.
|
|
2960
|
+
## boring-sys 4.13.0
|
|
2961
2961
|
|
|
2962
2962
|
```
|
|
2963
2963
|
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
|
```
|
|
@@ -3594,7 +3626,7 @@ DEALINGS IN THE SOFTWARE.
|
|
|
3594
3626
|
|
|
3595
3627
|
```
|
|
3596
3628
|
|
|
3597
|
-
## boring-sys 4.
|
|
3629
|
+
## boring-sys 4.13.0
|
|
3598
3630
|
|
|
3599
3631
|
```
|
|
3600
3632
|
Copyright (c) 2015-2016 the fiat-crypto authors (see
|
|
@@ -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
|
```
|
|
@@ -4121,7 +4165,7 @@ SOFTWARE.
|
|
|
4121
4165
|
|
|
4122
4166
|
```
|
|
4123
4167
|
|
|
4124
|
-
## tokio-boring 4.
|
|
4168
|
+
## tokio-boring 4.13.0
|
|
4125
4169
|
|
|
4126
4170
|
```
|
|
4127
4171
|
Copyright (c) 2016 Tokio contributors
|
|
@@ -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
|
|
@@ -5786,6 +5862,31 @@ SOFTWARE.
|
|
|
5786
5862
|
|
|
5787
5863
|
```
|
|
5788
5864
|
|
|
5865
|
+
## openssl-macros 0.1.1
|
|
5866
|
+
|
|
5867
|
+
```
|
|
5868
|
+
Copyright (c) 2022 Steven Fackler
|
|
5869
|
+
|
|
5870
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5871
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5872
|
+
in the Software without restriction, including without limitation the rights
|
|
5873
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
5874
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
5875
|
+
furnished to do so, subject to the following conditions:
|
|
5876
|
+
|
|
5877
|
+
The above copyright notice and this permission notice shall be included in all
|
|
5878
|
+
copies or substantial portions of the Software.
|
|
5879
|
+
|
|
5880
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
5881
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
5882
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
5883
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
5884
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
5885
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
5886
|
+
SOFTWARE.
|
|
5887
|
+
|
|
5888
|
+
```
|
|
5889
|
+
|
|
5789
5890
|
## inout 0.1.3
|
|
5790
5891
|
|
|
5791
5892
|
```
|
|
@@ -6796,6 +6897,33 @@ SOFTWARE.
|
|
|
6796
6897
|
|
|
6797
6898
|
```
|
|
6798
6899
|
|
|
6900
|
+
## visibility 0.1.1
|
|
6901
|
+
|
|
6902
|
+
```
|
|
6903
|
+
MIT License
|
|
6904
|
+
|
|
6905
|
+
Copyright (c) 2024 Daniel Henry-Mantilla
|
|
6906
|
+
|
|
6907
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6908
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6909
|
+
in the Software without restriction, including without limitation the rights
|
|
6910
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
6911
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
6912
|
+
furnished to do so, subject to the following conditions:
|
|
6913
|
+
|
|
6914
|
+
The above copyright notice and this permission notice shall be included in all
|
|
6915
|
+
copies or substantial portions of the Software.
|
|
6916
|
+
|
|
6917
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
6918
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
6919
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
6920
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
6921
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
6922
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
6923
|
+
SOFTWARE.
|
|
6924
|
+
|
|
6925
|
+
```
|
|
6926
|
+
|
|
6799
6927
|
## 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
6928
|
|
|
6801
6929
|
```
|
|
@@ -7640,7 +7768,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
7640
7768
|
SOFTWARE.
|
|
7641
7769
|
```
|
|
7642
7770
|
|
|
7643
|
-
## boring-sys 4.
|
|
7771
|
+
## boring-sys 4.13.0, ring 0.17.8
|
|
7644
7772
|
|
|
7645
7773
|
```
|
|
7646
7774
|
/* ====================================================================
|
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,112 @@ 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);
|
|
83
|
+
const chat = await asyncContext.makeCancellable(options?.abortSignal, connect);
|
|
84
|
+
const connection = newNativeHandle(chat);
|
|
85
|
+
Native.UnauthenticatedChatConnection_init_listener(connection, new WeakListenerWrapper(nativeChatListener));
|
|
86
|
+
return new UnauthenticatedChatConnection(asyncContext, connection, nativeChatListener);
|
|
87
|
+
}
|
|
88
|
+
constructor(asyncContext, chatService,
|
|
89
|
+
// Unused except to keep the listener alive since the Rust code only holds a
|
|
90
|
+
// weak reference to the same object.
|
|
91
|
+
chatListener) {
|
|
92
|
+
this.asyncContext = asyncContext;
|
|
93
|
+
this.chatService = chatService;
|
|
94
|
+
this.chatListener = chatListener;
|
|
95
|
+
}
|
|
96
|
+
fetch(chatRequest, options) {
|
|
97
|
+
return this.asyncContext.makeCancellable(options?.abortSignal, Native.UnauthenticatedChatConnection_send(this.asyncContext, this.chatService, buildHttpRequest(chatRequest), chatRequest.timeoutMillis ?? DEFAULT_CHAT_REQUEST_TIMEOUT_MILLIS));
|
|
98
|
+
}
|
|
99
|
+
disconnect() {
|
|
100
|
+
return Native.UnauthenticatedChatConnection_disconnect(this.asyncContext, this.chatService);
|
|
101
|
+
}
|
|
102
|
+
connectionInfo() {
|
|
103
|
+
return new ConnectionInfoImpl(Native.UnauthenticatedChatConnection_info(this.chatService));
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
exports.UnauthenticatedChatConnection = UnauthenticatedChatConnection;
|
|
107
|
+
class AuthenticatedChatConnection {
|
|
108
|
+
static async connect(asyncContext, connectionManager, username, password, receiveStories, listener, options) {
|
|
109
|
+
const nativeChatListener = makeNativeChatListener(asyncContext, listener);
|
|
110
|
+
const connect = Native.AuthenticatedChatConnection_connect(asyncContext, connectionManager, username, password, receiveStories);
|
|
111
|
+
const chat = await asyncContext.makeCancellable(options?.abortSignal, connect);
|
|
112
|
+
const connection = newNativeHandle(chat);
|
|
113
|
+
Native.AuthenticatedChatConnection_init_listener(connection, new WeakListenerWrapper(nativeChatListener));
|
|
114
|
+
return new AuthenticatedChatConnection(asyncContext, connection, nativeChatListener);
|
|
115
|
+
}
|
|
116
|
+
constructor(asyncContext, chatService,
|
|
117
|
+
// Unused except to keep the listener alive since the Rust code only holds a
|
|
118
|
+
// weak reference to the same object.
|
|
119
|
+
chatListener) {
|
|
120
|
+
this.asyncContext = asyncContext;
|
|
121
|
+
this.chatService = chatService;
|
|
122
|
+
this.chatListener = chatListener;
|
|
123
|
+
}
|
|
124
|
+
fetch(chatRequest, options) {
|
|
125
|
+
return this.asyncContext.makeCancellable(options?.abortSignal, Native.AuthenticatedChatConnection_send(this.asyncContext, this.chatService, buildHttpRequest(chatRequest), chatRequest.timeoutMillis ?? DEFAULT_CHAT_REQUEST_TIMEOUT_MILLIS));
|
|
126
|
+
}
|
|
127
|
+
disconnect() {
|
|
128
|
+
return Native.AuthenticatedChatConnection_disconnect(this.asyncContext, this.chatService);
|
|
129
|
+
}
|
|
130
|
+
connectionInfo() {
|
|
131
|
+
return new ConnectionInfoImpl(Native.AuthenticatedChatConnection_info(this.chatService));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
exports.AuthenticatedChatConnection = AuthenticatedChatConnection;
|
|
135
|
+
/**
|
|
136
|
+
* Holds a {@link Native.ChatListener} by {@link WeakRef} and delegates
|
|
137
|
+
* `ChatListener` calls to it.
|
|
138
|
+
*
|
|
139
|
+
* This lets us avoid passing anything across the bridge that has a normal
|
|
140
|
+
* (strong) reference to the app-side listener. The danger is that the passed-in
|
|
141
|
+
* listener might gain a reference to the JS connection object; that would
|
|
142
|
+
* result in a reference cycle that Node can't clean up because one of the
|
|
143
|
+
* references is through a Rust `Box`.
|
|
144
|
+
*
|
|
145
|
+
* When constructing a connection, calling code should wrap an app-side listener
|
|
146
|
+
* in this type and pass it across the bridge, then hold its own strong
|
|
147
|
+
* reference to the same listener as a field. This ensures that if there is a
|
|
148
|
+
* reference cycle between the connection and app-side listener, that cycle is
|
|
149
|
+
* visible to the Node runtime, while still ensuring the passed-in listener
|
|
150
|
+
* stays alive as long as the connection does.
|
|
151
|
+
*/
|
|
152
|
+
class WeakListenerWrapper {
|
|
153
|
+
constructor(listener) {
|
|
154
|
+
this.listener = new WeakRef(listener);
|
|
155
|
+
}
|
|
156
|
+
_connection_interrupted(reason) {
|
|
157
|
+
this.listener.deref()?._connection_interrupted(reason);
|
|
158
|
+
}
|
|
159
|
+
_incoming_message(envelope, timestamp, ack) {
|
|
160
|
+
this.listener.deref()?._incoming_message(envelope, timestamp, ack);
|
|
161
|
+
}
|
|
162
|
+
_queue_empty() {
|
|
163
|
+
this.listener.deref()?._queue_empty();
|
|
164
|
+
}
|
|
165
|
+
}
|
|
62
166
|
/**
|
|
63
167
|
* Provides API methods to connect and communicate with the Chat Service over an authenticated channel.
|
|
64
168
|
*/
|
|
@@ -100,17 +204,7 @@ class UnauthenticatedChatService {
|
|
|
100
204
|
constructor(asyncContext, connectionManager, listener) {
|
|
101
205
|
this.asyncContext = asyncContext;
|
|
102
206
|
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
|
-
};
|
|
207
|
+
const nativeChatListener = makeNativeChatListener(asyncContext, listener);
|
|
114
208
|
Native.ChatService_SetListenerUnauth(asyncContext, this.chatService, nativeChatListener);
|
|
115
209
|
}
|
|
116
210
|
disconnect() {
|
|
@@ -127,6 +221,32 @@ class UnauthenticatedChatService {
|
|
|
127
221
|
}
|
|
128
222
|
}
|
|
129
223
|
exports.UnauthenticatedChatService = UnauthenticatedChatService;
|
|
224
|
+
function makeNativeChatListener(asyncContext, listener) {
|
|
225
|
+
if ('onQueueEmpty' in listener) {
|
|
226
|
+
return {
|
|
227
|
+
_incoming_message(envelope, timestamp, ack) {
|
|
228
|
+
listener.onIncomingMessage(envelope, timestamp, new ChatServerMessageAck(asyncContext, ack));
|
|
229
|
+
},
|
|
230
|
+
_queue_empty() {
|
|
231
|
+
listener.onQueueEmpty();
|
|
232
|
+
},
|
|
233
|
+
_connection_interrupted(cause) {
|
|
234
|
+
listener.onConnectionInterrupted(cause);
|
|
235
|
+
},
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
return {
|
|
239
|
+
_incoming_message(_envelope, _timestamp, _ack) {
|
|
240
|
+
throw new Error('Event not supported on unauthenticated connection');
|
|
241
|
+
},
|
|
242
|
+
_queue_empty() {
|
|
243
|
+
throw new Error('Event not supported on unauthenticated connection');
|
|
244
|
+
},
|
|
245
|
+
_connection_interrupted(cause) {
|
|
246
|
+
listener.onConnectionInterrupted(cause);
|
|
247
|
+
},
|
|
248
|
+
};
|
|
249
|
+
}
|
|
130
250
|
function buildHttpRequest(chatRequest) {
|
|
131
251
|
const { verb, path, body, headers } = chatRequest;
|
|
132
252
|
const bodyBuffer = body !== undefined ? node_buffer_1.Buffer.from(body) : null;
|
|
@@ -168,6 +288,23 @@ class Net {
|
|
|
168
288
|
newUnauthenticatedChatService(listener) {
|
|
169
289
|
return new UnauthenticatedChatService(this.asyncContext, this.connectionManager, listener);
|
|
170
290
|
}
|
|
291
|
+
/**
|
|
292
|
+
*
|
|
293
|
+
* Creates a new instance of {@link UnauthenticatedChatConnection}.
|
|
294
|
+
* @param listener the listener for incoming events.
|
|
295
|
+
* @param options additional options to pass through.
|
|
296
|
+
* @param options.abortSignal an {@link AbortSignal} that will cancel the connection attempt.
|
|
297
|
+
* @returns the connected listener, if the connection succeeds.
|
|
298
|
+
*/
|
|
299
|
+
async connectUnauthenticatedChat(listener, options) {
|
|
300
|
+
return UnauthenticatedChatConnection.connect(this.asyncContext, this.connectionManager, listener, options);
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Creates a new instance of {@link AuthenticatedChatConnection}.
|
|
304
|
+
*/
|
|
305
|
+
connectAuthenticatedChat(username, password, receiveStories, listener, options) {
|
|
306
|
+
return AuthenticatedChatConnection.connect(this.asyncContext, this.connectionManager, username, password, receiveStories, listener, options);
|
|
307
|
+
}
|
|
171
308
|
/**
|
|
172
309
|
* Enables/disables IPv6 for all new connections (until changed).
|
|
173
310
|
*
|
|
@@ -218,7 +355,7 @@ class Net {
|
|
|
218
355
|
onNetworkChange() {
|
|
219
356
|
Native.ConnectionManager_on_network_change(this.connectionManager);
|
|
220
357
|
}
|
|
221
|
-
async cdsiLookup({ username, password }, { e164s, acisAndAccessKeys,
|
|
358
|
+
async cdsiLookup({ username, password }, { e164s, acisAndAccessKeys, abortSignal, }) {
|
|
222
359
|
const request = newNativeHandle(Native.LookupRequest_new());
|
|
223
360
|
e164s.forEach((e164) => {
|
|
224
361
|
Native.LookupRequest_addE164(request, e164);
|
|
@@ -226,7 +363,6 @@ class Net {
|
|
|
226
363
|
acisAndAccessKeys.forEach(({ aci: aciStr, accessKey: accessKeyStr }) => {
|
|
227
364
|
Native.LookupRequest_addAciAndAccessKey(request, Address_1.Aci.parseFromServiceIdString(aciStr).getServiceIdFixedWidthBinary(), node_buffer_1.Buffer.from(accessKeyStr, 'base64'));
|
|
228
365
|
});
|
|
229
|
-
Native.LookupRequest_setReturnAcisWithoutUaks(request, returnAcisWithoutUaks);
|
|
230
366
|
const lookup = await this.asyncContext.makeCancellable(abortSignal, Native.CdsiLookup_new(this.asyncContext, this.connectionManager, username, password, request));
|
|
231
367
|
return await this.asyncContext.makeCancellable(abortSignal, Native.CdsiLookup_complete(this.asyncContext, newNativeHandle(lookup)));
|
|
232
368
|
}
|
|
@@ -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
|