Skip to content

Commit 9d0955e

Browse files
author
github-actions
committed
Bump crypto version to 0.6.0 (matrix-rust-crypto-sdk bb573117e102261b46da3f2d6761c4b3f51850a7)
1 parent 5479ce9 commit 9d0955e

File tree

2 files changed

+186
-9
lines changed

2 files changed

+186
-9
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
object BuildVersionsCrypto {
22
const val majorVersion = 0
3-
const val minorVersion = 5
3+
const val minorVersion = 6
44
const val patchVersion = 0
55
}

crypto/crypto-android/src/main/kotlin/org/matrix/rustcomponents/sdk/crypto/matrix_sdk_crypto_ffi.kt

+185-8
Original file line numberDiff line numberDiff line change
@@ -1083,6 +1083,12 @@ internal open class UniffiVTableCallbackInterfaceVerificationRequestListener(
10831083

10841084

10851085

1086+
1087+
1088+
1089+
1090+
1091+
10861092

10871093

10881094

@@ -1156,8 +1162,14 @@ internal interface UniffiLib : Library {
11561162
): Unit
11571163
fun uniffi_matrix_sdk_crypto_ffi_fn_method_dehydrateddevices_create(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus,
11581164
): 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
11591169
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,
11601170
): 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
11611173
fun uniffi_matrix_sdk_crypto_ffi_fn_clone_olmmachine(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus,
11621174
): Pointer
11631175
fun uniffi_matrix_sdk_crypto_ffi_fn_free_olmmachine(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus,
@@ -1570,8 +1582,14 @@ internal interface UniffiLib : Library {
15701582
): Short
15711583
fun uniffi_matrix_sdk_crypto_ffi_checksum_method_dehydrateddevices_create(
15721584
): 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
15731589
fun uniffi_matrix_sdk_crypto_ffi_checksum_method_dehydrateddevices_rehydrate(
15741590
): Short
1591+
fun uniffi_matrix_sdk_crypto_ffi_checksum_method_dehydrateddevices_save_dehydrated_device_key(
1592+
): Short
15751593
fun uniffi_matrix_sdk_crypto_ffi_checksum_method_olmmachine_backup_enabled(
15761594
): Short
15771595
fun uniffi_matrix_sdk_crypto_ffi_checksum_method_olmmachine_backup_room_keys(
@@ -1866,13 +1884,22 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) {
18661884
if (lib.uniffi_matrix_sdk_crypto_ffi_checksum_method_backuprecoverykey_to_base64() != 3854.toShort()) {
18671885
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
18681886
}
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()) {
18701888
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
18711889
}
18721890
if (lib.uniffi_matrix_sdk_crypto_ffi_checksum_method_dehydrateddevices_create() != 20431.toShort()) {
18731891
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
18741892
}
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()) {
18761903
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
18771904
}
18781905
if (lib.uniffi_matrix_sdk_crypto_ffi_checksum_method_olmmachine_backup_enabled() != 55573.toShort()) {
@@ -3238,7 +3265,7 @@ public object FfiConverterTypeBackupRecoveryKey: FfiConverter<BackupRecoveryKey,
32383265

32393266
public interface DehydratedDeviceInterface {
32403267

3241-
fun `keysForUpload`(`deviceDisplayName`: kotlin.String, `pickleKey`: kotlin.ByteArray): UploadDehydratedDeviceRequest
3268+
fun `keysForUpload`(`deviceDisplayName`: kotlin.String, `pickleKey`: DehydratedDeviceKey): UploadDehydratedDeviceRequest
32423269

32433270
companion object
32443271
}
@@ -3325,12 +3352,12 @@ open class DehydratedDevice: Disposable, AutoCloseable, DehydratedDeviceInterfac
33253352
}
33263353

33273354

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 {
33293356
return FfiConverterTypeUploadDehydratedDeviceRequest.lift(
33303357
callWithPointer {
33313358
uniffiRustCallWithError(DehydrationException) { _status ->
33323359
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)
33343361
}
33353362
}
33363363
)
@@ -3473,7 +3500,31 @@ public interface DehydratedDevicesInterface {
34733500

34743501
fun `create`(): DehydratedDevice
34753502

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)
34773528

34783529
companion object
34793530
}
@@ -3573,19 +3624,74 @@ open class DehydratedDevices: Disposable, AutoCloseable, DehydratedDevicesInterf
35733624

35743625

35753626

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 {
35773665
return FfiConverterTypeRehydratedDevice.lift(
35783666
callWithPointer {
35793667
uniffiRustCallWithError(DehydrationException) { _status ->
35803668
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)
35823670
}
35833671
}
35843672
)
35853673
}
35863674

35873675

35883676

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+
35893695

35903696

35913697

@@ -8802,6 +8908,34 @@ public object FfiConverterTypeDecryptedEvent: FfiConverterRustBuffer<DecryptedEv
88028908

88038909

88048910

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+
88058939
/**
88068940
* An E2EE capable Matrix device.
88078941
*/
@@ -10161,6 +10295,8 @@ sealed class CryptoStoreException(message: String): kotlin.Exception(message) {
1016110295

1016210296
class Identifier(message: String) : CryptoStoreException(message)
1016310297

10298+
class DehydrationException(message: String) : CryptoStoreException(message)
10299+
1016410300

1016510301
companion object ErrorHandler : UniffiRustCallStatusErrorHandler<CryptoStoreException> {
1016610302
override fun lift(error_buf: RustBuffer.ByValue): CryptoStoreException = FfiConverterTypeCryptoStoreError.lift(error_buf)
@@ -10177,6 +10313,7 @@ public object FfiConverterTypeCryptoStoreError : FfiConverterRustBuffer<CryptoSt
1017710313
4 -> CryptoStoreException.Serialization(FfiConverterString.read(buf))
1017810314
5 -> CryptoStoreException.InvalidUserId(FfiConverterString.read(buf))
1017910315
6 -> CryptoStoreException.Identifier(FfiConverterString.read(buf))
10316+
7 -> CryptoStoreException.DehydrationException(FfiConverterString.read(buf))
1018010317
else -> throw RuntimeException("invalid error enum value, something is very wrong!!")
1018110318
}
1018210319

@@ -10212,6 +10349,10 @@ public object FfiConverterTypeCryptoStoreError : FfiConverterRustBuffer<CryptoSt
1021210349
buf.putInt(6)
1021310350
Unit
1021410351
}
10352+
is CryptoStoreException.DehydrationException -> {
10353+
buf.putInt(7)
10354+
Unit
10355+
}
1021510356
}.let { /* this makes the `when` an expression, which ensures it is exhaustive */ }
1021610357
}
1021710358

@@ -10434,6 +10575,8 @@ sealed class DehydrationException(message: String): kotlin.Exception(message) {
1043410575

1043510576
class PickleKeyLength(message: String) : DehydrationException(message)
1043610577

10578+
class Rand(message: String) : DehydrationException(message)
10579+
1043710580

1043810581
companion object ErrorHandler : UniffiRustCallStatusErrorHandler<DehydrationException> {
1043910582
override fun lift(error_buf: RustBuffer.ByValue): DehydrationException = FfiConverterTypeDehydrationError.lift(error_buf)
@@ -10449,6 +10592,7 @@ public object FfiConverterTypeDehydrationError : FfiConverterRustBuffer<Dehydrat
1044910592
3 -> DehydrationException.Json(FfiConverterString.read(buf))
1045010593
4 -> DehydrationException.Store(FfiConverterString.read(buf))
1045110594
5 -> DehydrationException.PickleKeyLength(FfiConverterString.read(buf))
10595+
6 -> DehydrationException.Rand(FfiConverterString.read(buf))
1045210596
else -> throw RuntimeException("invalid error enum value, something is very wrong!!")
1045310597
}
1045410598

@@ -10480,6 +10624,10 @@ public object FfiConverterTypeDehydrationError : FfiConverterRustBuffer<Dehydrat
1048010624
buf.putInt(5)
1048110625
Unit
1048210626
}
10627+
is DehydrationException.Rand -> {
10628+
buf.putInt(6)
10629+
Unit
10630+
}
1048310631
}.let { /* this makes the `when` an expression, which ensures it is exhaustive */ }
1048410632
}
1048510633

@@ -12418,6 +12566,35 @@ public object FfiConverterOptionalTypeCrossSigningKeyExport: FfiConverterRustBuf
1241812566

1241912567

1242012568

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+
1242112598
public object FfiConverterOptionalTypeDevice: FfiConverterRustBuffer<Device?> {
1242212599
override fun read(buf: ByteBuffer): Device? {
1242312600
if (buf.get().toInt() == 0) {

0 commit comments

Comments
 (0)