@wireapp/core-crypto 10.3.0 → 10.5.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.
@@ -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
  *
@@ -3464,6 +3483,10 @@ declare class CoreCryptoContext extends UniffiAbstractObject {
3464
3483
  /**
3465
3484
  * Creates a new Proteus prekey with the given ID and returns its CBOR-serialized bundle.
3466
3485
  *
3486
+ * Fails if the ID is already in use. Prekeys are not replaceable: the ID has been published to
3487
+ * peers in a bundle, and overwriting it would strand anyone still holding that bundle. Use
3488
+ * `proteus_new_prekey_auto` to have a free ID chosen instead.
3489
+ *
3467
3490
  * Warning: the Proteus client must be initialized with `proteus_init` first or an error will be returned.
3468
3491
  */
3469
3492
  proteusNewPrekey(prekeyId: number, asyncOpts_?: {
@@ -3601,13 +3624,23 @@ export declare class PkiEnvironment extends UniffiAbstractObject {
3601
3624
  }): Promise<void>;
3602
3625
  /**
3603
3626
  * 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
3627
  */
3608
3628
  addTrustAnchor(certPem: string, asyncOpts_?: {
3609
3629
  signal: AbortSignal;
3610
3630
  }): Promise<void>;
3631
+ /**
3632
+ * Get all trust anchors as PEM-encoded certificates.
3633
+ */
3634
+ getTrustAnchors(asyncOpts_?: {
3635
+ signal: AbortSignal;
3636
+ }): Promise<Array<string>>;
3637
+ /**
3638
+ * Remove a trust anchor by providing the certificates Subject Public Key Info (SPKI) fingerprint as bytes.
3639
+ * Trying to remove trust anchor that doesn't exist in the database will just succeed.
3640
+ */
3641
+ removeTrustAnchor(fingerprint: Uint8Array, asyncOpts_?: {
3642
+ signal: AbortSignal;
3643
+ }): Promise<void>;
3611
3644
  uniffiDestroy(): void;
3612
3645
  static instanceOf(obj_: any): obj_ is PkiEnvironment;
3613
3646
  }
@@ -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,
@@ -2533,20 +2563,20 @@ var FfiConverterTypeBuildMetadata = (() => {
2533
2563
  return new FFIConverter;
2534
2564
  })();
2535
2565
  var MlsError_Tags;
2536
- ((MlsError_Tags2) => {
2537
- MlsError_Tags2["ConversationAlreadyExists"] = "ConversationAlreadyExists";
2538
- MlsError_Tags2["DuplicateMessage"] = "DuplicateMessage";
2539
- MlsError_Tags2["BufferedFutureMessage"] = "BufferedFutureMessage";
2540
- MlsError_Tags2["WrongEpoch"] = "WrongEpoch";
2541
- MlsError_Tags2["BufferedCommit"] = "BufferedCommit";
2542
- MlsError_Tags2["MessageEpochTooOld"] = "MessageEpochTooOld";
2543
- MlsError_Tags2["SelfCommitIgnored"] = "SelfCommitIgnored";
2544
- MlsError_Tags2["UnmergedPendingGroup"] = "UnmergedPendingGroup";
2545
- MlsError_Tags2["StaleProposal"] = "StaleProposal";
2546
- MlsError_Tags2["StaleCommit"] = "StaleCommit";
2547
- MlsError_Tags2["OrphanWelcome"] = "OrphanWelcome";
2548
- MlsError_Tags2["MessageRejected"] = "MessageRejected";
2549
- MlsError_Tags2["Other"] = "Other";
2566
+ ((MlsError_Tags) => {
2567
+ MlsError_Tags["ConversationAlreadyExists"] = "ConversationAlreadyExists";
2568
+ MlsError_Tags["DuplicateMessage"] = "DuplicateMessage";
2569
+ MlsError_Tags["BufferedFutureMessage"] = "BufferedFutureMessage";
2570
+ MlsError_Tags["WrongEpoch"] = "WrongEpoch";
2571
+ MlsError_Tags["BufferedCommit"] = "BufferedCommit";
2572
+ MlsError_Tags["MessageEpochTooOld"] = "MessageEpochTooOld";
2573
+ MlsError_Tags["SelfCommitIgnored"] = "SelfCommitIgnored";
2574
+ MlsError_Tags["UnmergedPendingGroup"] = "UnmergedPendingGroup";
2575
+ MlsError_Tags["StaleProposal"] = "StaleProposal";
2576
+ MlsError_Tags["StaleCommit"] = "StaleCommit";
2577
+ MlsError_Tags["OrphanWelcome"] = "OrphanWelcome";
2578
+ MlsError_Tags["MessageRejected"] = "MessageRejected";
2579
+ MlsError_Tags["Other"] = "Other";
2550
2580
  })(MlsError_Tags ||= {});
2551
2581
  var MlsError = (() => {
2552
2582
 
@@ -2963,11 +2993,11 @@ var FfiConverterTypeMlsError = (() => {
2963
2993
  return new FFIConverter;
2964
2994
  })();
2965
2995
  var ProteusError_Tags;
2966
- ((ProteusError_Tags2) => {
2967
- ProteusError_Tags2["SessionNotFound"] = "SessionNotFound";
2968
- ProteusError_Tags2["DuplicateMessage"] = "DuplicateMessage";
2969
- ProteusError_Tags2["RemoteIdentityChanged"] = "RemoteIdentityChanged";
2970
- ProteusError_Tags2["Other"] = "Other";
2996
+ ((ProteusError_Tags) => {
2997
+ ProteusError_Tags["SessionNotFound"] = "SessionNotFound";
2998
+ ProteusError_Tags["DuplicateMessage"] = "DuplicateMessage";
2999
+ ProteusError_Tags["RemoteIdentityChanged"] = "RemoteIdentityChanged";
3000
+ ProteusError_Tags["Other"] = "Other";
2971
3001
  })(ProteusError_Tags ||= {});
2972
3002
  var ProteusError = (() => {
2973
3003
 
@@ -3121,12 +3151,12 @@ var FfiConverterTypeProteusError = (() => {
3121
3151
  return new FFIConverter;
3122
3152
  })();
3123
3153
  var CoreCryptoError_Tags;
3124
- ((CoreCryptoError_Tags2) => {
3125
- CoreCryptoError_Tags2["Mls"] = "Mls";
3126
- CoreCryptoError_Tags2["Proteus"] = "Proteus";
3127
- CoreCryptoError_Tags2["E2ei"] = "E2ei";
3128
- CoreCryptoError_Tags2["TransactionFailed"] = "TransactionFailed";
3129
- CoreCryptoError_Tags2["Other"] = "Other";
3154
+ ((CoreCryptoError_Tags) => {
3155
+ CoreCryptoError_Tags["Mls"] = "Mls";
3156
+ CoreCryptoError_Tags["Proteus"] = "Proteus";
3157
+ CoreCryptoError_Tags["E2ei"] = "E2ei";
3158
+ CoreCryptoError_Tags["TransactionFailed"] = "TransactionFailed";
3159
+ CoreCryptoError_Tags["Other"] = "Other";
3130
3160
  })(CoreCryptoError_Tags ||= {});
3131
3161
  var CoreCryptoError = (() => {
3132
3162
 
@@ -3432,9 +3462,9 @@ var uniffiTypeWelcomeObjectFactory = (() => {
3432
3462
  })();
3433
3463
  var FfiConverterTypeWelcome = new FfiConverterObject(uniffiTypeWelcomeObjectFactory);
3434
3464
  var MlsGroupInfoEncryptionType;
3435
- ((MlsGroupInfoEncryptionType2) => {
3436
- MlsGroupInfoEncryptionType2[MlsGroupInfoEncryptionType2["Plaintext"] = 1] = "Plaintext";
3437
- MlsGroupInfoEncryptionType2[MlsGroupInfoEncryptionType2["JweEncrypted"] = 2] = "JweEncrypted";
3465
+ ((MlsGroupInfoEncryptionType) => {
3466
+ MlsGroupInfoEncryptionType[MlsGroupInfoEncryptionType["Plaintext"] = 1] = "Plaintext";
3467
+ MlsGroupInfoEncryptionType[MlsGroupInfoEncryptionType["JweEncrypted"] = 2] = "JweEncrypted";
3438
3468
  })(MlsGroupInfoEncryptionType ||= {});
3439
3469
  var FfiConverterTypeMlsGroupInfoEncryptionType = (() => {
3440
3470
  const ordinalConverter = FfiConverterInt32;
@@ -3465,10 +3495,10 @@ var FfiConverterTypeMlsGroupInfoEncryptionType = (() => {
3465
3495
  return new FFIConverter;
3466
3496
  })();
3467
3497
  var MlsRatchetTreeType;
3468
- ((MlsRatchetTreeType2) => {
3469
- MlsRatchetTreeType2[MlsRatchetTreeType2["Full"] = 1] = "Full";
3470
- MlsRatchetTreeType2[MlsRatchetTreeType2["Delta"] = 2] = "Delta";
3471
- MlsRatchetTreeType2[MlsRatchetTreeType2["ByRef"] = 3] = "ByRef";
3498
+ ((MlsRatchetTreeType) => {
3499
+ MlsRatchetTreeType[MlsRatchetTreeType["Full"] = 1] = "Full";
3500
+ MlsRatchetTreeType[MlsRatchetTreeType["Delta"] = 2] = "Delta";
3501
+ MlsRatchetTreeType[MlsRatchetTreeType["ByRef"] = 3] = "ByRef";
3472
3502
  })(MlsRatchetTreeType ||= {});
3473
3503
  var FfiConverterTypeMlsRatchetTreeType = (() => {
3474
3504
  const ordinalConverter = FfiConverterInt32;
@@ -4042,10 +4072,10 @@ var FfiConverterTypeProteusAutoPrekeyBundle = (() => {
4042
4072
  return new FFIConverter;
4043
4073
  })();
4044
4074
  var DeviceStatus;
4045
- ((DeviceStatus2) => {
4046
- DeviceStatus2[DeviceStatus2["Valid"] = 1] = "Valid";
4047
- DeviceStatus2[DeviceStatus2["Expired"] = 2] = "Expired";
4048
- DeviceStatus2[DeviceStatus2["Revoked"] = 3] = "Revoked";
4075
+ ((DeviceStatus) => {
4076
+ DeviceStatus[DeviceStatus["Valid"] = 1] = "Valid";
4077
+ DeviceStatus[DeviceStatus["Expired"] = 2] = "Expired";
4078
+ DeviceStatus[DeviceStatus["Revoked"] = 3] = "Revoked";
4049
4079
  })(DeviceStatus ||= {});
4050
4080
  var FfiConverterTypeDeviceStatus = (() => {
4051
4081
  const ordinalConverter = FfiConverterInt32;
@@ -4080,9 +4110,9 @@ var FfiConverterTypeDeviceStatus = (() => {
4080
4110
  return new FFIConverter;
4081
4111
  })();
4082
4112
  var CredentialType;
4083
- ((CredentialType2) => {
4084
- CredentialType2[CredentialType2["Basic"] = 1] = "Basic";
4085
- CredentialType2[CredentialType2["X509"] = 2] = "X509";
4113
+ ((CredentialType) => {
4114
+ CredentialType[CredentialType["Basic"] = 1] = "Basic";
4115
+ CredentialType[CredentialType["X509"] = 2] = "X509";
4086
4116
  })(CredentialType ||= {});
4087
4117
  var FfiConverterTypeCredentialType = (() => {
4088
4118
  const ordinalConverter = FfiConverterInt32;
@@ -4190,14 +4220,14 @@ var FfiConverterTypeWireIdentity = (() => {
4190
4220
  return new FFIConverter;
4191
4221
  })();
4192
4222
  var CipherSuite;
4193
- ((CipherSuite2) => {
4194
- CipherSuite2[CipherSuite2["Mls128Dhkemx25519Aes128gcmSha256Ed25519"] = 1] = "Mls128Dhkemx25519Aes128gcmSha256Ed25519";
4195
- CipherSuite2[CipherSuite2["Mls128Dhkemp256Aes128gcmSha256P256"] = 2] = "Mls128Dhkemp256Aes128gcmSha256P256";
4196
- CipherSuite2[CipherSuite2["Mls128Dhkemx25519Chacha20poly1305Sha256Ed25519"] = 3] = "Mls128Dhkemx25519Chacha20poly1305Sha256Ed25519";
4197
- CipherSuite2[CipherSuite2["Mls256Dhkemx448Aes256gcmSha512Ed448"] = 4] = "Mls256Dhkemx448Aes256gcmSha512Ed448";
4198
- CipherSuite2[CipherSuite2["Mls256Dhkemp521Aes256gcmSha512P521"] = 5] = "Mls256Dhkemp521Aes256gcmSha512P521";
4199
- CipherSuite2[CipherSuite2["Mls256Dhkemx448Chacha20poly1305Sha512Ed448"] = 6] = "Mls256Dhkemx448Chacha20poly1305Sha512Ed448";
4200
- CipherSuite2[CipherSuite2["Mls256Dhkemp384Aes256gcmSha384P384"] = 7] = "Mls256Dhkemp384Aes256gcmSha384P384";
4223
+ ((CipherSuite) => {
4224
+ CipherSuite[CipherSuite["Mls128Dhkemx25519Aes128gcmSha256Ed25519"] = 1] = "Mls128Dhkemx25519Aes128gcmSha256Ed25519";
4225
+ CipherSuite[CipherSuite["Mls128Dhkemp256Aes128gcmSha256P256"] = 2] = "Mls128Dhkemp256Aes128gcmSha256P256";
4226
+ CipherSuite[CipherSuite["Mls128Dhkemx25519Chacha20poly1305Sha256Ed25519"] = 3] = "Mls128Dhkemx25519Chacha20poly1305Sha256Ed25519";
4227
+ CipherSuite[CipherSuite["Mls256Dhkemx448Aes256gcmSha512Ed448"] = 4] = "Mls256Dhkemx448Aes256gcmSha512Ed448";
4228
+ CipherSuite[CipherSuite["Mls256Dhkemp521Aes256gcmSha512P521"] = 5] = "Mls256Dhkemp521Aes256gcmSha512P521";
4229
+ CipherSuite[CipherSuite["Mls256Dhkemx448Chacha20poly1305Sha512Ed448"] = 6] = "Mls256Dhkemx448Chacha20poly1305Sha512Ed448";
4230
+ CipherSuite[CipherSuite["Mls256Dhkemp384Aes256gcmSha384P384"] = 7] = "Mls256Dhkemp384Aes256gcmSha384P384";
4201
4231
  })(CipherSuite ||= {});
4202
4232
  var FfiConverterTypeCipherSuite = (() => {
4203
4233
  const ordinalConverter = FfiConverterInt32;
@@ -4423,13 +4453,13 @@ var FfiConverterTypeBufferedDecryptedMessage = (() => {
4423
4453
  return new FFIConverter;
4424
4454
  })();
4425
4455
  var CoreCryptoLogLevel;
4426
- ((CoreCryptoLogLevel2) => {
4427
- CoreCryptoLogLevel2[CoreCryptoLogLevel2["Off"] = 1] = "Off";
4428
- CoreCryptoLogLevel2[CoreCryptoLogLevel2["Trace"] = 2] = "Trace";
4429
- CoreCryptoLogLevel2[CoreCryptoLogLevel2["Debug"] = 3] = "Debug";
4430
- CoreCryptoLogLevel2[CoreCryptoLogLevel2["Info"] = 4] = "Info";
4431
- CoreCryptoLogLevel2[CoreCryptoLogLevel2["Warn"] = 5] = "Warn";
4432
- CoreCryptoLogLevel2[CoreCryptoLogLevel2["Error"] = 6] = "Error";
4456
+ ((CoreCryptoLogLevel) => {
4457
+ CoreCryptoLogLevel[CoreCryptoLogLevel["Off"] = 1] = "Off";
4458
+ CoreCryptoLogLevel[CoreCryptoLogLevel["Trace"] = 2] = "Trace";
4459
+ CoreCryptoLogLevel[CoreCryptoLogLevel["Debug"] = 3] = "Debug";
4460
+ CoreCryptoLogLevel[CoreCryptoLogLevel["Info"] = 4] = "Info";
4461
+ CoreCryptoLogLevel[CoreCryptoLogLevel["Warn"] = 5] = "Warn";
4462
+ CoreCryptoLogLevel[CoreCryptoLogLevel["Error"] = 6] = "Error";
4433
4463
  })(CoreCryptoLogLevel ||= {});
4434
4464
  var FfiConverterTypeCoreCryptoLogLevel = (() => {
4435
4465
  const ordinalConverter = FfiConverterInt32;
@@ -4611,10 +4641,10 @@ var FfiConverterTypeDecryptedMessage = (() => {
4611
4641
  return new FFIConverter;
4612
4642
  })();
4613
4643
  var E2eiConversationState;
4614
- ((E2eiConversationState2) => {
4615
- E2eiConversationState2[E2eiConversationState2["Verified"] = 1] = "Verified";
4616
- E2eiConversationState2[E2eiConversationState2["NotVerified"] = 2] = "NotVerified";
4617
- E2eiConversationState2[E2eiConversationState2["NotEnabled"] = 3] = "NotEnabled";
4644
+ ((E2eiConversationState) => {
4645
+ E2eiConversationState[E2eiConversationState["Verified"] = 1] = "Verified";
4646
+ E2eiConversationState[E2eiConversationState["NotVerified"] = 2] = "NotVerified";
4647
+ E2eiConversationState[E2eiConversationState["NotEnabled"] = 3] = "NotEnabled";
4618
4648
  })(E2eiConversationState ||= {});
4619
4649
  var FfiConverterTypeE2eiConversationState = (() => {
4620
4650
  const ordinalConverter = FfiConverterInt32;
@@ -4649,8 +4679,8 @@ var FfiConverterTypeE2eiConversationState = (() => {
4649
4679
  return new FFIConverter;
4650
4680
  })();
4651
4681
  var EpochChangedReportingError_Tags;
4652
- ((EpochChangedReportingError_Tags2) => {
4653
- EpochChangedReportingError_Tags2["Ffi"] = "Ffi";
4682
+ ((EpochChangedReportingError_Tags) => {
4683
+ EpochChangedReportingError_Tags["Ffi"] = "Ffi";
4654
4684
  })(EpochChangedReportingError_Tags ||= {});
4655
4685
  var EpochChangedReportingError = (() => {
4656
4686
 
@@ -4697,13 +4727,13 @@ var FfiConverterTypeEpochChangedReportingError = (() => {
4697
4727
  return new FfiConverter;
4698
4728
  })();
4699
4729
  var HttpMethod;
4700
- ((HttpMethod2) => {
4701
- HttpMethod2[HttpMethod2["Get"] = 0] = "Get";
4702
- HttpMethod2[HttpMethod2["Post"] = 1] = "Post";
4703
- HttpMethod2[HttpMethod2["Put"] = 2] = "Put";
4704
- HttpMethod2[HttpMethod2["Delete"] = 3] = "Delete";
4705
- HttpMethod2[HttpMethod2["Patch"] = 4] = "Patch";
4706
- HttpMethod2[HttpMethod2["Head"] = 5] = "Head";
4730
+ ((HttpMethod) => {
4731
+ HttpMethod[HttpMethod["Get"] = 0] = "Get";
4732
+ HttpMethod[HttpMethod["Post"] = 1] = "Post";
4733
+ HttpMethod[HttpMethod["Put"] = 2] = "Put";
4734
+ HttpMethod[HttpMethod["Delete"] = 3] = "Delete";
4735
+ HttpMethod[HttpMethod["Patch"] = 4] = "Patch";
4736
+ HttpMethod[HttpMethod["Head"] = 5] = "Head";
4707
4737
  })(HttpMethod ||= {});
4708
4738
  var FfiConverterTypeHttpMethod = (() => {
4709
4739
  const ordinalConverter = FfiConverterInt32;
@@ -4750,8 +4780,8 @@ var FfiConverterTypeHttpMethod = (() => {
4750
4780
  return new FFIConverter;
4751
4781
  })();
4752
4782
  var LoggingError_Tags;
4753
- ((LoggingError_Tags2) => {
4754
- LoggingError_Tags2["Ffi"] = "Ffi";
4783
+ ((LoggingError_Tags) => {
4784
+ LoggingError_Tags["Ffi"] = "Ffi";
4755
4785
  })(LoggingError_Tags ||= {});
4756
4786
  var LoggingError = (() => {
4757
4787
 
@@ -4979,12 +5009,12 @@ var FfiConverterTypePkiEnvironmentHooksError = (() => {
4979
5009
  return new FFIConverter;
4980
5010
  })();
4981
5011
  var SignatureScheme;
4982
- ((SignatureScheme2) => {
4983
- SignatureScheme2[SignatureScheme2["EcdsaSecp256r1Sha256"] = 1027] = "EcdsaSecp256r1Sha256";
4984
- SignatureScheme2[SignatureScheme2["EcdsaSecp384r1Sha384"] = 1283] = "EcdsaSecp384r1Sha384";
4985
- SignatureScheme2[SignatureScheme2["EcdsaSecp521r1Sha512"] = 1539] = "EcdsaSecp521r1Sha512";
4986
- SignatureScheme2[SignatureScheme2["Ed25519"] = 2055] = "Ed25519";
4987
- SignatureScheme2[SignatureScheme2["Ed448"] = 2056] = "Ed448";
5012
+ ((SignatureScheme) => {
5013
+ SignatureScheme[SignatureScheme["EcdsaSecp256r1Sha256"] = 1027] = "EcdsaSecp256r1Sha256";
5014
+ SignatureScheme[SignatureScheme["EcdsaSecp384r1Sha384"] = 1283] = "EcdsaSecp384r1Sha384";
5015
+ SignatureScheme[SignatureScheme["EcdsaSecp521r1Sha512"] = 1539] = "EcdsaSecp521r1Sha512";
5016
+ SignatureScheme[SignatureScheme["Ed25519"] = 2055] = "Ed25519";
5017
+ SignatureScheme[SignatureScheme["Ed448"] = 2056] = "Ed448";
4988
5018
  })(SignatureScheme ||= {});
4989
5019
  var FfiConverterTypeSignatureScheme = (() => {
4990
5020
  const ordinalConverter = FfiConverterInt32;
@@ -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
  }
@@ -8456,7 +8556,7 @@ function uniffiEnsureInitialized() {
8456
8556
  if (core_crypto_ffi_ffi_default().uniffi_core_crypto_ffi_checksum_method_corecryptocontext_proteus_last_resort_prekey() !== 59192) {
8457
8557
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_core_crypto_ffi_checksum_method_corecryptocontext_proteus_last_resort_prekey");
8458
8558
  }
8459
- if (core_crypto_ffi_ffi_default().uniffi_core_crypto_ffi_checksum_method_corecryptocontext_proteus_new_prekey() !== 50191) {
8559
+ if (core_crypto_ffi_ffi_default().uniffi_core_crypto_ffi_checksum_method_corecryptocontext_proteus_new_prekey() !== 47943) {
8460
8560
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_core_crypto_ffi_checksum_method_corecryptocontext_proteus_new_prekey");
8461
8561
  }
8462
8562
  if (core_crypto_ffi_ffi_default().uniffi_core_crypto_ffi_checksum_method_corecryptocontext_proteus_new_prekey_auto() !== 37928) {
@@ -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() !== 9292) {
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,
@@ -8892,62 +8999,62 @@ class X509CredentialAcquisition2 extends X509CredentialAcquisition {
8892
8999
  }
8893
9000
  }
8894
9001
  export {
8895
- version,
8896
- setMaxLogLevel,
8897
- setLogger,
8898
- proteusLastResortPrekeyIdFfi as proteusLastResortPrekeyId,
8899
- migrateDatabaseKeyTypeToBytes,
8900
- cipherSuiteFromU16,
8901
- cipherSuiteDefault,
8902
- buildMetadata,
8903
- X509Identity,
8904
- X509CredentialAcquisitionConfiguration,
8905
- X509CredentialAcquisition2 as X509CredentialAcquisition,
8906
- WireIdentity,
8907
- Welcome,
8908
- Uuid,
8909
- SignatureScheme,
8910
- SecretKey,
8911
- MlsRatchetTreeType as RatchetTreeType,
8912
- ProteusError_Tags,
8913
- ProteusError,
8914
- ProteusAutoPrekeyBundle,
8915
- PkiEnvironmentHooksError,
8916
- PkiEnvironment,
8917
- NewHistoryClientReportingError,
8918
- MlsTransportError,
8919
- MlsError_Tags,
8920
- MlsError,
8921
- LoggingError_Tags,
8922
- LoggingError,
8923
- KeyPackageRef,
8924
- KeyPackage,
8925
- HttpResponse,
8926
- HttpMethod,
8927
- HttpHeader,
8928
- MlsGroupInfoEncryptionType as GroupInfoEncryptionType,
8929
- GroupInfo,
8930
- ExternalSender,
8931
- EpochChangedReportingError_Tags,
8932
- EpochChangedReportingError,
8933
- E2eiConversationState,
8934
- DeviceStatus,
8935
- DeviceId,
8936
- DeserializedClientId,
8937
- DecryptedMessage,
8938
- DatabaseKey,
8939
- Database,
8940
- CredentialType,
8941
- CredentialRef,
8942
- Credential,
8943
- CoreCryptoLogLevel,
8944
- CoreCryptoError_Tags,
8945
- CoreCryptoError,
8946
- CoreCryptoContext2 as CoreCryptoContext,
8947
- CoreCrypto,
8948
- ConversationId,
8949
- ClientId,
8950
- CipherSuite,
9002
+ BufferedDecryptedMessage,
8951
9003
  BuildMetadata,
8952
- BufferedDecryptedMessage
9004
+ CipherSuite,
9005
+ ClientId,
9006
+ ConversationId,
9007
+ CoreCrypto,
9008
+ CoreCryptoContext2 as CoreCryptoContext,
9009
+ CoreCryptoError,
9010
+ CoreCryptoError_Tags,
9011
+ CoreCryptoLogLevel,
9012
+ Credential,
9013
+ CredentialRef,
9014
+ CredentialType,
9015
+ Database,
9016
+ DatabaseKey,
9017
+ DecryptedMessage,
9018
+ DeserializedClientId,
9019
+ DeviceId,
9020
+ DeviceStatus,
9021
+ E2eiConversationState,
9022
+ EpochChangedReportingError,
9023
+ EpochChangedReportingError_Tags,
9024
+ ExternalSender,
9025
+ GroupInfo,
9026
+ MlsGroupInfoEncryptionType as GroupInfoEncryptionType,
9027
+ HttpHeader,
9028
+ HttpMethod,
9029
+ HttpResponse,
9030
+ KeyPackage,
9031
+ KeyPackageRef,
9032
+ LoggingError,
9033
+ LoggingError_Tags,
9034
+ MlsError,
9035
+ MlsError_Tags,
9036
+ MlsTransportError,
9037
+ NewHistoryClientReportingError,
9038
+ PkiEnvironment,
9039
+ PkiEnvironmentHooksError,
9040
+ ProteusAutoPrekeyBundle,
9041
+ ProteusError,
9042
+ ProteusError_Tags,
9043
+ MlsRatchetTreeType as RatchetTreeType,
9044
+ SecretKey,
9045
+ SignatureScheme,
9046
+ Uuid,
9047
+ Welcome,
9048
+ WireIdentity,
9049
+ X509CredentialAcquisition2 as X509CredentialAcquisition,
9050
+ X509CredentialAcquisitionConfiguration,
9051
+ X509Identity,
9052
+ buildMetadata,
9053
+ cipherSuiteDefault,
9054
+ cipherSuiteFromU16,
9055
+ migrateDatabaseKeyTypeToBytes,
9056
+ proteusLastResortPrekeyIdFfi as proteusLastResortPrekeyId,
9057
+ setLogger,
9058
+ setMaxLogLevel,
9059
+ version
8953
9060
  };
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wireapp/core-crypto",
3
- "version": "10.3.0",
3
+ "version": "10.5.0",
4
4
  "description": "CoreCrypto bindings for browser and native JavaScript runtimes",
5
5
  "keywords": [
6
6
  "corecrypto",