@wireapp/core-crypto 1.0.0-rc.2 → 1.0.0-rc.6
Sign up to get free protection for your applications and to get access to all the features.
package/package.json
CHANGED
Binary file
|
@@ -727,6 +727,10 @@ export declare class CoreCrypto {
|
|
727
727
|
/**
|
728
728
|
* Ingest a TLS-serialized MLS welcome message to join an existing MLS group
|
729
729
|
*
|
730
|
+
* Important: you have to catch the error with this reason "Although this Welcome seems valid, the local KeyPackage
|
731
|
+
* it references has already been deleted locally. Join this group with an external commit", ignore it and then try
|
732
|
+
* to join this group with an external commit.
|
733
|
+
*
|
730
734
|
* @param welcomeMessage - TLS-serialized MLS Welcome message
|
731
735
|
* @param configuration - configuration of the MLS group
|
732
736
|
* @returns The conversation ID of the newly joined group. You can use the same ID to decrypt/encrypt messages
|
@@ -1121,9 +1125,16 @@ export declare class CoreCrypto {
|
|
1121
1125
|
* Credential generated by Wire's end-to-end identity enrollment
|
1122
1126
|
*
|
1123
1127
|
* @param conversationId The group's ID
|
1124
|
-
* @returns
|
1128
|
+
* @returns the conversation state given current members
|
1129
|
+
*/
|
1130
|
+
e2eiConversationState(conversationId: ConversationId): Promise<E2eiConversationState>;
|
1131
|
+
/**
|
1132
|
+
* Returns true when end-to-end-identity is enabled for the given Ciphersuite
|
1133
|
+
*
|
1134
|
+
* @param ciphersuite of the credential to check
|
1135
|
+
* @returns true end-to-end identity is enabled for the given ciphersuite
|
1125
1136
|
*/
|
1126
|
-
|
1137
|
+
e2eiIsEnabled(ciphersuite: Ciphersuite): Promise<boolean>;
|
1127
1138
|
/**
|
1128
1139
|
* Returns the current version of {@link CoreCrypto}
|
1129
1140
|
*
|
@@ -1359,5 +1370,24 @@ export interface AcmeChallenge {
|
|
1359
1370
|
*/
|
1360
1371
|
target: string;
|
1361
1372
|
}
|
1373
|
+
/**
|
1374
|
+
* Indicates the state of a Conversation regarding end-to-end identity.
|
1375
|
+
* Note: this does not check pending state (pending commit, pending proposals) so it does not
|
1376
|
+
* consider members about to be added/removed
|
1377
|
+
*/
|
1378
|
+
export declare enum E2eiConversationState {
|
1379
|
+
/**
|
1380
|
+
* All clients have a valid E2EI certificate
|
1381
|
+
*/
|
1382
|
+
Verified = 1,
|
1383
|
+
/**
|
1384
|
+
* Some clients are either still Basic or their certificate is expired
|
1385
|
+
*/
|
1386
|
+
Degraded = 2,
|
1387
|
+
/**
|
1388
|
+
* All clients are still Basic. If all client have expired certificates, Degraded is returned.
|
1389
|
+
*/
|
1390
|
+
NotEnabled = 3
|
1391
|
+
}
|
1362
1392
|
|
1363
1393
|
export {};
|
@@ -234,12 +234,12 @@ function makeMutClosure(arg0, arg1, dtor, f) {
|
|
234
234
|
return real;
|
235
235
|
}
|
236
236
|
function __wbg_adapter_52(arg0, arg1, arg2) {
|
237
|
-
wasm$1.
|
237
|
+
wasm$1.wasm_bindgen__convert__closures__invoke1_mut__h17baf5e1d66e67f4(arg0, arg1, addHeapObject(arg2));
|
238
238
|
}
|
239
239
|
function __wbg_adapter_55(arg0, arg1, arg2) {
|
240
240
|
try {
|
241
241
|
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
242
|
-
wasm$1.
|
242
|
+
wasm$1.wasm_bindgen__convert__closures__invoke1_mut__hdbae48319fb47112(retptr, arg0, arg1, addHeapObject(arg2));
|
243
243
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
244
244
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
245
245
|
if (r1) {
|
@@ -313,8 +313,8 @@ function handleError(f, args) {
|
|
313
313
|
wasm$1.__wbindgen_exn_store(addHeapObject(e));
|
314
314
|
}
|
315
315
|
}
|
316
|
-
function
|
317
|
-
wasm$1.
|
316
|
+
function __wbg_adapter_299(arg0, arg1, arg2, arg3) {
|
317
|
+
wasm$1.wasm_bindgen__convert__closures__invoke2_mut__haf4f26fdea6dc8ca(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
318
318
|
}
|
319
319
|
/**
|
320
320
|
* see [core_crypto::prelude::MlsWirePolicy]
|
@@ -807,14 +807,25 @@ let CoreCrypto$1 = class CoreCrypto {
|
|
807
807
|
/**
|
808
808
|
* Returns [`WasmCryptoResult<bool>`]
|
809
809
|
*
|
810
|
-
* see [core_crypto::mls::MlsCentral::
|
810
|
+
* see [core_crypto::mls::MlsCentral::e2ei_conversation_state]
|
811
811
|
* @param {Uint8Array} conversation_id
|
812
812
|
* @returns {Promise<any>}
|
813
813
|
*/
|
814
|
-
|
814
|
+
e2ei_conversation_state(conversation_id) {
|
815
815
|
const ptr0 = passArray8ToWasm0(conversation_id, wasm$1.__wbindgen_malloc);
|
816
816
|
const len0 = WASM_VECTOR_LEN;
|
817
|
-
const ret = wasm$1.
|
817
|
+
const ret = wasm$1.corecrypto_e2ei_conversation_state(this.__wbg_ptr, ptr0, len0);
|
818
|
+
return takeObject(ret);
|
819
|
+
}
|
820
|
+
/**
|
821
|
+
* Returns [`WasmCryptoResult<bool>`]
|
822
|
+
*
|
823
|
+
* see [core_crypto::mls::MlsCentral::e2ei_is_enabled]
|
824
|
+
* @param {number} ciphersuite
|
825
|
+
* @returns {Promise<any>}
|
826
|
+
*/
|
827
|
+
e2ei_is_enabled(ciphersuite) {
|
828
|
+
const ret = wasm$1.corecrypto_e2ei_is_enabled(this.__wbg_ptr, ciphersuite);
|
818
829
|
return takeObject(ret);
|
819
830
|
}
|
820
831
|
/**
|
@@ -1215,7 +1226,7 @@ let CoreCrypto$1 = class CoreCrypto {
|
|
1215
1226
|
/**
|
1216
1227
|
* Returns: [`WasmCryptoResult<js_sys::Uint8Array>`]
|
1217
1228
|
*
|
1218
|
-
* see [core_crypto::mls::MlsCentral::
|
1229
|
+
* see [core_crypto::mls::MlsCentral::new_add_proposal]
|
1219
1230
|
* @param {Uint8Array} conversation_id
|
1220
1231
|
* @param {Uint8Array} keypackage
|
1221
1232
|
* @returns {Promise<any>}
|
@@ -1231,7 +1242,7 @@ let CoreCrypto$1 = class CoreCrypto {
|
|
1231
1242
|
/**
|
1232
1243
|
* Returns: [`WasmCryptoResult<js_sys::Uint8Array>`]
|
1233
1244
|
*
|
1234
|
-
* see [core_crypto::mls::MlsCentral::
|
1245
|
+
* see [core_crypto::mls::MlsCentral::new_update_proposal]
|
1235
1246
|
* @param {Uint8Array} conversation_id
|
1236
1247
|
* @returns {Promise<any>}
|
1237
1248
|
*/
|
@@ -1244,7 +1255,7 @@ let CoreCrypto$1 = class CoreCrypto {
|
|
1244
1255
|
/**
|
1245
1256
|
* Returns: [`WasmCryptoResult<js_sys::Uint8Array>`]
|
1246
1257
|
*
|
1247
|
-
* see [core_crypto::mls::MlsCentral::
|
1258
|
+
* see [core_crypto::mls::MlsCentral::new_remove_proposal]
|
1248
1259
|
* @param {Uint8Array} conversation_id
|
1249
1260
|
* @param {Uint8Array} client_id
|
1250
1261
|
* @returns {Promise<any>}
|
@@ -2858,39 +2869,50 @@ function __wbg_get_imports() {
|
|
2858
2869
|
const ret = getObject(arg0).length;
|
2859
2870
|
return ret;
|
2860
2871
|
};
|
2861
|
-
imports.wbg.__wbg_new_b51585de1b234aff = function () {
|
2862
|
-
const ret = new Object();
|
2863
|
-
return addHeapObject(ret);
|
2864
|
-
};
|
2865
2872
|
imports.wbg.__wbg_call_01734de55d61e11d = function () {
|
2866
2873
|
return handleError(function (arg0, arg1, arg2) {
|
2867
2874
|
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
|
2868
2875
|
return addHeapObject(ret);
|
2869
2876
|
}, arguments);
|
2870
2877
|
};
|
2878
|
+
imports.wbg.__wbindgen_number_new = function (arg0) {
|
2879
|
+
const ret = arg0;
|
2880
|
+
return addHeapObject(ret);
|
2881
|
+
};
|
2871
2882
|
imports.wbg.__wbg_new_8125e318e6245eed = function (arg0) {
|
2872
2883
|
const ret = new Uint8Array(getObject(arg0));
|
2873
2884
|
return addHeapObject(ret);
|
2874
2885
|
};
|
2886
|
+
imports.wbg.__wbg_ffiwiree2eidentity_new = function (arg0) {
|
2887
|
+
const ret = FfiWireE2EIdentity.__wrap(arg0);
|
2888
|
+
return addHeapObject(ret);
|
2889
|
+
};
|
2890
|
+
imports.wbg.__wbg_new_b51585de1b234aff = function () {
|
2891
|
+
const ret = new Object();
|
2892
|
+
return addHeapObject(ret);
|
2893
|
+
};
|
2875
2894
|
imports.wbg.__wbg_new_898a68150f225f2e = function () {
|
2876
2895
|
const ret = new Array();
|
2877
2896
|
return addHeapObject(ret);
|
2878
2897
|
};
|
2898
|
+
imports.wbg.__wbg_set_502d29070ea18557 = function (arg0, arg1, arg2) {
|
2899
|
+
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
2900
|
+
};
|
2901
|
+
imports.wbg.__wbg_set_841ac57cff3d672b = function (arg0, arg1, arg2) {
|
2902
|
+
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
2903
|
+
};
|
2879
2904
|
imports.wbg.__wbg_push_ca1c26067ef907ac = function (arg0, arg1) {
|
2880
2905
|
const ret = getObject(arg0).push(getObject(arg1));
|
2881
2906
|
return ret;
|
2882
2907
|
};
|
2883
|
-
imports.wbg.
|
2884
|
-
const ret =
|
2908
|
+
imports.wbg.__wbg_new_56693dbed0c32988 = function () {
|
2909
|
+
const ret = new Map();
|
2885
2910
|
return addHeapObject(ret);
|
2886
2911
|
};
|
2887
|
-
imports.wbg.
|
2888
|
-
const ret = arg0;
|
2912
|
+
imports.wbg.__wbg_set_bedc3d02d0f05eb0 = function (arg0, arg1, arg2) {
|
2913
|
+
const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
|
2889
2914
|
return addHeapObject(ret);
|
2890
2915
|
};
|
2891
|
-
imports.wbg.__wbg_set_502d29070ea18557 = function (arg0, arg1, arg2) {
|
2892
|
-
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
2893
|
-
};
|
2894
2916
|
imports.wbg.__wbg_proteusautoprekeybundle_new = function (arg0) {
|
2895
2917
|
const ret = ProteusAutoPrekeyBundle.__wrap(arg0);
|
2896
2918
|
return addHeapObject(ret);
|
@@ -2899,14 +2921,6 @@ function __wbg_get_imports() {
|
|
2899
2921
|
const ret = BigInt.asUintN(64, arg0);
|
2900
2922
|
return addHeapObject(ret);
|
2901
2923
|
};
|
2902
|
-
imports.wbg.__wbg_new_56693dbed0c32988 = function () {
|
2903
|
-
const ret = new Map();
|
2904
|
-
return addHeapObject(ret);
|
2905
|
-
};
|
2906
|
-
imports.wbg.__wbg_set_bedc3d02d0f05eb0 = function (arg0, arg1, arg2) {
|
2907
|
-
const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
|
2908
|
-
return addHeapObject(ret);
|
2909
|
-
};
|
2910
2924
|
imports.wbg.__wbg_new_d258248ed531ff54 = function (arg0, arg1) {
|
2911
2925
|
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
2912
2926
|
return addHeapObject(ret);
|
@@ -2979,9 +2993,6 @@ function __wbg_get_imports() {
|
|
2979
2993
|
const ret = CoreCrypto$1.__wrap(arg0);
|
2980
2994
|
return addHeapObject(ret);
|
2981
2995
|
};
|
2982
|
-
imports.wbg.__wbg_set_841ac57cff3d672b = function (arg0, arg1, arg2) {
|
2983
|
-
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
2984
|
-
};
|
2985
2996
|
imports.wbg.__wbg_instanceof_Promise_0e98a5bf082e090f = function (arg0) {
|
2986
2997
|
let result;
|
2987
2998
|
try {
|
@@ -3033,7 +3044,7 @@ function __wbg_get_imports() {
|
|
3033
3044
|
const a = state0.a;
|
3034
3045
|
state0.a = 0;
|
3035
3046
|
try {
|
3036
|
-
return
|
3047
|
+
return __wbg_adapter_299(a, state0.b, arg0, arg1);
|
3037
3048
|
}
|
3038
3049
|
finally {
|
3039
3050
|
state0.a = a;
|
@@ -3123,6 +3134,10 @@ function __wbg_get_imports() {
|
|
3123
3134
|
return addHeapObject(ret);
|
3124
3135
|
}, arguments);
|
3125
3136
|
};
|
3137
|
+
imports.wbg.__wbg_now_9c5990bda04c7e53 = function () {
|
3138
|
+
const ret = Date.now();
|
3139
|
+
return ret;
|
3140
|
+
};
|
3126
3141
|
imports.wbg.__wbg_put_fb32824d87feec5c = function () {
|
3127
3142
|
return handleError(function (arg0, arg1, arg2) {
|
3128
3143
|
const ret = getObject(arg0).put(getObject(arg1), getObject(arg2));
|
@@ -3165,10 +3180,6 @@ function __wbg_get_imports() {
|
|
3165
3180
|
return addHeapObject(ret);
|
3166
3181
|
}, arguments);
|
3167
3182
|
};
|
3168
|
-
imports.wbg.__wbg_now_9c5990bda04c7e53 = function () {
|
3169
|
-
const ret = Date.now();
|
3170
|
-
return ret;
|
3171
|
-
};
|
3172
3183
|
imports.wbg.__wbindgen_memory = function () {
|
3173
3184
|
const ret = wasm$1.memory;
|
3174
3185
|
return addHeapObject(ret);
|
@@ -3482,12 +3493,12 @@ function __wbg_get_imports() {
|
|
3482
3493
|
return addHeapObject(ret);
|
3483
3494
|
}, arguments);
|
3484
3495
|
};
|
3485
|
-
imports.wbg.
|
3486
|
-
const ret = makeMutClosure(arg0, arg1,
|
3496
|
+
imports.wbg.__wbindgen_closure_wrapper1951 = function (arg0, arg1, arg2) {
|
3497
|
+
const ret = makeMutClosure(arg0, arg1, 167, __wbg_adapter_52);
|
3487
3498
|
return addHeapObject(ret);
|
3488
3499
|
};
|
3489
|
-
imports.wbg.
|
3490
|
-
const ret = makeMutClosure(arg0, arg1,
|
3500
|
+
imports.wbg.__wbindgen_closure_wrapper4727 = function (arg0, arg1, arg2) {
|
3501
|
+
const ret = makeMutClosure(arg0, arg1, 167, __wbg_adapter_55);
|
3491
3502
|
return addHeapObject(ret);
|
3492
3503
|
};
|
3493
3504
|
return imports;
|
@@ -3556,7 +3567,7 @@ var exports = /*#__PURE__*/Object.freeze({
|
|
3556
3567
|
var wasm = async (opt = {}) => {
|
3557
3568
|
let {importHook, serverPath} = opt;
|
3558
3569
|
|
3559
|
-
let path = "assets/core_crypto_ffi-
|
3570
|
+
let path = "assets/core_crypto_ffi-8c0bd9a1.wasm";
|
3560
3571
|
|
3561
3572
|
if (serverPath != null) {
|
3562
3573
|
path = serverPath + /[^\/\\]*$/.exec(path)[0];
|
@@ -4054,6 +4065,10 @@ class CoreCrypto {
|
|
4054
4065
|
/**
|
4055
4066
|
* Ingest a TLS-serialized MLS welcome message to join an existing MLS group
|
4056
4067
|
*
|
4068
|
+
* Important: you have to catch the error with this reason "Although this Welcome seems valid, the local KeyPackage
|
4069
|
+
* it references has already been deleted locally. Join this group with an external commit", ignore it and then try
|
4070
|
+
* to join this group with an external commit.
|
4071
|
+
*
|
4057
4072
|
* @param welcomeMessage - TLS-serialized MLS Welcome message
|
4058
4073
|
* @param configuration - configuration of the MLS group
|
4059
4074
|
* @returns The conversation ID of the newly joined group. You can use the same ID to decrypt/encrypt messages
|
@@ -4646,7 +4661,13 @@ class CoreCrypto {
|
|
4646
4661
|
* @param newKeyPackageCount - number of KeyPackages with new identity to generate
|
4647
4662
|
*/
|
4648
4663
|
async e2eiRotateAll(enrollment, certificateChain, newKeyPackageCount) {
|
4649
|
-
|
4664
|
+
const ffiRet = await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").e2ei_rotate_all(enrollment.inner(), certificateChain, newKeyPackageCount);
|
4665
|
+
const ret = {
|
4666
|
+
commits: ffiRet.commits,
|
4667
|
+
newKeyPackages: ffiRet.new_key_packages,
|
4668
|
+
keyPackageRefsToRemove: ffiRet.key_package_refs_to_remove,
|
4669
|
+
};
|
4670
|
+
return ret;
|
4650
4671
|
}
|
4651
4672
|
/**
|
4652
4673
|
* Allows persisting an active enrollment (for example while redirecting the user during OAuth) in order to resume
|
@@ -4673,10 +4694,21 @@ class CoreCrypto {
|
|
4673
4694
|
* Credential generated by Wire's end-to-end identity enrollment
|
4674
4695
|
*
|
4675
4696
|
* @param conversationId The group's ID
|
4676
|
-
* @returns
|
4697
|
+
* @returns the conversation state given current members
|
4677
4698
|
*/
|
4678
|
-
async
|
4679
|
-
|
4699
|
+
async e2eiConversationState(conversationId) {
|
4700
|
+
let state = await CoreCryptoError.asyncMapErr(__classPrivateFieldGet(this, _CoreCrypto_cc, "f").e2ei_conversation_state(conversationId));
|
4701
|
+
// @ts-ignore
|
4702
|
+
return E2eiConversationState[E2eiConversationState[state]];
|
4703
|
+
}
|
4704
|
+
/**
|
4705
|
+
* Returns true when end-to-end-identity is enabled for the given Ciphersuite
|
4706
|
+
*
|
4707
|
+
* @param ciphersuite of the credential to check
|
4708
|
+
* @returns true end-to-end identity is enabled for the given ciphersuite
|
4709
|
+
*/
|
4710
|
+
async e2eiIsEnabled(ciphersuite) {
|
4711
|
+
return await CoreCryptoError.asyncMapErr(__classPrivateFieldGet(this, _CoreCrypto_cc, "f").e2ei_is_enabled(ciphersuite));
|
4680
4712
|
}
|
4681
4713
|
/**
|
4682
4714
|
* Returns the current version of {@link CoreCrypto}
|
@@ -4951,5 +4983,25 @@ class WireE2eIdentity {
|
|
4951
4983
|
}
|
4952
4984
|
}
|
4953
4985
|
_WireE2eIdentity_e2ei = new WeakMap();
|
4986
|
+
/**
|
4987
|
+
* Indicates the state of a Conversation regarding end-to-end identity.
|
4988
|
+
* Note: this does not check pending state (pending commit, pending proposals) so it does not
|
4989
|
+
* consider members about to be added/removed
|
4990
|
+
*/
|
4991
|
+
var E2eiConversationState;
|
4992
|
+
(function (E2eiConversationState) {
|
4993
|
+
/**
|
4994
|
+
* All clients have a valid E2EI certificate
|
4995
|
+
*/
|
4996
|
+
E2eiConversationState[E2eiConversationState["Verified"] = 1] = "Verified";
|
4997
|
+
/**
|
4998
|
+
* Some clients are either still Basic or their certificate is expired
|
4999
|
+
*/
|
5000
|
+
E2eiConversationState[E2eiConversationState["Degraded"] = 2] = "Degraded";
|
5001
|
+
/**
|
5002
|
+
* All clients are still Basic. If all client have expired certificates, Degraded is returned.
|
5003
|
+
*/
|
5004
|
+
E2eiConversationState[E2eiConversationState["NotEnabled"] = 3] = "NotEnabled";
|
5005
|
+
})(E2eiConversationState || (E2eiConversationState = {}));
|
4954
5006
|
|
4955
|
-
export { Ciphersuite, CoreCrypto, CoreCryptoError, CredentialType, ExternalProposalType, GroupInfoEncryptionType, ProposalType, RatchetTreeType, WireE2eIdentity, WirePolicy };
|
5007
|
+
export { Ciphersuite, CoreCrypto, CoreCryptoError, CredentialType, E2eiConversationState, ExternalProposalType, GroupInfoEncryptionType, ProposalType, RatchetTreeType, WireE2eIdentity, WirePolicy };
|
Binary file
|