@@ -1083,6 +1083,12 @@ internal open class UniffiVTableCallbackInterfaceVerificationRequestListener(
1083
1083
1084
1084
1085
1085
1086
+
1087
+
1088
+
1089
+
1090
+
1091
+
1086
1092
1087
1093
1088
1094
@@ -1156,8 +1162,14 @@ internal interface UniffiLib : Library {
1156
1162
): Unit
1157
1163
fun uniffi_matrix_sdk_crypto_ffi_fn_method_dehydrateddevices_create (`ptr`: Pointer ,uniffi_out_err : UniffiRustCallStatus ,
1158
1164
): Pointer
1165
+ fun uniffi_matrix_sdk_crypto_ffi_fn_method_dehydrateddevices_delete_dehydrated_device_key (`ptr`: Pointer ,uniffi_out_err : UniffiRustCallStatus ,
1166
+ ): Unit
1167
+ fun uniffi_matrix_sdk_crypto_ffi_fn_method_dehydrateddevices_get_dehydrated_device_key (`ptr`: Pointer ,uniffi_out_err : UniffiRustCallStatus ,
1168
+ ): RustBuffer .ByValue
1159
1169
fun uniffi_matrix_sdk_crypto_ffi_fn_method_dehydrateddevices_rehydrate (`ptr`: Pointer ,`pickleKey`: RustBuffer .ByValue ,`deviceId`: RustBuffer .ByValue ,`deviceData`: RustBuffer .ByValue ,uniffi_out_err : UniffiRustCallStatus ,
1160
1170
): Pointer
1171
+ fun uniffi_matrix_sdk_crypto_ffi_fn_method_dehydrateddevices_save_dehydrated_device_key (`ptr`: Pointer ,`pickleKey`: RustBuffer .ByValue ,uniffi_out_err : UniffiRustCallStatus ,
1172
+ ): Unit
1161
1173
fun uniffi_matrix_sdk_crypto_ffi_fn_clone_olmmachine (`ptr`: Pointer ,uniffi_out_err : UniffiRustCallStatus ,
1162
1174
): Pointer
1163
1175
fun uniffi_matrix_sdk_crypto_ffi_fn_free_olmmachine (`ptr`: Pointer ,uniffi_out_err : UniffiRustCallStatus ,
@@ -1570,8 +1582,14 @@ internal interface UniffiLib : Library {
1570
1582
): Short
1571
1583
fun uniffi_matrix_sdk_crypto_ffi_checksum_method_dehydrateddevices_create (
1572
1584
): Short
1585
+ fun uniffi_matrix_sdk_crypto_ffi_checksum_method_dehydrateddevices_delete_dehydrated_device_key (
1586
+ ): Short
1587
+ fun uniffi_matrix_sdk_crypto_ffi_checksum_method_dehydrateddevices_get_dehydrated_device_key (
1588
+ ): Short
1573
1589
fun uniffi_matrix_sdk_crypto_ffi_checksum_method_dehydrateddevices_rehydrate (
1574
1590
): Short
1591
+ fun uniffi_matrix_sdk_crypto_ffi_checksum_method_dehydrateddevices_save_dehydrated_device_key (
1592
+ ): Short
1575
1593
fun uniffi_matrix_sdk_crypto_ffi_checksum_method_olmmachine_backup_enabled (
1576
1594
): Short
1577
1595
fun uniffi_matrix_sdk_crypto_ffi_checksum_method_olmmachine_backup_room_keys (
@@ -1866,13 +1884,22 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) {
1866
1884
if (lib.uniffi_matrix_sdk_crypto_ffi_checksum_method_backuprecoverykey_to_base64() != 3854 .toShort()) {
1867
1885
throw RuntimeException (" UniFFI API checksum mismatch: try cleaning and rebuilding your project" )
1868
1886
}
1869
- if (lib.uniffi_matrix_sdk_crypto_ffi_checksum_method_dehydrateddevice_keys_for_upload() != 49513 .toShort()) {
1887
+ if (lib.uniffi_matrix_sdk_crypto_ffi_checksum_method_dehydrateddevice_keys_for_upload() != 27279 .toShort()) {
1870
1888
throw RuntimeException (" UniFFI API checksum mismatch: try cleaning and rebuilding your project" )
1871
1889
}
1872
1890
if (lib.uniffi_matrix_sdk_crypto_ffi_checksum_method_dehydrateddevices_create() != 20431 .toShort()) {
1873
1891
throw RuntimeException (" UniFFI API checksum mismatch: try cleaning and rebuilding your project" )
1874
1892
}
1875
- if (lib.uniffi_matrix_sdk_crypto_ffi_checksum_method_dehydrateddevices_rehydrate() != 16901 .toShort()) {
1893
+ if (lib.uniffi_matrix_sdk_crypto_ffi_checksum_method_dehydrateddevices_delete_dehydrated_device_key() != 20976 .toShort()) {
1894
+ throw RuntimeException (" UniFFI API checksum mismatch: try cleaning and rebuilding your project" )
1895
+ }
1896
+ if (lib.uniffi_matrix_sdk_crypto_ffi_checksum_method_dehydrateddevices_get_dehydrated_device_key() != 52976 .toShort()) {
1897
+ throw RuntimeException (" UniFFI API checksum mismatch: try cleaning and rebuilding your project" )
1898
+ }
1899
+ if (lib.uniffi_matrix_sdk_crypto_ffi_checksum_method_dehydrateddevices_rehydrate() != 62661 .toShort()) {
1900
+ throw RuntimeException (" UniFFI API checksum mismatch: try cleaning and rebuilding your project" )
1901
+ }
1902
+ if (lib.uniffi_matrix_sdk_crypto_ffi_checksum_method_dehydrateddevices_save_dehydrated_device_key() != 54923 .toShort()) {
1876
1903
throw RuntimeException (" UniFFI API checksum mismatch: try cleaning and rebuilding your project" )
1877
1904
}
1878
1905
if (lib.uniffi_matrix_sdk_crypto_ffi_checksum_method_olmmachine_backup_enabled() != 55573 .toShort()) {
@@ -3238,7 +3265,7 @@ public object FfiConverterTypeBackupRecoveryKey: FfiConverter<BackupRecoveryKey,
3238
3265
3239
3266
public interface DehydratedDeviceInterface {
3240
3267
3241
- fun `keysForUpload` (`deviceDisplayName`: kotlin.String , `pickleKey`: kotlin. ByteArray ): UploadDehydratedDeviceRequest
3268
+ fun `keysForUpload` (`deviceDisplayName`: kotlin.String , `pickleKey`: DehydratedDeviceKey ): UploadDehydratedDeviceRequest
3242
3269
3243
3270
companion object
3244
3271
}
@@ -3325,12 +3352,12 @@ open class DehydratedDevice: Disposable, AutoCloseable, DehydratedDeviceInterfac
3325
3352
}
3326
3353
3327
3354
3328
- @Throws(DehydrationException ::class )override fun `keysForUpload` (`deviceDisplayName`: kotlin.String , `pickleKey`: kotlin. ByteArray ): UploadDehydratedDeviceRequest {
3355
+ @Throws(DehydrationException ::class )override fun `keysForUpload` (`deviceDisplayName`: kotlin.String , `pickleKey`: DehydratedDeviceKey ): UploadDehydratedDeviceRequest {
3329
3356
return FfiConverterTypeUploadDehydratedDeviceRequest .lift(
3330
3357
callWithPointer {
3331
3358
uniffiRustCallWithError(DehydrationException ) { _status ->
3332
3359
UniffiLib .INSTANCE .uniffi_matrix_sdk_crypto_ffi_fn_method_dehydrateddevice_keys_for_upload(
3333
- it, FfiConverterString .lower(`deviceDisplayName`),FfiConverterByteArray .lower(`pickleKey`),_status )
3360
+ it, FfiConverterString .lower(`deviceDisplayName`),FfiConverterTypeDehydratedDeviceKey .lower(`pickleKey`),_status )
3334
3361
}
3335
3362
}
3336
3363
)
@@ -3473,7 +3500,31 @@ public interface DehydratedDevicesInterface {
3473
3500
3474
3501
fun `create` (): DehydratedDevice
3475
3502
3476
- fun `rehydrate` (`pickleKey`: kotlin.ByteArray , `deviceId`: kotlin.String , `deviceData`: kotlin.String ): RehydratedDevice
3503
+ /* *
3504
+ * Deletes the previously stored dehydrated device pickle key.
3505
+ */
3506
+ fun `deleteDehydratedDeviceKey` ()
3507
+
3508
+ /* *
3509
+ * Get the cached dehydrated device pickle key if any.
3510
+ *
3511
+ * None if the key was not previously cached (via
3512
+ * [`Self::save_dehydrated_device_pickle_key`]).
3513
+ *
3514
+ * Should be used to periodically rotate the dehydrated device to avoid
3515
+ * OTK exhaustion and accumulation of to_device messages.
3516
+ */
3517
+ fun `getDehydratedDeviceKey` (): DehydratedDeviceKey ?
3518
+
3519
+ fun `rehydrate` (`pickleKey`: DehydratedDeviceKey , `deviceId`: kotlin.String , `deviceData`: kotlin.String ): RehydratedDevice
3520
+
3521
+ /* *
3522
+ * Store the dehydrated device pickle key in the crypto store.
3523
+ *
3524
+ * This is useful if the client wants to periodically rotate dehydrated
3525
+ * devices to avoid OTK exhaustion and accumulated to_device problems.
3526
+ */
3527
+ fun `saveDehydratedDeviceKey` (`pickleKey`: DehydratedDeviceKey )
3477
3528
3478
3529
companion object
3479
3530
}
@@ -3573,19 +3624,74 @@ open class DehydratedDevices: Disposable, AutoCloseable, DehydratedDevicesInterf
3573
3624
3574
3625
3575
3626
3576
- @Throws(DehydrationException ::class )override fun `rehydrate` (`pickleKey`: kotlin.ByteArray , `deviceId`: kotlin.String , `deviceData`: kotlin.String ): RehydratedDevice {
3627
+ /* *
3628
+ * Deletes the previously stored dehydrated device pickle key.
3629
+ */
3630
+ @Throws(CryptoStoreException ::class )override fun `deleteDehydratedDeviceKey` ()
3631
+ =
3632
+ callWithPointer {
3633
+ uniffiRustCallWithError(CryptoStoreException ) { _status ->
3634
+ UniffiLib .INSTANCE .uniffi_matrix_sdk_crypto_ffi_fn_method_dehydrateddevices_delete_dehydrated_device_key(
3635
+ it, _status )
3636
+ }
3637
+ }
3638
+
3639
+
3640
+
3641
+
3642
+ /* *
3643
+ * Get the cached dehydrated device pickle key if any.
3644
+ *
3645
+ * None if the key was not previously cached (via
3646
+ * [`Self::save_dehydrated_device_pickle_key`]).
3647
+ *
3648
+ * Should be used to periodically rotate the dehydrated device to avoid
3649
+ * OTK exhaustion and accumulation of to_device messages.
3650
+ */
3651
+ @Throws(CryptoStoreException ::class )override fun `getDehydratedDeviceKey` (): DehydratedDeviceKey ? {
3652
+ return FfiConverterOptionalTypeDehydratedDeviceKey .lift(
3653
+ callWithPointer {
3654
+ uniffiRustCallWithError(CryptoStoreException ) { _status ->
3655
+ UniffiLib .INSTANCE .uniffi_matrix_sdk_crypto_ffi_fn_method_dehydrateddevices_get_dehydrated_device_key(
3656
+ it, _status )
3657
+ }
3658
+ }
3659
+ )
3660
+ }
3661
+
3662
+
3663
+
3664
+ @Throws(DehydrationException ::class )override fun `rehydrate` (`pickleKey`: DehydratedDeviceKey , `deviceId`: kotlin.String , `deviceData`: kotlin.String ): RehydratedDevice {
3577
3665
return FfiConverterTypeRehydratedDevice .lift(
3578
3666
callWithPointer {
3579
3667
uniffiRustCallWithError(DehydrationException ) { _status ->
3580
3668
UniffiLib .INSTANCE .uniffi_matrix_sdk_crypto_ffi_fn_method_dehydrateddevices_rehydrate(
3581
- it, FfiConverterByteArray .lower(`pickleKey`),FfiConverterString .lower(`deviceId`),FfiConverterString .lower(`deviceData`),_status )
3669
+ it, FfiConverterTypeDehydratedDeviceKey .lower(`pickleKey`),FfiConverterString .lower(`deviceId`),FfiConverterString .lower(`deviceData`),_status )
3582
3670
}
3583
3671
}
3584
3672
)
3585
3673
}
3586
3674
3587
3675
3588
3676
3677
+ /* *
3678
+ * Store the dehydrated device pickle key in the crypto store.
3679
+ *
3680
+ * This is useful if the client wants to periodically rotate dehydrated
3681
+ * devices to avoid OTK exhaustion and accumulated to_device problems.
3682
+ */
3683
+ @Throws(CryptoStoreException ::class )override fun `saveDehydratedDeviceKey` (`pickleKey`: DehydratedDeviceKey )
3684
+ =
3685
+ callWithPointer {
3686
+ uniffiRustCallWithError(CryptoStoreException ) { _status ->
3687
+ UniffiLib .INSTANCE .uniffi_matrix_sdk_crypto_ffi_fn_method_dehydrateddevices_save_dehydrated_device_key(
3688
+ it, FfiConverterTypeDehydratedDeviceKey .lower(`pickleKey`),_status )
3689
+ }
3690
+ }
3691
+
3692
+
3693
+
3694
+
3589
3695
3590
3696
3591
3697
@@ -8802,6 +8908,34 @@ public object FfiConverterTypeDecryptedEvent: FfiConverterRustBuffer<DecryptedEv
8802
8908
8803
8909
8804
8910
8911
+ /* *
8912
+ * Dehydrated device key
8913
+ */
8914
+ data class DehydratedDeviceKey (
8915
+ var `inner`: kotlin.ByteArray
8916
+ ) {
8917
+
8918
+ companion object
8919
+ }
8920
+
8921
+ public object FfiConverterTypeDehydratedDeviceKey: FfiConverterRustBuffer<DehydratedDeviceKey> {
8922
+ override fun read (buf : ByteBuffer ): DehydratedDeviceKey {
8923
+ return DehydratedDeviceKey (
8924
+ FfiConverterByteArray .read(buf),
8925
+ )
8926
+ }
8927
+
8928
+ override fun allocationSize (value : DehydratedDeviceKey ) = (
8929
+ FfiConverterByteArray .allocationSize(value.`inner`)
8930
+ )
8931
+
8932
+ override fun write (value : DehydratedDeviceKey , buf : ByteBuffer ) {
8933
+ FfiConverterByteArray .write(value.`inner`, buf)
8934
+ }
8935
+ }
8936
+
8937
+
8938
+
8805
8939
/* *
8806
8940
* An E2EE capable Matrix device.
8807
8941
*/
@@ -10161,6 +10295,8 @@ sealed class CryptoStoreException(message: String): kotlin.Exception(message) {
10161
10295
10162
10296
class Identifier (message : String ) : CryptoStoreException(message)
10163
10297
10298
+ class DehydrationException (message : String ) : CryptoStoreException(message)
10299
+
10164
10300
10165
10301
companion object ErrorHandler : UniffiRustCallStatusErrorHandler<CryptoStoreException> {
10166
10302
override fun lift (error_buf : RustBuffer .ByValue ): CryptoStoreException = FfiConverterTypeCryptoStoreError .lift(error_buf)
@@ -10177,6 +10313,7 @@ public object FfiConverterTypeCryptoStoreError : FfiConverterRustBuffer<CryptoSt
10177
10313
4 -> CryptoStoreException .Serialization (FfiConverterString .read(buf))
10178
10314
5 -> CryptoStoreException .InvalidUserId (FfiConverterString .read(buf))
10179
10315
6 -> CryptoStoreException .Identifier (FfiConverterString .read(buf))
10316
+ 7 -> CryptoStoreException .DehydrationException (FfiConverterString .read(buf))
10180
10317
else -> throw RuntimeException (" invalid error enum value, something is very wrong!!" )
10181
10318
}
10182
10319
@@ -10212,6 +10349,10 @@ public object FfiConverterTypeCryptoStoreError : FfiConverterRustBuffer<CryptoSt
10212
10349
buf.putInt(6 )
10213
10350
Unit
10214
10351
}
10352
+ is CryptoStoreException .DehydrationException -> {
10353
+ buf.putInt(7 )
10354
+ Unit
10355
+ }
10215
10356
}.let { /* this makes the `when` an expression, which ensures it is exhaustive */ }
10216
10357
}
10217
10358
@@ -10434,6 +10575,8 @@ sealed class DehydrationException(message: String): kotlin.Exception(message) {
10434
10575
10435
10576
class PickleKeyLength (message : String ) : DehydrationException(message)
10436
10577
10578
+ class Rand (message : String ) : DehydrationException(message)
10579
+
10437
10580
10438
10581
companion object ErrorHandler : UniffiRustCallStatusErrorHandler<DehydrationException> {
10439
10582
override fun lift (error_buf : RustBuffer .ByValue ): DehydrationException = FfiConverterTypeDehydrationError .lift(error_buf)
@@ -10449,6 +10592,7 @@ public object FfiConverterTypeDehydrationError : FfiConverterRustBuffer<Dehydrat
10449
10592
3 -> DehydrationException .Json (FfiConverterString .read(buf))
10450
10593
4 -> DehydrationException .Store (FfiConverterString .read(buf))
10451
10594
5 -> DehydrationException .PickleKeyLength (FfiConverterString .read(buf))
10595
+ 6 -> DehydrationException .Rand (FfiConverterString .read(buf))
10452
10596
else -> throw RuntimeException (" invalid error enum value, something is very wrong!!" )
10453
10597
}
10454
10598
@@ -10480,6 +10624,10 @@ public object FfiConverterTypeDehydrationError : FfiConverterRustBuffer<Dehydrat
10480
10624
buf.putInt(5 )
10481
10625
Unit
10482
10626
}
10627
+ is DehydrationException .Rand -> {
10628
+ buf.putInt(6 )
10629
+ Unit
10630
+ }
10483
10631
}.let { /* this makes the `when` an expression, which ensures it is exhaustive */ }
10484
10632
}
10485
10633
@@ -12418,6 +12566,35 @@ public object FfiConverterOptionalTypeCrossSigningKeyExport: FfiConverterRustBuf
12418
12566
12419
12567
12420
12568
12569
+ public object FfiConverterOptionalTypeDehydratedDeviceKey: FfiConverterRustBuffer<DehydratedDeviceKey?> {
12570
+ override fun read (buf : ByteBuffer ): DehydratedDeviceKey ? {
12571
+ if (buf.get().toInt() == 0 ) {
12572
+ return null
12573
+ }
12574
+ return FfiConverterTypeDehydratedDeviceKey .read(buf)
12575
+ }
12576
+
12577
+ override fun allocationSize (value : DehydratedDeviceKey ? ): ULong {
12578
+ if (value == null ) {
12579
+ return 1UL
12580
+ } else {
12581
+ return 1UL + FfiConverterTypeDehydratedDeviceKey .allocationSize(value)
12582
+ }
12583
+ }
12584
+
12585
+ override fun write (value : DehydratedDeviceKey ? , buf : ByteBuffer ) {
12586
+ if (value == null ) {
12587
+ buf.put(0 )
12588
+ } else {
12589
+ buf.put(1 )
12590
+ FfiConverterTypeDehydratedDeviceKey .write(value, buf)
12591
+ }
12592
+ }
12593
+ }
12594
+
12595
+
12596
+
12597
+
12421
12598
public object FfiConverterOptionalTypeDevice: FfiConverterRustBuffer<Device?> {
12422
12599
override fun read (buf : ByteBuffer ): Device ? {
12423
12600
if (buf.get().toInt() == 0 ) {
0 commit comments