@wireapp/core-crypto 1.0.0-rc.57 → 1.0.0-rc.58
Sign up to get free protection for your applications and to get access to all the features.
package/package.json
CHANGED
Binary file
|
@@ -351,10 +351,6 @@ export interface CoreCryptoDeferredParams {
|
|
351
351
|
* This should be appropriately stored in a secure location (i.e. WebCrypto private key storage)
|
352
352
|
*/
|
353
353
|
key: string;
|
354
|
-
/**
|
355
|
-
* All the ciphersuites this MLS client can support
|
356
|
-
*/
|
357
|
-
ciphersuites: Ciphersuite[];
|
358
354
|
/**
|
359
355
|
* External PRNG entropy pool seed.
|
360
356
|
* This **must** be exactly 32 bytes
|
@@ -364,10 +360,6 @@ export interface CoreCryptoDeferredParams {
|
|
364
360
|
* .wasm file path, this will be useful in case your bundling system likes to relocate files (i.e. what webpack does)
|
365
361
|
*/
|
366
362
|
wasmFilePath?: string;
|
367
|
-
/**
|
368
|
-
* Number of initial KeyPackage to create when initializing the client
|
369
|
-
*/
|
370
|
-
nbKeyPackage?: number;
|
371
363
|
}
|
372
364
|
/**
|
373
365
|
* Params for CoreCrypto initialization
|
@@ -379,6 +371,14 @@ export interface CoreCryptoParams extends CoreCryptoDeferredParams {
|
|
379
371
|
* This should stay consistent as it will be verified against the stored signature & identity to validate the persisted credential
|
380
372
|
*/
|
381
373
|
clientId: ClientId;
|
374
|
+
/**
|
375
|
+
* All the ciphersuites this MLS client can support
|
376
|
+
*/
|
377
|
+
ciphersuites: Ciphersuite[];
|
378
|
+
/**
|
379
|
+
* Number of initial KeyPackage to create when initializing the client
|
380
|
+
*/
|
381
|
+
nbKeyPackage?: number;
|
382
382
|
}
|
383
383
|
export interface ConversationInitBundle {
|
384
384
|
/**
|
@@ -799,7 +799,7 @@ export declare class CoreCrypto {
|
|
799
799
|
* Use this clientId to initialize MLS with {@link CoreCrypto.mlsInit}.
|
800
800
|
* @param params - {@link CoreCryptoDeferredParams}
|
801
801
|
*/
|
802
|
-
static deferredInit({ databaseName, key,
|
802
|
+
static deferredInit({ databaseName, key, entropySeed, wasmFilePath, }: CoreCryptoDeferredParams): Promise<CoreCrypto>;
|
803
803
|
/**
|
804
804
|
* Use this after {@link CoreCrypto.deferredInit} when you have a clientId. It initializes MLS.
|
805
805
|
*
|
@@ -1,12 +1,4 @@
|
|
1
1
|
// bindings/js/wasm/core-crypto-ffi.js
|
2
|
-
var addHeapObject = function(obj) {
|
3
|
-
if (heap_next === heap.length)
|
4
|
-
heap.push(heap.length + 1);
|
5
|
-
const idx = heap_next;
|
6
|
-
heap_next = heap[idx];
|
7
|
-
heap[idx] = obj;
|
8
|
-
return idx;
|
9
|
-
};
|
10
2
|
var getObject = function(idx) {
|
11
3
|
return heap[idx];
|
12
4
|
};
|
@@ -21,6 +13,14 @@ var takeObject = function(idx) {
|
|
21
13
|
dropObject(idx);
|
22
14
|
return ret;
|
23
15
|
};
|
16
|
+
var addHeapObject = function(obj) {
|
17
|
+
if (heap_next === heap.length)
|
18
|
+
heap.push(heap.length + 1);
|
19
|
+
const idx = heap_next;
|
20
|
+
heap_next = heap[idx];
|
21
|
+
heap[idx] = obj;
|
22
|
+
return idx;
|
23
|
+
};
|
24
24
|
var getUint8Memory0 = function() {
|
25
25
|
if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
|
26
26
|
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
@@ -265,61 +265,61 @@ async function __wbg_load(module, imports) {
|
|
265
265
|
var __wbg_get_imports = function() {
|
266
266
|
const imports = {};
|
267
267
|
imports.wbg = {};
|
268
|
-
imports.wbg.
|
269
|
-
|
268
|
+
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
269
|
+
takeObject(arg0);
|
270
|
+
};
|
271
|
+
imports.wbg.__wbg_corecrypto_new = function(arg0) {
|
272
|
+
const ret = CoreCrypto.__wrap(arg0);
|
270
273
|
return addHeapObject(ret);
|
271
274
|
};
|
272
275
|
imports.wbg.__wbg_buffereddecryptedmessage_new = function(arg0) {
|
273
276
|
const ret = BufferedDecryptedMessage.__wrap(arg0);
|
274
277
|
return addHeapObject(ret);
|
275
278
|
};
|
276
|
-
imports.wbg.__wbg_proteusautoprekeybundle_new = function(arg0) {
|
277
|
-
const ret = ProteusAutoPrekeyBundle.__wrap(arg0);
|
278
|
-
return addHeapObject(ret);
|
279
|
-
};
|
280
279
|
imports.wbg.__wbindgen_number_new = function(arg0) {
|
281
280
|
const ret = arg0;
|
282
281
|
return addHeapObject(ret);
|
283
282
|
};
|
284
|
-
imports.wbg.
|
285
|
-
const ret =
|
283
|
+
imports.wbg.__wbg_proposalbundle_new = function(arg0) {
|
284
|
+
const ret = ProposalBundle.__wrap(arg0);
|
286
285
|
return addHeapObject(ret);
|
287
286
|
};
|
288
|
-
imports.wbg.
|
289
|
-
const ret =
|
287
|
+
imports.wbg.__wbg_newacmeauthz_new = function(arg0) {
|
288
|
+
const ret = NewAcmeAuthz.__wrap(arg0);
|
290
289
|
return addHeapObject(ret);
|
291
290
|
};
|
292
|
-
imports.wbg.
|
293
|
-
|
294
|
-
};
|
295
|
-
imports.wbg.__wbg_proposalbundle_new = function(arg0) {
|
296
|
-
const ret = ProposalBundle.__wrap(arg0);
|
291
|
+
imports.wbg.__wbg_ffiwiree2eidentity_new = function(arg0) {
|
292
|
+
const ret = FfiWireE2EIdentity.__wrap(arg0);
|
297
293
|
return addHeapObject(ret);
|
298
294
|
};
|
299
295
|
imports.wbg.__wbg_commitbundle_new = function(arg0) {
|
300
296
|
const ret = CommitBundle.__wrap(arg0);
|
301
297
|
return addHeapObject(ret);
|
302
298
|
};
|
303
|
-
imports.wbg.
|
304
|
-
const ret =
|
299
|
+
imports.wbg.__wbg_acmedirectory_new = function(arg0) {
|
300
|
+
const ret = AcmeDirectory.__wrap(arg0);
|
305
301
|
return addHeapObject(ret);
|
306
302
|
};
|
307
|
-
imports.wbg.
|
308
|
-
const ret =
|
303
|
+
imports.wbg.__wbg_proteusautoprekeybundle_new = function(arg0) {
|
304
|
+
const ret = ProteusAutoPrekeyBundle.__wrap(arg0);
|
309
305
|
return addHeapObject(ret);
|
310
306
|
};
|
311
|
-
imports.wbg.
|
312
|
-
const ret =
|
307
|
+
imports.wbg.__wbg_newacmeorder_new = function(arg0) {
|
308
|
+
const ret = NewAcmeOrder.__wrap(arg0);
|
313
309
|
return addHeapObject(ret);
|
314
310
|
};
|
315
|
-
imports.wbg.
|
316
|
-
const ret =
|
311
|
+
imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
|
312
|
+
const ret = getObject(arg0);
|
317
313
|
return addHeapObject(ret);
|
318
314
|
};
|
319
315
|
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
320
316
|
const ret = getStringFromWasm0(arg0, arg1);
|
321
317
|
return addHeapObject(ret);
|
322
318
|
};
|
319
|
+
imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
|
320
|
+
const ret = BigInt.asUintN(64, arg0);
|
321
|
+
return addHeapObject(ret);
|
322
|
+
};
|
323
323
|
imports.wbg.__wbindgen_is_undefined = function(arg0) {
|
324
324
|
const ret = getObject(arg0) === undefined;
|
325
325
|
return ret;
|
@@ -983,7 +983,7 @@ var __wbg_get_imports = function() {
|
|
983
983
|
const ret = makeMutClosure(arg0, arg1, 667, __wbg_adapter_54);
|
984
984
|
return addHeapObject(ret);
|
985
985
|
};
|
986
|
-
imports.wbg.
|
986
|
+
imports.wbg.__wbindgen_closure_wrapper13251 = function(arg0, arg1, arg2) {
|
987
987
|
const ret = makeMutClosure(arg0, arg1, 2142, __wbg_adapter_57);
|
988
988
|
return addHeapObject(ret);
|
989
989
|
};
|
@@ -1051,26 +1051,6 @@ var CLOSURE_DTORS = typeof FinalizationRegistry === "undefined" ? { register: ()
|
|
1051
1051
|
});
|
1052
1052
|
var cachedUint32Memory0 = null;
|
1053
1053
|
var cachedUint16Memory0 = null;
|
1054
|
-
var DeviceStatus = Object.freeze({
|
1055
|
-
Valid: 1,
|
1056
|
-
"1": "Valid",
|
1057
|
-
Expired: 2,
|
1058
|
-
"2": "Expired",
|
1059
|
-
Revoked: 3,
|
1060
|
-
"3": "Revoked"
|
1061
|
-
});
|
1062
|
-
var WirePolicy = Object.freeze({
|
1063
|
-
Plaintext: 1,
|
1064
|
-
"1": "Plaintext",
|
1065
|
-
Ciphertext: 2,
|
1066
|
-
"2": "Ciphertext"
|
1067
|
-
});
|
1068
|
-
var CredentialType = Object.freeze({
|
1069
|
-
Basic: 1,
|
1070
|
-
"1": "Basic",
|
1071
|
-
X509: 2,
|
1072
|
-
"2": "X509"
|
1073
|
-
});
|
1074
1054
|
var Ciphersuite = Object.freeze({
|
1075
1055
|
MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519: 1,
|
1076
1056
|
"1": "MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519",
|
@@ -1089,6 +1069,26 @@ var Ciphersuite = Object.freeze({
|
|
1089
1069
|
MLS_128_X25519KYBER768DRAFT00_AES128GCM_SHA256_Ed25519: 61489,
|
1090
1070
|
"61489": "MLS_128_X25519KYBER768DRAFT00_AES128GCM_SHA256_Ed25519"
|
1091
1071
|
});
|
1072
|
+
var WirePolicy = Object.freeze({
|
1073
|
+
Plaintext: 1,
|
1074
|
+
"1": "Plaintext",
|
1075
|
+
Ciphertext: 2,
|
1076
|
+
"2": "Ciphertext"
|
1077
|
+
});
|
1078
|
+
var DeviceStatus = Object.freeze({
|
1079
|
+
Valid: 1,
|
1080
|
+
"1": "Valid",
|
1081
|
+
Expired: 2,
|
1082
|
+
"2": "Expired",
|
1083
|
+
Revoked: 3,
|
1084
|
+
"3": "Revoked"
|
1085
|
+
});
|
1086
|
+
var CredentialType = Object.freeze({
|
1087
|
+
Basic: 1,
|
1088
|
+
"1": "Basic",
|
1089
|
+
X509: 2,
|
1090
|
+
"2": "X509"
|
1091
|
+
});
|
1092
1092
|
var AcmeChallengeFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
|
1093
1093
|
}, unregister: () => {
|
1094
1094
|
} } : new FinalizationRegistry((ptr) => wasm.__wbg_acmechallenge_free(ptr >>> 0));
|
@@ -1550,16 +1550,14 @@ class CoreCrypto {
|
|
1550
1550
|
const ret = wasm.corecrypto__internal_new(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, !isLikeNone(nb_key_package), isLikeNone(nb_key_package) ? 0 : nb_key_package);
|
1551
1551
|
return takeObject(ret);
|
1552
1552
|
}
|
1553
|
-
static deferred_init(path, key,
|
1553
|
+
static deferred_init(path, key, entropy_seed) {
|
1554
1554
|
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
1555
1555
|
const len0 = WASM_VECTOR_LEN;
|
1556
1556
|
const ptr1 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
1557
1557
|
const len1 = WASM_VECTOR_LEN;
|
1558
|
-
|
1559
|
-
|
1560
|
-
|
1561
|
-
var len3 = WASM_VECTOR_LEN;
|
1562
|
-
const ret = wasm.corecrypto_deferred_init(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, !isLikeNone(nb_key_package), isLikeNone(nb_key_package) ? 0 : nb_key_package);
|
1558
|
+
var ptr2 = isLikeNone(entropy_seed) ? 0 : passArray8ToWasm0(entropy_seed, wasm.__wbindgen_malloc);
|
1559
|
+
var len2 = WASM_VECTOR_LEN;
|
1560
|
+
const ret = wasm.corecrypto_deferred_init(ptr0, len0, ptr1, len1, ptr2, len2);
|
1563
1561
|
return takeObject(ret);
|
1564
1562
|
}
|
1565
1563
|
mls_init(client_id, ciphersuites, nb_key_package) {
|
@@ -2749,14 +2747,11 @@ class CoreCrypto2 {
|
|
2749
2747
|
static async deferredInit({
|
2750
2748
|
databaseName,
|
2751
2749
|
key,
|
2752
|
-
ciphersuites,
|
2753
2750
|
entropySeed,
|
2754
|
-
wasmFilePath
|
2755
|
-
nbKeyPackage
|
2751
|
+
wasmFilePath
|
2756
2752
|
}) {
|
2757
2753
|
await this.#loadModule(wasmFilePath);
|
2758
|
-
|
2759
|
-
const cc = await CoreCryptoError.asyncMapErr(CoreCrypto.deferred_init(databaseName, key, Uint16Array.of(...cs), entropySeed, nbKeyPackage));
|
2754
|
+
const cc = await CoreCryptoError.asyncMapErr(CoreCrypto.deferred_init(databaseName, key, entropySeed));
|
2760
2755
|
return new this(cc);
|
2761
2756
|
}
|
2762
2757
|
async mlsInit(clientId, ciphersuites, nbKeyPackage) {
|