@wireapp/core-crypto 10.3.0 → 10.4.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/dist/browser/autogenerated/wasm-bindgen/index_bg.wasm +0 -0
- package/dist/browser/autogenerated/wasm-bindgen/index_bg.wasm.d.ts +38 -26
- package/dist/browser/corecrypto.d.ts +32 -3
- package/dist/browser/corecrypto.js +473 -384
- package/dist/native/corecrypto.d.ts +32 -3
- package/dist/native/corecrypto.js +108 -1
- package/dist/native/libcore_crypto_ffi.dylib +0 -0
- package/dist/native/libcore_crypto_ffi.so +0 -0
- package/package.json +1 -1
|
@@ -2915,6 +2915,16 @@ export declare enum SignatureScheme {
|
|
|
2915
2915
|
*/
|
|
2916
2916
|
Ed448 = 2056
|
|
2917
2917
|
}
|
|
2918
|
+
declare enum TargetedMessagePolicy {
|
|
2919
|
+
/**
|
|
2920
|
+
* Won't be persisted and will only be visible to currently online members who immediately process it.
|
|
2921
|
+
*/
|
|
2922
|
+
Transient = 0,
|
|
2923
|
+
/**
|
|
2924
|
+
* May be persisted and buffered, will also be delivered and processed by currently offline members.
|
|
2925
|
+
*/
|
|
2926
|
+
Persisted = 1
|
|
2927
|
+
}
|
|
2918
2928
|
/**
|
|
2919
2929
|
* Typealias from the type name used in the UDL file to the builtin type. This
|
|
2920
2930
|
* is needed because the UDL type name is used in function/method signatures.
|
|
@@ -3312,6 +3322,15 @@ declare class CoreCryptoContext extends UniffiAbstractObject {
|
|
|
3312
3322
|
encryptMessage(conversationId: ConversationIdLike, message: Uint8Array, asyncOpts_?: {
|
|
3313
3323
|
signal: AbortSignal;
|
|
3314
3324
|
}): Promise<Uint8Array>;
|
|
3325
|
+
/**
|
|
3326
|
+
* Encrypts a plaintext message for one member of the given conversation.
|
|
3327
|
+
*
|
|
3328
|
+
* Any feature using a targeted, transient or transient targeted message MUST specify why the lower security
|
|
3329
|
+
* guarantees (compared to MLS application messages) are acceptable and/or how they are mitigated.
|
|
3330
|
+
*/
|
|
3331
|
+
encryptTargetedMessage(conversationId: ConversationIdLike, recipient: ClientIdLike, policy: TargetedMessagePolicy, message: Uint8Array, asyncOpts_?: {
|
|
3332
|
+
signal: AbortSignal;
|
|
3333
|
+
}): Promise<Uint8Array>;
|
|
3315
3334
|
/**
|
|
3316
3335
|
* Derives and exports a secret of `key_length` bytes for the given conversation.
|
|
3317
3336
|
*
|
|
@@ -3601,13 +3620,23 @@ export declare class PkiEnvironment extends UniffiAbstractObject {
|
|
|
3601
3620
|
}): Promise<void>;
|
|
3602
3621
|
/**
|
|
3603
3622
|
* Add a PEM-encoded certificate as a trust anchor.
|
|
3604
|
-
*
|
|
3605
|
-
* NOTE: currently we only support storing a single trust anchor, calling this method multiple
|
|
3606
|
-
* times will overwrite any previously added trust anchor.
|
|
3607
3623
|
*/
|
|
3608
3624
|
addTrustAnchor(certPem: string, asyncOpts_?: {
|
|
3609
3625
|
signal: AbortSignal;
|
|
3610
3626
|
}): Promise<void>;
|
|
3627
|
+
/**
|
|
3628
|
+
* Get all trust anchors as PEM-encoded certificates.
|
|
3629
|
+
*/
|
|
3630
|
+
getTrustAnchors(asyncOpts_?: {
|
|
3631
|
+
signal: AbortSignal;
|
|
3632
|
+
}): Promise<Array<string>>;
|
|
3633
|
+
/**
|
|
3634
|
+
* Remove a trust anchor by providing the certificates Subject Public Key Info (SPKI) fingerprint as bytes.
|
|
3635
|
+
* Trying to remove trust anchor that doesn't exist in the database will just succeed.
|
|
3636
|
+
*/
|
|
3637
|
+
removeTrustAnchor(fingerprint: Uint8Array, asyncOpts_?: {
|
|
3638
|
+
signal: AbortSignal;
|
|
3639
|
+
}): Promise<void>;
|
|
3611
3640
|
uniffiDestroy(): void;
|
|
3612
3641
|
static instanceOf(obj_: any): obj_ is PkiEnvironment;
|
|
3613
3642
|
}
|
|
@@ -728,6 +728,11 @@ var DEFINITIONS = {
|
|
|
728
728
|
ret: FfiType.Handle,
|
|
729
729
|
hasRustCallStatus: false
|
|
730
730
|
},
|
|
731
|
+
uniffi_core_crypto_ffi_fn_method_corecryptocontext_encrypt_targeted_message: {
|
|
732
|
+
args: [FfiType.Handle, FfiType.Handle, FfiType.Handle, FfiType.RustBuffer, FfiType.RustBuffer],
|
|
733
|
+
ret: FfiType.Handle,
|
|
734
|
+
hasRustCallStatus: false
|
|
735
|
+
},
|
|
731
736
|
uniffi_core_crypto_ffi_fn_method_corecryptocontext_export_secret_key: {
|
|
732
737
|
args: [FfiType.Handle, FfiType.Handle, FfiType.UInt32],
|
|
733
738
|
ret: FfiType.Handle,
|
|
@@ -1288,6 +1293,16 @@ var DEFINITIONS = {
|
|
|
1288
1293
|
ret: FfiType.Handle,
|
|
1289
1294
|
hasRustCallStatus: false
|
|
1290
1295
|
},
|
|
1296
|
+
uniffi_core_crypto_ffi_fn_method_pkienvironment_get_trust_anchors: {
|
|
1297
|
+
args: [FfiType.Handle],
|
|
1298
|
+
ret: FfiType.Handle,
|
|
1299
|
+
hasRustCallStatus: false
|
|
1300
|
+
},
|
|
1301
|
+
uniffi_core_crypto_ffi_fn_method_pkienvironment_remove_trust_anchor: {
|
|
1302
|
+
args: [FfiType.Handle, FfiType.RustBuffer],
|
|
1303
|
+
ret: FfiType.Handle,
|
|
1304
|
+
hasRustCallStatus: false
|
|
1305
|
+
},
|
|
1291
1306
|
uniffi_core_crypto_ffi_fn_method_pkienvironmenthooks_http_request: {
|
|
1292
1307
|
args: [FfiType.Handle, FfiType.RustBuffer, FfiType.RustBuffer, FfiType.RustBuffer, FfiType.RustBuffer],
|
|
1293
1308
|
ret: FfiType.Handle,
|
|
@@ -1563,6 +1578,11 @@ var DEFINITIONS = {
|
|
|
1563
1578
|
ret: FfiType.UInt16,
|
|
1564
1579
|
hasRustCallStatus: false
|
|
1565
1580
|
},
|
|
1581
|
+
uniffi_core_crypto_ffi_checksum_method_corecryptocontext_encrypt_targeted_message: {
|
|
1582
|
+
args: [],
|
|
1583
|
+
ret: FfiType.UInt16,
|
|
1584
|
+
hasRustCallStatus: false
|
|
1585
|
+
},
|
|
1566
1586
|
uniffi_core_crypto_ffi_checksum_method_corecryptocontext_export_secret_key: {
|
|
1567
1587
|
args: [],
|
|
1568
1588
|
ret: FfiType.UInt16,
|
|
@@ -2078,6 +2098,16 @@ var DEFINITIONS = {
|
|
|
2078
2098
|
ret: FfiType.UInt16,
|
|
2079
2099
|
hasRustCallStatus: false
|
|
2080
2100
|
},
|
|
2101
|
+
uniffi_core_crypto_ffi_checksum_method_pkienvironment_get_trust_anchors: {
|
|
2102
|
+
args: [],
|
|
2103
|
+
ret: FfiType.UInt16,
|
|
2104
|
+
hasRustCallStatus: false
|
|
2105
|
+
},
|
|
2106
|
+
uniffi_core_crypto_ffi_checksum_method_pkienvironment_remove_trust_anchor: {
|
|
2107
|
+
args: [],
|
|
2108
|
+
ret: FfiType.UInt16,
|
|
2109
|
+
hasRustCallStatus: false
|
|
2110
|
+
},
|
|
2081
2111
|
uniffi_core_crypto_ffi_checksum_method_pkienvironmenthooks_http_request: {
|
|
2082
2112
|
args: [],
|
|
2083
2113
|
ret: FfiType.UInt16,
|
|
@@ -5026,6 +5056,34 @@ var FfiConverterTypeSignatureScheme = (() => {
|
|
|
5026
5056
|
}
|
|
5027
5057
|
return new FFIConverter;
|
|
5028
5058
|
})();
|
|
5059
|
+
var FfiConverterTypeTargetedMessagePolicy = (() => {
|
|
5060
|
+
const ordinalConverter = FfiConverterInt32;
|
|
5061
|
+
|
|
5062
|
+
class FFIConverter extends AbstractFfiConverterByteArray {
|
|
5063
|
+
read(from) {
|
|
5064
|
+
switch (ordinalConverter.read(from)) {
|
|
5065
|
+
case 1:
|
|
5066
|
+
return 0 /* Transient */;
|
|
5067
|
+
case 2:
|
|
5068
|
+
return 1 /* Persisted */;
|
|
5069
|
+
default:
|
|
5070
|
+
throw new UniffiInternalError.UnexpectedEnumCase;
|
|
5071
|
+
}
|
|
5072
|
+
}
|
|
5073
|
+
write(value, into) {
|
|
5074
|
+
switch (value) {
|
|
5075
|
+
case 0 /* Transient */:
|
|
5076
|
+
return ordinalConverter.write(1, into);
|
|
5077
|
+
case 1 /* Persisted */:
|
|
5078
|
+
return ordinalConverter.write(2, into);
|
|
5079
|
+
}
|
|
5080
|
+
}
|
|
5081
|
+
allocationSize(value) {
|
|
5082
|
+
return ordinalConverter.allocationSize(0);
|
|
5083
|
+
}
|
|
5084
|
+
}
|
|
5085
|
+
return new FFIConverter;
|
|
5086
|
+
})();
|
|
5029
5087
|
var FfiConverterTypeMlsTransportData = FfiConverterUint8Array;
|
|
5030
5088
|
|
|
5031
5089
|
class ConversationId extends UniffiAbstractObject {
|
|
@@ -6245,6 +6303,19 @@ class CoreCryptoContext extends UniffiAbstractObject {
|
|
|
6245
6303
|
throw __error;
|
|
6246
6304
|
}
|
|
6247
6305
|
}
|
|
6306
|
+
async encryptTargetedMessage(conversationId, recipient, policy, message, asyncOpts_) {
|
|
6307
|
+
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
6308
|
+
try {
|
|
6309
|
+
return await uniffiRustCallAsync(uniffiCaller, () => {
|
|
6310
|
+
return core_crypto_ffi_ffi_default().uniffi_core_crypto_ffi_fn_method_corecryptocontext_encrypt_targeted_message(uniffiTypeCoreCryptoContextObjectFactory.clonePointer(this), FfiConverterTypeConversationId.lower(conversationId, core_crypto_ffi_ffi_default().rustbuffer_alloc), FfiConverterTypeClientId.lower(recipient, core_crypto_ffi_ffi_default().rustbuffer_alloc), FfiConverterTypeTargetedMessagePolicy.lower(policy, core_crypto_ffi_ffi_default().rustbuffer_alloc), FfiConverterUint8Array.lower(message, core_crypto_ffi_ffi_default().rustbuffer_alloc));
|
|
6311
|
+
}, core_crypto_ffi_ffi_default().ffi_core_crypto_ffi_rust_future_poll_rust_buffer, core_crypto_ffi_ffi_default().ffi_core_crypto_ffi_rust_future_cancel_rust_buffer, core_crypto_ffi_ffi_default().ffi_core_crypto_ffi_rust_future_complete_rust_buffer, core_crypto_ffi_ffi_default().ffi_core_crypto_ffi_rust_future_free_rust_buffer, FfiConverterUint8Array.lift.bind(FfiConverterUint8Array), FfiConverterString.lift.bind(FfiConverterString), asyncOpts_, FfiConverterTypeCoreCryptoError.lift.bind(FfiConverterTypeCoreCryptoError));
|
|
6312
|
+
} catch (__error) {
|
|
6313
|
+
if (uniffiIsDebug && __error instanceof Error) {
|
|
6314
|
+
__error.stack = __stack;
|
|
6315
|
+
}
|
|
6316
|
+
throw __error;
|
|
6317
|
+
}
|
|
6318
|
+
}
|
|
6248
6319
|
async exportSecretKey(conversationId, keyLength, asyncOpts_) {
|
|
6249
6320
|
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
6250
6321
|
try {
|
|
@@ -6938,6 +7009,32 @@ class PkiEnvironment extends UniffiAbstractObject {
|
|
|
6938
7009
|
throw __error;
|
|
6939
7010
|
}
|
|
6940
7011
|
}
|
|
7012
|
+
async getTrustAnchors(asyncOpts_) {
|
|
7013
|
+
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
7014
|
+
try {
|
|
7015
|
+
return await uniffiRustCallAsync(uniffiCaller, () => {
|
|
7016
|
+
return core_crypto_ffi_ffi_default().uniffi_core_crypto_ffi_fn_method_pkienvironment_get_trust_anchors(uniffiTypePkiEnvironmentObjectFactory.clonePointer(this));
|
|
7017
|
+
}, core_crypto_ffi_ffi_default().ffi_core_crypto_ffi_rust_future_poll_rust_buffer, core_crypto_ffi_ffi_default().ffi_core_crypto_ffi_rust_future_cancel_rust_buffer, core_crypto_ffi_ffi_default().ffi_core_crypto_ffi_rust_future_complete_rust_buffer, core_crypto_ffi_ffi_default().ffi_core_crypto_ffi_rust_future_free_rust_buffer, FfiConverterSequenceString.lift.bind(FfiConverterSequenceString), FfiConverterString.lift.bind(FfiConverterString), asyncOpts_, FfiConverterTypeCoreCryptoError.lift.bind(FfiConverterTypeCoreCryptoError));
|
|
7018
|
+
} catch (__error) {
|
|
7019
|
+
if (uniffiIsDebug && __error instanceof Error) {
|
|
7020
|
+
__error.stack = __stack;
|
|
7021
|
+
}
|
|
7022
|
+
throw __error;
|
|
7023
|
+
}
|
|
7024
|
+
}
|
|
7025
|
+
async removeTrustAnchor(fingerprint, asyncOpts_) {
|
|
7026
|
+
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
7027
|
+
try {
|
|
7028
|
+
return await uniffiRustCallAsync(uniffiCaller, () => {
|
|
7029
|
+
return core_crypto_ffi_ffi_default().uniffi_core_crypto_ffi_fn_method_pkienvironment_remove_trust_anchor(uniffiTypePkiEnvironmentObjectFactory.clonePointer(this), FfiConverterUint8Array.lower(fingerprint, core_crypto_ffi_ffi_default().rustbuffer_alloc));
|
|
7030
|
+
}, core_crypto_ffi_ffi_default().ffi_core_crypto_ffi_rust_future_poll_void, core_crypto_ffi_ffi_default().ffi_core_crypto_ffi_rust_future_cancel_void, core_crypto_ffi_ffi_default().ffi_core_crypto_ffi_rust_future_complete_void, core_crypto_ffi_ffi_default().ffi_core_crypto_ffi_rust_future_free_void, (_v) => {}, FfiConverterString.lift.bind(FfiConverterString), asyncOpts_, FfiConverterTypeCoreCryptoError.lift.bind(FfiConverterTypeCoreCryptoError));
|
|
7031
|
+
} catch (__error) {
|
|
7032
|
+
if (uniffiIsDebug && __error instanceof Error) {
|
|
7033
|
+
__error.stack = __stack;
|
|
7034
|
+
}
|
|
7035
|
+
throw __error;
|
|
7036
|
+
}
|
|
7037
|
+
}
|
|
6941
7038
|
uniffiDestroy() {
|
|
6942
7039
|
const ptr = this[destructorGuardSymbol];
|
|
6943
7040
|
if (ptr !== undefined) {
|
|
@@ -8396,6 +8493,9 @@ function uniffiEnsureInitialized() {
|
|
|
8396
8493
|
if (core_crypto_ffi_ffi_default().uniffi_core_crypto_ffi_checksum_method_corecryptocontext_encrypt_message() !== 23805) {
|
|
8397
8494
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_core_crypto_ffi_checksum_method_corecryptocontext_encrypt_message");
|
|
8398
8495
|
}
|
|
8496
|
+
if (core_crypto_ffi_ffi_default().uniffi_core_crypto_ffi_checksum_method_corecryptocontext_encrypt_targeted_message() !== 52733) {
|
|
8497
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_core_crypto_ffi_checksum_method_corecryptocontext_encrypt_targeted_message");
|
|
8498
|
+
}
|
|
8399
8499
|
if (core_crypto_ffi_ffi_default().uniffi_core_crypto_ffi_checksum_method_corecryptocontext_export_secret_key() !== 35407) {
|
|
8400
8500
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_core_crypto_ffi_checksum_method_corecryptocontext_export_secret_key");
|
|
8401
8501
|
}
|
|
@@ -8702,9 +8802,15 @@ function uniffiEnsureInitialized() {
|
|
|
8702
8802
|
if (core_crypto_ffi_ffi_default().uniffi_core_crypto_ffi_checksum_method_pkienvironment_add_intermediate_cert() !== 57664) {
|
|
8703
8803
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_core_crypto_ffi_checksum_method_pkienvironment_add_intermediate_cert");
|
|
8704
8804
|
}
|
|
8705
|
-
if (core_crypto_ffi_ffi_default().uniffi_core_crypto_ffi_checksum_method_pkienvironment_add_trust_anchor() !==
|
|
8805
|
+
if (core_crypto_ffi_ffi_default().uniffi_core_crypto_ffi_checksum_method_pkienvironment_add_trust_anchor() !== 14999) {
|
|
8706
8806
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_core_crypto_ffi_checksum_method_pkienvironment_add_trust_anchor");
|
|
8707
8807
|
}
|
|
8808
|
+
if (core_crypto_ffi_ffi_default().uniffi_core_crypto_ffi_checksum_method_pkienvironment_get_trust_anchors() !== 11812) {
|
|
8809
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_core_crypto_ffi_checksum_method_pkienvironment_get_trust_anchors");
|
|
8810
|
+
}
|
|
8811
|
+
if (core_crypto_ffi_ffi_default().uniffi_core_crypto_ffi_checksum_method_pkienvironment_remove_trust_anchor() !== 41980) {
|
|
8812
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_core_crypto_ffi_checksum_method_pkienvironment_remove_trust_anchor");
|
|
8813
|
+
}
|
|
8708
8814
|
if (core_crypto_ffi_ffi_default().uniffi_core_crypto_ffi_checksum_method_pkienvironmenthooks_http_request() !== 1349) {
|
|
8709
8815
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_core_crypto_ffi_checksum_method_pkienvironmenthooks_http_request");
|
|
8710
8816
|
}
|
|
@@ -8803,6 +8909,7 @@ var core_crypto_ffi_default = Object.freeze({
|
|
|
8803
8909
|
FfiConverterTypeProteusError,
|
|
8804
8910
|
FfiConverterTypeSecretKey,
|
|
8805
8911
|
FfiConverterTypeSignatureScheme,
|
|
8912
|
+
FfiConverterTypeTargetedMessagePolicy,
|
|
8806
8913
|
FfiConverterTypeTimestamp,
|
|
8807
8914
|
FfiConverterTypeUuid,
|
|
8808
8915
|
FfiConverterTypeWelcome,
|
|
Binary file
|
|
Binary file
|