From cae3e3de17403c6200a1c20437391c872612124f Mon Sep 17 00:00:00 2001 From: github-actions Date: Fri, 4 Oct 2024 09:39:10 +0000 Subject: [PATCH] Bump SDK version to 0.2.51 (matrix-rust-sdk to 1d1863d323842274b8efaf9aff5542a91a81d68d) --- buildSrc/src/main/kotlin/BuildVersionsSDK.kt | 2 +- .../rustcomponents/sdk/matrix_sdk_ffi.kt | 247 ++++++++++++++++++ .../matrix_sdk_common/matrix_sdk_common.kt | 2 +- .../matrix_sdk_crypto/matrix_sdk_crypto.kt | 128 +++++++++ 4 files changed, 377 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/kotlin/BuildVersionsSDK.kt b/buildSrc/src/main/kotlin/BuildVersionsSDK.kt index 9d96830..4d6ca06 100644 --- a/buildSrc/src/main/kotlin/BuildVersionsSDK.kt +++ b/buildSrc/src/main/kotlin/BuildVersionsSDK.kt @@ -1,5 +1,5 @@ object BuildVersionsSDK { const val majorVersion = 0 const val minorVersion = 2 - const val patchVersion = 50 + const val patchVersion = 51 } diff --git a/sdk/sdk-android/src/main/kotlin/org/matrix/rustcomponents/sdk/matrix_sdk_ffi.kt b/sdk/sdk-android/src/main/kotlin/org/matrix/rustcomponents/sdk/matrix_sdk_ffi.kt index 4866eb6..127708b 100644 --- a/sdk/sdk-android/src/main/kotlin/org/matrix/rustcomponents/sdk/matrix_sdk_ffi.kt +++ b/sdk/sdk-android/src/main/kotlin/org/matrix/rustcomponents/sdk/matrix_sdk_ffi.kt @@ -52,7 +52,11 @@ import uniffi.matrix_sdk_common.FfiConverterTypeShieldStateCode import uniffi.matrix_sdk_common.ShieldStateCode import uniffi.matrix_sdk_crypto.CollectStrategy import uniffi.matrix_sdk_crypto.FfiConverterTypeCollectStrategy +import uniffi.matrix_sdk_crypto.FfiConverterTypeIdentityState +import uniffi.matrix_sdk_crypto.FfiConverterTypeTrustRequirement import uniffi.matrix_sdk_crypto.FfiConverterTypeUtdCause +import uniffi.matrix_sdk_crypto.IdentityState +import uniffi.matrix_sdk_crypto.TrustRequirement import uniffi.matrix_sdk_crypto.UtdCause import uniffi.matrix_sdk_ui.EventItemOrigin import uniffi.matrix_sdk_ui.FfiConverterTypeEventItemOrigin @@ -66,6 +70,8 @@ import uniffi.matrix_sdk.RustBuffer as RustBufferRoomMemberRole import uniffi.matrix_sdk.RustBuffer as RustBufferRoomPowerLevelChanges import uniffi.matrix_sdk_common.RustBuffer as RustBufferShieldStateCode import uniffi.matrix_sdk_crypto.RustBuffer as RustBufferCollectStrategy +import uniffi.matrix_sdk_crypto.RustBuffer as RustBufferIdentityState +import uniffi.matrix_sdk_crypto.RustBuffer as RustBufferTrustRequirement import uniffi.matrix_sdk_crypto.RustBuffer as RustBufferUtdCause import uniffi.matrix_sdk_ui.RustBuffer as RustBufferEventItemOrigin import uniffi.matrix_sdk_ui.RustBuffer as RustBufferLiveBackPaginationStatus @@ -693,6 +699,9 @@ internal interface UniffiCallbackInterfaceClientSessionDelegateMethod1 : com.sun internal interface UniffiCallbackInterfaceEnableRecoveryProgressListenerMethod0 : com.sun.jna.Callback { fun callback(`uniffiHandle`: Long,`status`: RustBuffer.ByValue,`uniffiOutReturn`: Pointer,uniffiCallStatus: UniffiRustCallStatus,) } +internal interface UniffiCallbackInterfaceIdentityStatusChangeListenerMethod0 : com.sun.jna.Callback { + fun callback(`uniffiHandle`: Long,`identityStatusChange`: RustBuffer.ByValue,`uniffiOutReturn`: Pointer,uniffiCallStatus: UniffiRustCallStatus,) +} internal interface UniffiCallbackInterfaceIgnoredUsersListenerMethod0 : com.sun.jna.Callback { fun callback(`uniffiHandle`: Long,`ignoredUserIds`: RustBuffer.ByValue,`uniffiOutReturn`: Pointer,uniffiCallStatus: UniffiRustCallStatus,) } @@ -853,6 +862,22 @@ internal open class UniffiVTableCallbackInterfaceEnableRecoveryProgressListener( `uniffiFree` = other.`uniffiFree` } +} +@Structure.FieldOrder("call", "uniffiFree") +internal open class UniffiVTableCallbackInterfaceIdentityStatusChangeListener( + @JvmField internal var `call`: UniffiCallbackInterfaceIdentityStatusChangeListenerMethod0? = null, + @JvmField internal var `uniffiFree`: UniffiCallbackInterfaceFree? = null, +) : Structure() { + class UniffiByValue( + `call`: UniffiCallbackInterfaceIdentityStatusChangeListenerMethod0? = null, + `uniffiFree`: UniffiCallbackInterfaceFree? = null, + ): UniffiVTableCallbackInterfaceIdentityStatusChangeListener(`call`,`uniffiFree`,), Structure.ByValue + + internal fun uniffiSetValue(other: UniffiVTableCallbackInterfaceIdentityStatusChangeListener) { + `call` = other.`call` + `uniffiFree` = other.`uniffiFree` + } + } @Structure.FieldOrder("call", "uniffiFree") internal open class UniffiVTableCallbackInterfaceIgnoredUsersListener( @@ -2089,6 +2114,14 @@ internal open class UniffiVTableCallbackInterfaceWidgetCapabilitiesProvider( + + + + + + + + @@ -2113,6 +2146,7 @@ internal interface UniffiLib : Library { uniffiCallbackInterfaceClientDelegate.register(lib) uniffiCallbackInterfaceClientSessionDelegate.register(lib) uniffiCallbackInterfaceEnableRecoveryProgressListener.register(lib) + uniffiCallbackInterfaceIdentityStatusChangeListener.register(lib) uniffiCallbackInterfaceIgnoredUsersListener.register(lib) uniffiCallbackInterfaceNotificationSettingsDelegate.register(lib) uniffiCallbackInterfacePaginationStatusListener.register(lib) @@ -2180,6 +2214,8 @@ internal interface UniffiLib : Library { ): Byte fun uniffi_matrix_sdk_ffi_fn_method_client_create_room(`ptr`: Pointer,`request`: RustBuffer.ByValue, ): Long + fun uniffi_matrix_sdk_ffi_fn_method_client_custom_login_with_jwt(`ptr`: Pointer,`jwt`: RustBuffer.ByValue,`initialDeviceName`: RustBuffer.ByValue,`deviceId`: RustBuffer.ByValue, + ): Long fun uniffi_matrix_sdk_ffi_fn_method_client_deactivate_account(`ptr`: Pointer,`authData`: RustBuffer.ByValue,`eraseData`: Byte, ): Long fun uniffi_matrix_sdk_ffi_fn_method_client_delete_pusher(`ptr`: Pointer,`identifiers`: RustBuffer.ByValue, @@ -2320,6 +2356,8 @@ internal interface UniffiLib : Library { ): Pointer fun uniffi_matrix_sdk_ffi_fn_method_clientbuilder_request_config(`ptr`: Pointer,`config`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): Pointer + fun uniffi_matrix_sdk_ffi_fn_method_clientbuilder_room_decryption_trust_requirement(`ptr`: Pointer,`trustRequirement`: RustBufferTrustRequirement.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): Pointer fun uniffi_matrix_sdk_ffi_fn_method_clientbuilder_room_key_recipient_strategy(`ptr`: Pointer,`strategy`: RustBufferCollectStrategy.ByValue,uniffi_out_err: UniffiRustCallStatus, ): Pointer fun uniffi_matrix_sdk_ffi_fn_method_clientbuilder_server_name(`ptr`: Pointer,`serverName`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, @@ -2620,6 +2658,8 @@ internal interface UniffiLib : Library { ): Long fun uniffi_matrix_sdk_ffi_fn_method_room_set_unread_flag(`ptr`: Pointer,`newValue`: Byte, ): Long + fun uniffi_matrix_sdk_ffi_fn_method_room_subscribe_to_identity_status_changes(`ptr`: Pointer,`listener`: Long,uniffi_out_err: UniffiRustCallStatus, + ): Pointer fun uniffi_matrix_sdk_ffi_fn_method_room_subscribe_to_room_info_updates(`ptr`: Pointer,`listener`: Long,uniffi_out_err: UniffiRustCallStatus, ): Pointer fun uniffi_matrix_sdk_ffi_fn_method_room_subscribe_to_typing_notifications(`ptr`: Pointer,`listener`: Long,uniffi_out_err: UniffiRustCallStatus, @@ -2982,6 +3022,8 @@ internal interface UniffiLib : Library { ): Unit fun uniffi_matrix_sdk_ffi_fn_init_callback_vtable_enablerecoveryprogresslistener(`vtable`: UniffiVTableCallbackInterfaceEnableRecoveryProgressListener, ): Unit + fun uniffi_matrix_sdk_ffi_fn_init_callback_vtable_identitystatuschangelistener(`vtable`: UniffiVTableCallbackInterfaceIdentityStatusChangeListener, + ): Unit fun uniffi_matrix_sdk_ffi_fn_init_callback_vtable_ignoreduserslistener(`vtable`: UniffiVTableCallbackInterfaceIgnoredUsersListener, ): Unit fun uniffi_matrix_sdk_ffi_fn_init_callback_vtable_notificationsettingsdelegate(`vtable`: UniffiVTableCallbackInterfaceNotificationSettingsDelegate, @@ -3242,6 +3284,8 @@ internal interface UniffiLib : Library { ): Short fun uniffi_matrix_sdk_ffi_checksum_method_client_create_room( ): Short + fun uniffi_matrix_sdk_ffi_checksum_method_client_custom_login_with_jwt( + ): Short fun uniffi_matrix_sdk_ffi_checksum_method_client_deactivate_account( ): Short fun uniffi_matrix_sdk_ffi_checksum_method_client_delete_pusher( @@ -3376,6 +3420,8 @@ internal interface UniffiLib : Library { ): Short fun uniffi_matrix_sdk_ffi_checksum_method_clientbuilder_request_config( ): Short + fun uniffi_matrix_sdk_ffi_checksum_method_clientbuilder_room_decryption_trust_requirement( + ): Short fun uniffi_matrix_sdk_ffi_checksum_method_clientbuilder_room_key_recipient_strategy( ): Short fun uniffi_matrix_sdk_ffi_checksum_method_clientbuilder_server_name( @@ -3630,6 +3676,8 @@ internal interface UniffiLib : Library { ): Short fun uniffi_matrix_sdk_ffi_checksum_method_room_set_unread_flag( ): Short + fun uniffi_matrix_sdk_ffi_checksum_method_room_subscribe_to_identity_status_changes( + ): Short fun uniffi_matrix_sdk_ffi_checksum_method_room_subscribe_to_room_info_updates( ): Short fun uniffi_matrix_sdk_ffi_checksum_method_room_subscribe_to_typing_notifications( @@ -3906,6 +3954,8 @@ internal interface UniffiLib : Library { ): Short fun uniffi_matrix_sdk_ffi_checksum_method_enablerecoveryprogresslistener_on_update( ): Short + fun uniffi_matrix_sdk_ffi_checksum_method_identitystatuschangelistener_call( + ): Short fun uniffi_matrix_sdk_ffi_checksum_method_ignoreduserslistener_call( ): Short fun uniffi_matrix_sdk_ffi_checksum_method_notificationsettingsdelegate_settings_did_change( @@ -4072,6 +4122,9 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) { if (lib.uniffi_matrix_sdk_ffi_checksum_method_client_create_room() != 52700.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } + if (lib.uniffi_matrix_sdk_ffi_checksum_method_client_custom_login_with_jwt() != 19710.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } if (lib.uniffi_matrix_sdk_ffi_checksum_method_client_deactivate_account() != 20658.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } @@ -4273,6 +4326,9 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) { if (lib.uniffi_matrix_sdk_ffi_checksum_method_clientbuilder_request_config() != 58783.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } + if (lib.uniffi_matrix_sdk_ffi_checksum_method_clientbuilder_room_decryption_trust_requirement() != 2776.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } if (lib.uniffi_matrix_sdk_ffi_checksum_method_clientbuilder_room_key_recipient_strategy() != 41183.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } @@ -4654,6 +4710,9 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) { if (lib.uniffi_matrix_sdk_ffi_checksum_method_room_set_unread_flag() != 2381.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } + if (lib.uniffi_matrix_sdk_ffi_checksum_method_room_subscribe_to_identity_status_changes() != 14290.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } if (lib.uniffi_matrix_sdk_ffi_checksum_method_room_subscribe_to_room_info_updates() != 48209.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } @@ -5068,6 +5127,9 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) { if (lib.uniffi_matrix_sdk_ffi_checksum_method_enablerecoveryprogresslistener_on_update() != 13538.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } + if (lib.uniffi_matrix_sdk_ffi_checksum_method_identitystatuschangelistener_call() != 57311.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } if (lib.uniffi_matrix_sdk_ffi_checksum_method_ignoreduserslistener_call() != 47519.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } @@ -5706,6 +5768,13 @@ public interface ClientInterface { suspend fun `createRoom`(`request`: CreateRoomParameters): kotlin.String + /** + * Login using JWT + * This is an implementation of the custom_login https://docs.rs/matrix-sdk/latest/matrix_sdk/matrix_auth/struct.MatrixAuth.html#method.login_custom + * For more information on logging in with JWT: https://element-hq.github.io/synapse/latest/jwt.html + */ + suspend fun `customLoginWithJwt`(`jwt`: kotlin.String, `initialDeviceName`: kotlin.String?, `deviceId`: kotlin.String?) + /** * Deactivate this account definitively. * Similarly to `encryption::reset_identity` this @@ -6235,6 +6304,33 @@ open class Client: Disposable, AutoCloseable, ClientInterface { } + /** + * Login using JWT + * This is an implementation of the custom_login https://docs.rs/matrix-sdk/latest/matrix_sdk/matrix_auth/struct.MatrixAuth.html#method.login_custom + * For more information on logging in with JWT: https://element-hq.github.io/synapse/latest/jwt.html + */ + @Throws(ClientException::class) + @Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE") + override suspend fun `customLoginWithJwt`(`jwt`: kotlin.String, `initialDeviceName`: kotlin.String?, `deviceId`: kotlin.String?) { + return uniffiRustCallAsync( + callWithPointer { thisPtr -> + UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_method_client_custom_login_with_jwt( + thisPtr, + FfiConverterString.lower(`jwt`),FfiConverterOptionalString.lower(`initialDeviceName`),FfiConverterOptionalString.lower(`deviceId`), + ) + }, + { future, callback, continuation -> UniffiLib.INSTANCE.ffi_matrix_sdk_ffi_rust_future_poll_void(future, callback, continuation) }, + { future, continuation -> UniffiLib.INSTANCE.ffi_matrix_sdk_ffi_rust_future_complete_void(future, continuation) }, + { future -> UniffiLib.INSTANCE.ffi_matrix_sdk_ffi_rust_future_free_void(future) }, + // lift function + { Unit }, + + // Error FFI converter + ClientException.ErrorHandler, + ) + } + + /** * Deactivate this account definitively. * Similarly to `encryption::reset_identity` this @@ -7545,6 +7641,11 @@ public interface ClientBuilderInterface { */ fun `requestConfig`(`config`: RequestConfig): ClientBuilder + /** + * Set the trust requirement to be used when decrypting events. + */ + fun `roomDecryptionTrustRequirement`(`trustRequirement`: TrustRequirement): ClientBuilder + /** * Set the strategy to be used for picking recipient devices when sending * an encrypted message. @@ -7882,6 +7983,21 @@ open class ClientBuilder: Disposable, AutoCloseable, ClientBuilderInterface { + /** + * Set the trust requirement to be used when decrypting events. + */override fun `roomDecryptionTrustRequirement`(`trustRequirement`: TrustRequirement): ClientBuilder { + return FfiConverterTypeClientBuilder.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_method_clientbuilder_room_decryption_trust_requirement( + it, FfiConverterTypeTrustRequirement.lower(`trustRequirement`),_status) +} + } + ) + } + + + /** * Set the strategy to be used for picking recipient devices when sending * an encrypted message. @@ -12263,6 +12379,8 @@ public interface RoomInterface { */ suspend fun `setUnreadFlag`(`newValue`: kotlin.Boolean) + fun `subscribeToIdentityStatusChanges`(`listener`: IdentityStatusChangeListener): TaskHandle + fun `subscribeToRoomInfoUpdates`(`listener`: RoomInfoListener): TaskHandle fun `subscribeToTypingNotifications`(`listener`: TypingNotificationsListener): TaskHandle @@ -13792,6 +13910,18 @@ open class Room: Disposable, AutoCloseable, RoomInterface { ) } + override fun `subscribeToIdentityStatusChanges`(`listener`: IdentityStatusChangeListener): TaskHandle { + return FfiConverterTypeTaskHandle.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_method_room_subscribe_to_identity_status_changes( + it, FfiConverterTypeIdentityStatusChangeListener.lower(`listener`),_status) +} + } + ) + } + + override fun `subscribeToRoomInfoUpdates`(`listener`: RoomInfoListener): TaskHandle { return FfiConverterTypeTaskHandle.lift( callWithPointer { @@ -22713,6 +22843,41 @@ public object FfiConverterTypeHttpPusherData: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer): IdentityStatusChange { + return IdentityStatusChange( + FfiConverterString.read(buf), + FfiConverterTypeIdentityState.read(buf), + ) + } + + override fun allocationSize(value: IdentityStatusChange) = ( + FfiConverterString.allocationSize(value.`userId`) + + FfiConverterTypeIdentityState.allocationSize(value.`changedTo`) + ) + + override fun write(value: IdentityStatusChange, buf: ByteBuffer) { + FfiConverterString.write(value.`userId`, buf) + FfiConverterTypeIdentityState.write(value.`changedTo`, buf) + } +} + + + data class ImageInfo ( var `height`: kotlin.ULong?, var `width`: kotlin.ULong?, @@ -33005,6 +33170,55 @@ public object FfiConverterTypeEnableRecoveryProgressListener: FfiConverterCallba +public interface IdentityStatusChangeListener { + + fun `call`(`identityStatusChange`: List) + + companion object +} + + + +// Put the implementation in an object so we don't pollute the top-level namespace +internal object uniffiCallbackInterfaceIdentityStatusChangeListener { + internal object `call`: UniffiCallbackInterfaceIdentityStatusChangeListenerMethod0 { + override fun callback(`uniffiHandle`: Long,`identityStatusChange`: RustBuffer.ByValue,`uniffiOutReturn`: Pointer,uniffiCallStatus: UniffiRustCallStatus,) { + val uniffiObj = FfiConverterTypeIdentityStatusChangeListener.handleMap.get(uniffiHandle) + val makeCall = { -> + uniffiObj.`call`( + FfiConverterSequenceTypeIdentityStatusChange.lift(`identityStatusChange`), + ) + } + val writeReturn = { _: Unit -> Unit } + uniffiTraitInterfaceCall(uniffiCallStatus, makeCall, writeReturn) + } + } + + internal object uniffiFree: UniffiCallbackInterfaceFree { + override fun callback(handle: Long) { + FfiConverterTypeIdentityStatusChangeListener.handleMap.remove(handle) + } + } + + internal var vtable = UniffiVTableCallbackInterfaceIdentityStatusChangeListener.UniffiByValue( + `call`, + uniffiFree, + ) + + // Registers the foreign callback with the Rust side. + // This method is generated for each callback interface. + internal fun register(lib: UniffiLib) { + lib.uniffi_matrix_sdk_ffi_fn_init_callback_vtable_identitystatuschangelistener(vtable) + } +} + +// The ffiConverter which transforms the Callbacks in to handles to pass to Rust. +public object FfiConverterTypeIdentityStatusChangeListener: FfiConverterCallbackInterface() + + + + + public interface IgnoredUsersListener { fun `call`(`ignoredUserIds`: List) @@ -35946,6 +36160,31 @@ public object FfiConverterSequenceTypeTimelineItem: FfiConverterRustBuffer> { + override fun read(buf: ByteBuffer): List { + val len = buf.getInt() + return List(len) { + FfiConverterTypeIdentityStatusChange.read(buf) + } + } + + override fun allocationSize(value: List): ULong { + val sizeForLength = 4UL + val sizeForItems = value.map { FfiConverterTypeIdentityStatusChange.allocationSize(it) }.sum() + return sizeForLength + sizeForItems + } + + override fun write(value: List, buf: ByteBuffer) { + buf.putInt(value.size) + value.iterator().forEach { + FfiConverterTypeIdentityStatusChange.write(it, buf) + } + } +} + + + + public object FfiConverterSequenceTypePollAnswer: FfiConverterRustBuffer> { override fun read(buf: ByteBuffer): List { val len = buf.getInt() @@ -36531,6 +36770,14 @@ public object FfiConverterMapStringSequenceString: FfiConverterRustBuffer { +/** + * Settings for decrypting messages + */ +data class DecryptionSettings ( + /** + * The trust level in the sender's device that is required to decrypt the + * event. If the sender's device is not sufficiently trusted, + * [`MegolmError::SenderIdentityNotTrusted`] will be returned. + */ + var `senderDeviceTrustRequirement`: TrustRequirement +) { + + companion object +} + +public object FfiConverterTypeDecryptionSettings: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer): DecryptionSettings { + return DecryptionSettings( + FfiConverterTypeTrustRequirement.read(buf), + ) + } + + override fun allocationSize(value: DecryptionSettings) = ( + FfiConverterTypeTrustRequirement.allocationSize(value.`senderDeviceTrustRequirement`) + ) + + override fun write(value: DecryptionSettings, buf: ByteBuffer) { + FfiConverterTypeTrustRequirement.write(value.`senderDeviceTrustRequirement`, buf) + } +} + + + /** * Strategy to collect the devices that should receive room keys for the * current discussion. @@ -1050,6 +1083,59 @@ public object FfiConverterTypeCollectStrategy : FfiConverterRustBuffer { + override fun read(buf: ByteBuffer) = try { + IdentityState.values()[buf.getInt() - 1] + } catch (e: IndexOutOfBoundsException) { + throw RuntimeException("invalid enum value, something is very wrong!!", e) + } + + override fun allocationSize(value: IdentityState) = 4UL + + override fun write(value: IdentityState, buf: ByteBuffer) { + buf.putInt(value.ordinal + 1) + } +} + + + + + /** * The local trust state of a device. */ @@ -1247,6 +1333,48 @@ public object FfiConverterTypeSignatureState: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer) = try { + TrustRequirement.values()[buf.getInt() - 1] + } catch (e: IndexOutOfBoundsException) { + throw RuntimeException("invalid enum value, something is very wrong!!", e) + } + + override fun allocationSize(value: TrustRequirement) = 4UL + + override fun write(value: TrustRequirement, buf: ByteBuffer) { + buf.putInt(value.ordinal + 1) + } +} + + + + + /** * Our best guess at the reason why an event can't be decrypted. */