wolfronix-sdk 2.4.2 → 2.4.4
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/README.md +189 -726
- package/dist/index.d.mts +161 -3
- package/dist/index.d.ts +161 -3
- package/dist/index.global.js +3 -55
- package/dist/index.js +1083 -18470
- package/dist/index.mjs +1071 -36
- package/package.json +4 -4
- package/dist/chunk-EDTKPA2L.mjs +0 -33
- package/dist/undici-BDVTXO27.mjs +0 -18410
package/dist/index.d.mts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Zero-knowledge encryption made simple
|
|
4
4
|
*
|
|
5
5
|
* @package @wolfronix/sdk
|
|
6
|
-
* @version 2.4.
|
|
6
|
+
* @version 2.4.4
|
|
7
7
|
*/
|
|
8
8
|
interface WolfronixConfig {
|
|
9
9
|
/** Wolfronix server base URL */
|
|
@@ -25,6 +25,14 @@ interface AuthResponse {
|
|
|
25
25
|
token: string;
|
|
26
26
|
message: string;
|
|
27
27
|
}
|
|
28
|
+
interface RecoverySetup {
|
|
29
|
+
recoveryPhrase: string;
|
|
30
|
+
recoveryWords: string[];
|
|
31
|
+
}
|
|
32
|
+
interface RegisterOptions {
|
|
33
|
+
enableRecovery?: boolean;
|
|
34
|
+
recoveryPhrase?: string;
|
|
35
|
+
}
|
|
28
36
|
interface EncryptResponse {
|
|
29
37
|
status: string;
|
|
30
38
|
file_id: string;
|
|
@@ -39,6 +47,36 @@ interface EncryptResponse {
|
|
|
39
47
|
/** Any extra fields from the server response */
|
|
40
48
|
[key: string]: unknown;
|
|
41
49
|
}
|
|
50
|
+
interface ChunkedEncryptResult {
|
|
51
|
+
upload_id: string;
|
|
52
|
+
filename: string;
|
|
53
|
+
total_chunks: number;
|
|
54
|
+
chunk_size_bytes: number;
|
|
55
|
+
uploaded_chunks: number;
|
|
56
|
+
chunk_file_ids: string[];
|
|
57
|
+
complete: boolean;
|
|
58
|
+
}
|
|
59
|
+
interface ResumableUploadState {
|
|
60
|
+
upload_id: string;
|
|
61
|
+
filename: string;
|
|
62
|
+
file_size: number;
|
|
63
|
+
chunk_size_bytes: number;
|
|
64
|
+
total_chunks: number;
|
|
65
|
+
uploaded_chunks: number[];
|
|
66
|
+
chunk_file_ids: string[];
|
|
67
|
+
created_at: number;
|
|
68
|
+
updated_at: number;
|
|
69
|
+
}
|
|
70
|
+
interface ResumableEncryptOptions {
|
|
71
|
+
filename?: string;
|
|
72
|
+
chunkSizeBytes?: number;
|
|
73
|
+
existingState?: ResumableUploadState;
|
|
74
|
+
onProgress?: (uploadedChunks: number, totalChunks: number) => void;
|
|
75
|
+
}
|
|
76
|
+
interface ChunkedDecryptManifest {
|
|
77
|
+
filename: string;
|
|
78
|
+
chunk_file_ids: string[];
|
|
79
|
+
}
|
|
42
80
|
interface FileInfo {
|
|
43
81
|
file_id: string;
|
|
44
82
|
original_name: string;
|
|
@@ -71,6 +109,50 @@ interface EncryptMessagePacket {
|
|
|
71
109
|
iv: string;
|
|
72
110
|
msg: string;
|
|
73
111
|
}
|
|
112
|
+
interface GroupEncryptPacket {
|
|
113
|
+
v: 1;
|
|
114
|
+
type: 'group_sender_key';
|
|
115
|
+
sender_id: string;
|
|
116
|
+
group_id: string;
|
|
117
|
+
timestamp: number;
|
|
118
|
+
ciphertext: string;
|
|
119
|
+
iv: string;
|
|
120
|
+
recipient_keys: Record<string, string>;
|
|
121
|
+
}
|
|
122
|
+
interface PfsPreKeyBundle {
|
|
123
|
+
protocol: 'wfx-dr-v1';
|
|
124
|
+
user_id?: string;
|
|
125
|
+
ratchet_pub_jwk: JsonWebKey;
|
|
126
|
+
created_at: number;
|
|
127
|
+
}
|
|
128
|
+
interface PfsMessagePacket {
|
|
129
|
+
v: 1;
|
|
130
|
+
type: 'pfs_ratchet';
|
|
131
|
+
session_id: string;
|
|
132
|
+
n: number;
|
|
133
|
+
pn: number;
|
|
134
|
+
ratchet_pub_jwk: JsonWebKey;
|
|
135
|
+
iv: string;
|
|
136
|
+
ciphertext: string;
|
|
137
|
+
timestamp: number;
|
|
138
|
+
}
|
|
139
|
+
interface PfsSessionState {
|
|
140
|
+
protocol: 'wfx-dr-v1';
|
|
141
|
+
session_id: string;
|
|
142
|
+
role: 'initiator' | 'responder';
|
|
143
|
+
root_key: string;
|
|
144
|
+
send_chain_key: string;
|
|
145
|
+
recv_chain_key: string;
|
|
146
|
+
send_count: number;
|
|
147
|
+
recv_count: number;
|
|
148
|
+
prev_send_count: number;
|
|
149
|
+
my_ratchet_private_jwk: JsonWebKey;
|
|
150
|
+
my_ratchet_public_jwk: JsonWebKey;
|
|
151
|
+
their_ratchet_public_jwk: JsonWebKey;
|
|
152
|
+
skipped_keys: Record<string, string>;
|
|
153
|
+
created_at: number;
|
|
154
|
+
updated_at: number;
|
|
155
|
+
}
|
|
74
156
|
interface ServerEncryptResult {
|
|
75
157
|
/** Base64-encoded ciphertext */
|
|
76
158
|
encrypted_message: string;
|
|
@@ -211,6 +293,9 @@ declare class Wolfronix {
|
|
|
211
293
|
private publicKey;
|
|
212
294
|
private privateKey;
|
|
213
295
|
private publicKeyPEM;
|
|
296
|
+
private pfsIdentityPrivateJwk;
|
|
297
|
+
private pfsIdentityPublicJwk;
|
|
298
|
+
private pfsSessions;
|
|
214
299
|
/** Expose private key status for testing */
|
|
215
300
|
hasPrivateKey(): boolean;
|
|
216
301
|
/**
|
|
@@ -229,6 +314,11 @@ declare class Wolfronix {
|
|
|
229
314
|
private request;
|
|
230
315
|
private sleep;
|
|
231
316
|
private ensureAuthenticated;
|
|
317
|
+
private toBlob;
|
|
318
|
+
private ensurePfsIdentity;
|
|
319
|
+
private getPfsSession;
|
|
320
|
+
private ratchetForSend;
|
|
321
|
+
private ratchetForReceive;
|
|
232
322
|
/**
|
|
233
323
|
* Register a new user
|
|
234
324
|
*
|
|
@@ -237,7 +327,7 @@ declare class Wolfronix {
|
|
|
237
327
|
* const { user_id, token } = await wfx.register('user@example.com', 'password123');
|
|
238
328
|
* ```
|
|
239
329
|
*/
|
|
240
|
-
register(email: string, password: string): Promise<AuthResponse
|
|
330
|
+
register(email: string, password: string, options?: RegisterOptions): Promise<AuthResponse & Partial<RecoverySetup>>;
|
|
241
331
|
/**
|
|
242
332
|
* Login with existing credentials
|
|
243
333
|
*
|
|
@@ -247,6 +337,20 @@ declare class Wolfronix {
|
|
|
247
337
|
* ```
|
|
248
338
|
*/
|
|
249
339
|
login(email: string, password: string): Promise<AuthResponse>;
|
|
340
|
+
/**
|
|
341
|
+
* Recover account keys using a 24-word recovery phrase and set a new password.
|
|
342
|
+
* Returns a fresh local auth session if recovery succeeds.
|
|
343
|
+
*/
|
|
344
|
+
recoverAccount(email: string, recoveryPhrase: string, newPassword: string): Promise<AuthResponse>;
|
|
345
|
+
/**
|
|
346
|
+
* Rotates long-term RSA identity keys and re-wraps with password (+ optional recovery phrase).
|
|
347
|
+
* Use this periodically to reduce long-term key exposure.
|
|
348
|
+
*/
|
|
349
|
+
rotateIdentityKeys(password: string, recoveryPhrase?: string): Promise<{
|
|
350
|
+
success: boolean;
|
|
351
|
+
message: string;
|
|
352
|
+
recoveryPhrase?: string;
|
|
353
|
+
}>;
|
|
250
354
|
/**
|
|
251
355
|
* Set authentication token directly (useful for server-side apps)
|
|
252
356
|
*
|
|
@@ -283,6 +387,15 @@ declare class Wolfronix {
|
|
|
283
387
|
* ```
|
|
284
388
|
*/
|
|
285
389
|
encrypt(file: File | Blob | ArrayBuffer | Uint8Array, filename?: string): Promise<EncryptResponse>;
|
|
390
|
+
/**
|
|
391
|
+
* Resumable large-file encryption upload.
|
|
392
|
+
* Splits a file into chunks (default 10MB) and uploads each chunk independently.
|
|
393
|
+
* If upload fails mid-way, pass the returned state as `existingState` to resume.
|
|
394
|
+
*/
|
|
395
|
+
encryptResumable(file: File | Blob | ArrayBuffer | Uint8Array, options?: ResumableEncryptOptions): Promise<{
|
|
396
|
+
result: ChunkedEncryptResult;
|
|
397
|
+
state: ResumableUploadState;
|
|
398
|
+
}>;
|
|
286
399
|
/**
|
|
287
400
|
* Decrypt and retrieve a file using zero-knowledge flow.
|
|
288
401
|
*
|
|
@@ -309,6 +422,15 @@ declare class Wolfronix {
|
|
|
309
422
|
* Decrypt and return as ArrayBuffer (zero-knowledge flow)
|
|
310
423
|
*/
|
|
311
424
|
decryptToBuffer(fileId: string, role?: string): Promise<ArrayBuffer>;
|
|
425
|
+
/**
|
|
426
|
+
* Decrypts and reassembles a chunked upload produced by `encryptResumable`.
|
|
427
|
+
*/
|
|
428
|
+
decryptChunkedToBuffer(manifest: ChunkedDecryptManifest, role?: string): Promise<ArrayBuffer>;
|
|
429
|
+
/**
|
|
430
|
+
* Decrypts and reassembles a chunked upload into a Blob.
|
|
431
|
+
* This is a browser-friendly alias over `decryptChunkedToBuffer`.
|
|
432
|
+
*/
|
|
433
|
+
decryptChunkedManifest(manifest: ChunkedDecryptManifest, role?: string): Promise<Blob>;
|
|
312
434
|
/**
|
|
313
435
|
* Fetch the encrypted key_part_a for a file (for client-side decryption)
|
|
314
436
|
*
|
|
@@ -355,6 +477,42 @@ declare class Wolfronix {
|
|
|
355
477
|
* @param packetJson The secure JSON string packet
|
|
356
478
|
*/
|
|
357
479
|
decryptMessage(packetJson: string): Promise<string>;
|
|
480
|
+
/**
|
|
481
|
+
* Create/share a pre-key bundle for Double Ratchet PFS session setup.
|
|
482
|
+
* Exchange this bundle out-of-band with the peer.
|
|
483
|
+
*/
|
|
484
|
+
createPfsPreKeyBundle(): Promise<PfsPreKeyBundle>;
|
|
485
|
+
/**
|
|
486
|
+
* Initialize a local PFS ratchet session from peer bundle.
|
|
487
|
+
* Both sides must call this with opposite `asInitiator` values.
|
|
488
|
+
*/
|
|
489
|
+
initPfsSession(sessionId: string, peerBundle: PfsPreKeyBundle, asInitiator: boolean): Promise<PfsSessionState>;
|
|
490
|
+
/**
|
|
491
|
+
* Export session state for persistence (e.g., localStorage/DB).
|
|
492
|
+
*/
|
|
493
|
+
exportPfsSession(sessionId: string): PfsSessionState;
|
|
494
|
+
/**
|
|
495
|
+
* Import session state from storage.
|
|
496
|
+
*/
|
|
497
|
+
importPfsSession(session: PfsSessionState): void;
|
|
498
|
+
/**
|
|
499
|
+
* Encrypt a message using Double Ratchet session state.
|
|
500
|
+
*/
|
|
501
|
+
pfsEncryptMessage(sessionId: string, plaintext: string): Promise<PfsMessagePacket>;
|
|
502
|
+
/**
|
|
503
|
+
* Decrypt a Double Ratchet packet for a session.
|
|
504
|
+
* Handles basic out-of-order delivery through skipped message keys.
|
|
505
|
+
*/
|
|
506
|
+
pfsDecryptMessage(sessionId: string, packet: PfsMessagePacket | string): Promise<string>;
|
|
507
|
+
/**
|
|
508
|
+
* Group message encryption using sender-key fanout:
|
|
509
|
+
* message encrypted once with AES key, AES key wrapped for each group member with their RSA public key.
|
|
510
|
+
*/
|
|
511
|
+
encryptGroupMessage(text: string, groupId: string, recipientIds: string[]): Promise<string>;
|
|
512
|
+
/**
|
|
513
|
+
* Decrypt a packet produced by `encryptGroupMessage`.
|
|
514
|
+
*/
|
|
515
|
+
decryptGroupMessage(packetJson: string): Promise<string>;
|
|
358
516
|
/**
|
|
359
517
|
* Encrypt a text message via the Wolfronix server (dual-key split).
|
|
360
518
|
* The server generates an AES key, encrypts the message, and splits the key —
|
|
@@ -615,4 +773,4 @@ declare class WolfronixAdmin {
|
|
|
615
773
|
healthCheck(): Promise<boolean>;
|
|
616
774
|
}
|
|
617
775
|
|
|
618
|
-
export { type AuthResponse, AuthenticationError, type DBType, type DeactivateClientResponse, type DeleteResponse, type EncryptMessagePacket, type EncryptResponse, type EnterpriseClient, type FileInfo, FileNotFoundError, type KeyPartResponse, type ListClientsResponse, type ListFilesResponse, type MetricsResponse, NetworkError, PermissionDeniedError, type RegisterClientRequest, type RegisterClientResponse, type ServerBatchEncryptResult, type ServerDecryptParams, type ServerEncryptResult, type StreamChunk, type StreamSession, type UpdateClientRequest, type UpdateClientResponse, ValidationError, Wolfronix, WolfronixAdmin, type WolfronixAdminConfig, type WolfronixConfig, WolfronixError, WolfronixStream, createClient, Wolfronix as default };
|
|
776
|
+
export { type AuthResponse, AuthenticationError, type ChunkedDecryptManifest, type ChunkedEncryptResult, type DBType, type DeactivateClientResponse, type DeleteResponse, type EncryptMessagePacket, type EncryptResponse, type EnterpriseClient, type FileInfo, FileNotFoundError, type GroupEncryptPacket, type KeyPartResponse, type ListClientsResponse, type ListFilesResponse, type MetricsResponse, NetworkError, PermissionDeniedError, type PfsMessagePacket, type PfsPreKeyBundle, type PfsSessionState, type RecoverySetup, type RegisterClientRequest, type RegisterClientResponse, type RegisterOptions, type ResumableEncryptOptions, type ResumableUploadState, type ServerBatchEncryptResult, type ServerDecryptParams, type ServerEncryptResult, type StreamChunk, type StreamSession, type UpdateClientRequest, type UpdateClientResponse, ValidationError, Wolfronix, WolfronixAdmin, type WolfronixAdminConfig, type WolfronixConfig, WolfronixError, WolfronixStream, createClient, Wolfronix as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Zero-knowledge encryption made simple
|
|
4
4
|
*
|
|
5
5
|
* @package @wolfronix/sdk
|
|
6
|
-
* @version 2.4.
|
|
6
|
+
* @version 2.4.4
|
|
7
7
|
*/
|
|
8
8
|
interface WolfronixConfig {
|
|
9
9
|
/** Wolfronix server base URL */
|
|
@@ -25,6 +25,14 @@ interface AuthResponse {
|
|
|
25
25
|
token: string;
|
|
26
26
|
message: string;
|
|
27
27
|
}
|
|
28
|
+
interface RecoverySetup {
|
|
29
|
+
recoveryPhrase: string;
|
|
30
|
+
recoveryWords: string[];
|
|
31
|
+
}
|
|
32
|
+
interface RegisterOptions {
|
|
33
|
+
enableRecovery?: boolean;
|
|
34
|
+
recoveryPhrase?: string;
|
|
35
|
+
}
|
|
28
36
|
interface EncryptResponse {
|
|
29
37
|
status: string;
|
|
30
38
|
file_id: string;
|
|
@@ -39,6 +47,36 @@ interface EncryptResponse {
|
|
|
39
47
|
/** Any extra fields from the server response */
|
|
40
48
|
[key: string]: unknown;
|
|
41
49
|
}
|
|
50
|
+
interface ChunkedEncryptResult {
|
|
51
|
+
upload_id: string;
|
|
52
|
+
filename: string;
|
|
53
|
+
total_chunks: number;
|
|
54
|
+
chunk_size_bytes: number;
|
|
55
|
+
uploaded_chunks: number;
|
|
56
|
+
chunk_file_ids: string[];
|
|
57
|
+
complete: boolean;
|
|
58
|
+
}
|
|
59
|
+
interface ResumableUploadState {
|
|
60
|
+
upload_id: string;
|
|
61
|
+
filename: string;
|
|
62
|
+
file_size: number;
|
|
63
|
+
chunk_size_bytes: number;
|
|
64
|
+
total_chunks: number;
|
|
65
|
+
uploaded_chunks: number[];
|
|
66
|
+
chunk_file_ids: string[];
|
|
67
|
+
created_at: number;
|
|
68
|
+
updated_at: number;
|
|
69
|
+
}
|
|
70
|
+
interface ResumableEncryptOptions {
|
|
71
|
+
filename?: string;
|
|
72
|
+
chunkSizeBytes?: number;
|
|
73
|
+
existingState?: ResumableUploadState;
|
|
74
|
+
onProgress?: (uploadedChunks: number, totalChunks: number) => void;
|
|
75
|
+
}
|
|
76
|
+
interface ChunkedDecryptManifest {
|
|
77
|
+
filename: string;
|
|
78
|
+
chunk_file_ids: string[];
|
|
79
|
+
}
|
|
42
80
|
interface FileInfo {
|
|
43
81
|
file_id: string;
|
|
44
82
|
original_name: string;
|
|
@@ -71,6 +109,50 @@ interface EncryptMessagePacket {
|
|
|
71
109
|
iv: string;
|
|
72
110
|
msg: string;
|
|
73
111
|
}
|
|
112
|
+
interface GroupEncryptPacket {
|
|
113
|
+
v: 1;
|
|
114
|
+
type: 'group_sender_key';
|
|
115
|
+
sender_id: string;
|
|
116
|
+
group_id: string;
|
|
117
|
+
timestamp: number;
|
|
118
|
+
ciphertext: string;
|
|
119
|
+
iv: string;
|
|
120
|
+
recipient_keys: Record<string, string>;
|
|
121
|
+
}
|
|
122
|
+
interface PfsPreKeyBundle {
|
|
123
|
+
protocol: 'wfx-dr-v1';
|
|
124
|
+
user_id?: string;
|
|
125
|
+
ratchet_pub_jwk: JsonWebKey;
|
|
126
|
+
created_at: number;
|
|
127
|
+
}
|
|
128
|
+
interface PfsMessagePacket {
|
|
129
|
+
v: 1;
|
|
130
|
+
type: 'pfs_ratchet';
|
|
131
|
+
session_id: string;
|
|
132
|
+
n: number;
|
|
133
|
+
pn: number;
|
|
134
|
+
ratchet_pub_jwk: JsonWebKey;
|
|
135
|
+
iv: string;
|
|
136
|
+
ciphertext: string;
|
|
137
|
+
timestamp: number;
|
|
138
|
+
}
|
|
139
|
+
interface PfsSessionState {
|
|
140
|
+
protocol: 'wfx-dr-v1';
|
|
141
|
+
session_id: string;
|
|
142
|
+
role: 'initiator' | 'responder';
|
|
143
|
+
root_key: string;
|
|
144
|
+
send_chain_key: string;
|
|
145
|
+
recv_chain_key: string;
|
|
146
|
+
send_count: number;
|
|
147
|
+
recv_count: number;
|
|
148
|
+
prev_send_count: number;
|
|
149
|
+
my_ratchet_private_jwk: JsonWebKey;
|
|
150
|
+
my_ratchet_public_jwk: JsonWebKey;
|
|
151
|
+
their_ratchet_public_jwk: JsonWebKey;
|
|
152
|
+
skipped_keys: Record<string, string>;
|
|
153
|
+
created_at: number;
|
|
154
|
+
updated_at: number;
|
|
155
|
+
}
|
|
74
156
|
interface ServerEncryptResult {
|
|
75
157
|
/** Base64-encoded ciphertext */
|
|
76
158
|
encrypted_message: string;
|
|
@@ -211,6 +293,9 @@ declare class Wolfronix {
|
|
|
211
293
|
private publicKey;
|
|
212
294
|
private privateKey;
|
|
213
295
|
private publicKeyPEM;
|
|
296
|
+
private pfsIdentityPrivateJwk;
|
|
297
|
+
private pfsIdentityPublicJwk;
|
|
298
|
+
private pfsSessions;
|
|
214
299
|
/** Expose private key status for testing */
|
|
215
300
|
hasPrivateKey(): boolean;
|
|
216
301
|
/**
|
|
@@ -229,6 +314,11 @@ declare class Wolfronix {
|
|
|
229
314
|
private request;
|
|
230
315
|
private sleep;
|
|
231
316
|
private ensureAuthenticated;
|
|
317
|
+
private toBlob;
|
|
318
|
+
private ensurePfsIdentity;
|
|
319
|
+
private getPfsSession;
|
|
320
|
+
private ratchetForSend;
|
|
321
|
+
private ratchetForReceive;
|
|
232
322
|
/**
|
|
233
323
|
* Register a new user
|
|
234
324
|
*
|
|
@@ -237,7 +327,7 @@ declare class Wolfronix {
|
|
|
237
327
|
* const { user_id, token } = await wfx.register('user@example.com', 'password123');
|
|
238
328
|
* ```
|
|
239
329
|
*/
|
|
240
|
-
register(email: string, password: string): Promise<AuthResponse
|
|
330
|
+
register(email: string, password: string, options?: RegisterOptions): Promise<AuthResponse & Partial<RecoverySetup>>;
|
|
241
331
|
/**
|
|
242
332
|
* Login with existing credentials
|
|
243
333
|
*
|
|
@@ -247,6 +337,20 @@ declare class Wolfronix {
|
|
|
247
337
|
* ```
|
|
248
338
|
*/
|
|
249
339
|
login(email: string, password: string): Promise<AuthResponse>;
|
|
340
|
+
/**
|
|
341
|
+
* Recover account keys using a 24-word recovery phrase and set a new password.
|
|
342
|
+
* Returns a fresh local auth session if recovery succeeds.
|
|
343
|
+
*/
|
|
344
|
+
recoverAccount(email: string, recoveryPhrase: string, newPassword: string): Promise<AuthResponse>;
|
|
345
|
+
/**
|
|
346
|
+
* Rotates long-term RSA identity keys and re-wraps with password (+ optional recovery phrase).
|
|
347
|
+
* Use this periodically to reduce long-term key exposure.
|
|
348
|
+
*/
|
|
349
|
+
rotateIdentityKeys(password: string, recoveryPhrase?: string): Promise<{
|
|
350
|
+
success: boolean;
|
|
351
|
+
message: string;
|
|
352
|
+
recoveryPhrase?: string;
|
|
353
|
+
}>;
|
|
250
354
|
/**
|
|
251
355
|
* Set authentication token directly (useful for server-side apps)
|
|
252
356
|
*
|
|
@@ -283,6 +387,15 @@ declare class Wolfronix {
|
|
|
283
387
|
* ```
|
|
284
388
|
*/
|
|
285
389
|
encrypt(file: File | Blob | ArrayBuffer | Uint8Array, filename?: string): Promise<EncryptResponse>;
|
|
390
|
+
/**
|
|
391
|
+
* Resumable large-file encryption upload.
|
|
392
|
+
* Splits a file into chunks (default 10MB) and uploads each chunk independently.
|
|
393
|
+
* If upload fails mid-way, pass the returned state as `existingState` to resume.
|
|
394
|
+
*/
|
|
395
|
+
encryptResumable(file: File | Blob | ArrayBuffer | Uint8Array, options?: ResumableEncryptOptions): Promise<{
|
|
396
|
+
result: ChunkedEncryptResult;
|
|
397
|
+
state: ResumableUploadState;
|
|
398
|
+
}>;
|
|
286
399
|
/**
|
|
287
400
|
* Decrypt and retrieve a file using zero-knowledge flow.
|
|
288
401
|
*
|
|
@@ -309,6 +422,15 @@ declare class Wolfronix {
|
|
|
309
422
|
* Decrypt and return as ArrayBuffer (zero-knowledge flow)
|
|
310
423
|
*/
|
|
311
424
|
decryptToBuffer(fileId: string, role?: string): Promise<ArrayBuffer>;
|
|
425
|
+
/**
|
|
426
|
+
* Decrypts and reassembles a chunked upload produced by `encryptResumable`.
|
|
427
|
+
*/
|
|
428
|
+
decryptChunkedToBuffer(manifest: ChunkedDecryptManifest, role?: string): Promise<ArrayBuffer>;
|
|
429
|
+
/**
|
|
430
|
+
* Decrypts and reassembles a chunked upload into a Blob.
|
|
431
|
+
* This is a browser-friendly alias over `decryptChunkedToBuffer`.
|
|
432
|
+
*/
|
|
433
|
+
decryptChunkedManifest(manifest: ChunkedDecryptManifest, role?: string): Promise<Blob>;
|
|
312
434
|
/**
|
|
313
435
|
* Fetch the encrypted key_part_a for a file (for client-side decryption)
|
|
314
436
|
*
|
|
@@ -355,6 +477,42 @@ declare class Wolfronix {
|
|
|
355
477
|
* @param packetJson The secure JSON string packet
|
|
356
478
|
*/
|
|
357
479
|
decryptMessage(packetJson: string): Promise<string>;
|
|
480
|
+
/**
|
|
481
|
+
* Create/share a pre-key bundle for Double Ratchet PFS session setup.
|
|
482
|
+
* Exchange this bundle out-of-band with the peer.
|
|
483
|
+
*/
|
|
484
|
+
createPfsPreKeyBundle(): Promise<PfsPreKeyBundle>;
|
|
485
|
+
/**
|
|
486
|
+
* Initialize a local PFS ratchet session from peer bundle.
|
|
487
|
+
* Both sides must call this with opposite `asInitiator` values.
|
|
488
|
+
*/
|
|
489
|
+
initPfsSession(sessionId: string, peerBundle: PfsPreKeyBundle, asInitiator: boolean): Promise<PfsSessionState>;
|
|
490
|
+
/**
|
|
491
|
+
* Export session state for persistence (e.g., localStorage/DB).
|
|
492
|
+
*/
|
|
493
|
+
exportPfsSession(sessionId: string): PfsSessionState;
|
|
494
|
+
/**
|
|
495
|
+
* Import session state from storage.
|
|
496
|
+
*/
|
|
497
|
+
importPfsSession(session: PfsSessionState): void;
|
|
498
|
+
/**
|
|
499
|
+
* Encrypt a message using Double Ratchet session state.
|
|
500
|
+
*/
|
|
501
|
+
pfsEncryptMessage(sessionId: string, plaintext: string): Promise<PfsMessagePacket>;
|
|
502
|
+
/**
|
|
503
|
+
* Decrypt a Double Ratchet packet for a session.
|
|
504
|
+
* Handles basic out-of-order delivery through skipped message keys.
|
|
505
|
+
*/
|
|
506
|
+
pfsDecryptMessage(sessionId: string, packet: PfsMessagePacket | string): Promise<string>;
|
|
507
|
+
/**
|
|
508
|
+
* Group message encryption using sender-key fanout:
|
|
509
|
+
* message encrypted once with AES key, AES key wrapped for each group member with their RSA public key.
|
|
510
|
+
*/
|
|
511
|
+
encryptGroupMessage(text: string, groupId: string, recipientIds: string[]): Promise<string>;
|
|
512
|
+
/**
|
|
513
|
+
* Decrypt a packet produced by `encryptGroupMessage`.
|
|
514
|
+
*/
|
|
515
|
+
decryptGroupMessage(packetJson: string): Promise<string>;
|
|
358
516
|
/**
|
|
359
517
|
* Encrypt a text message via the Wolfronix server (dual-key split).
|
|
360
518
|
* The server generates an AES key, encrypts the message, and splits the key —
|
|
@@ -615,4 +773,4 @@ declare class WolfronixAdmin {
|
|
|
615
773
|
healthCheck(): Promise<boolean>;
|
|
616
774
|
}
|
|
617
775
|
|
|
618
|
-
export { type AuthResponse, AuthenticationError, type DBType, type DeactivateClientResponse, type DeleteResponse, type EncryptMessagePacket, type EncryptResponse, type EnterpriseClient, type FileInfo, FileNotFoundError, type KeyPartResponse, type ListClientsResponse, type ListFilesResponse, type MetricsResponse, NetworkError, PermissionDeniedError, type RegisterClientRequest, type RegisterClientResponse, type ServerBatchEncryptResult, type ServerDecryptParams, type ServerEncryptResult, type StreamChunk, type StreamSession, type UpdateClientRequest, type UpdateClientResponse, ValidationError, Wolfronix, WolfronixAdmin, type WolfronixAdminConfig, type WolfronixConfig, WolfronixError, WolfronixStream, createClient, Wolfronix as default };
|
|
776
|
+
export { type AuthResponse, AuthenticationError, type ChunkedDecryptManifest, type ChunkedEncryptResult, type DBType, type DeactivateClientResponse, type DeleteResponse, type EncryptMessagePacket, type EncryptResponse, type EnterpriseClient, type FileInfo, FileNotFoundError, type GroupEncryptPacket, type KeyPartResponse, type ListClientsResponse, type ListFilesResponse, type MetricsResponse, NetworkError, PermissionDeniedError, type PfsMessagePacket, type PfsPreKeyBundle, type PfsSessionState, type RecoverySetup, type RegisterClientRequest, type RegisterClientResponse, type RegisterOptions, type ResumableEncryptOptions, type ResumableUploadState, type ServerBatchEncryptResult, type ServerDecryptParams, type ServerEncryptResult, type StreamChunk, type StreamSession, type UpdateClientRequest, type UpdateClientResponse, ValidationError, Wolfronix, WolfronixAdmin, type WolfronixAdminConfig, type WolfronixConfig, WolfronixError, WolfronixStream, createClient, Wolfronix as default };
|