@@ -22,6 +22,7 @@ import com.sun.jna.IntegerType
22
22
import com.sun.jna.Native
23
23
import com.sun.jna.Pointer
24
24
import com.sun.jna.Structure
25
+ import com.sun.jna.Callback
25
26
import com.sun.jna.ptr.*
26
27
import java.nio.ByteBuffer
27
28
import java.nio.ByteOrder
@@ -106,7 +107,6 @@ class RustBufferByReference : ByReference(16) {
106
107
open class ForeignBytes : Structure () {
107
108
@JvmField
108
109
var len: Int = 0
109
-
110
110
@JvmField
111
111
var data: Pointer ? = null
112
112
@@ -192,7 +192,6 @@ public interface FfiConverterRustBuffer<KotlinType> : FfiConverter<KotlinType, R
192
192
internal open class RustCallStatus : Structure () {
193
193
@JvmField
194
194
var code: Byte = 0
195
-
196
195
@JvmField
197
196
var error_buf: RustBuffer .ByValue = RustBuffer .ByValue ()
198
197
@@ -387,14 +386,14 @@ internal interface _UniFFILib : Library {
387
386
_uniffi_out_err : RustCallStatus ,
388
387
): RustBuffer .ByValue
389
388
390
- fun uniffi_xmtp_dh_fn_func_ecies_encrypt_k256_sha3_256 (
389
+ fun uniffi_xmtp_dh_fn_func_user_preferences_encrypt (
391
390
`publicKeyBytes`: RustBuffer .ByValue ,
392
391
`privateKeyBytes`: RustBuffer .ByValue ,
393
392
`messageBytes`: RustBuffer .ByValue ,
394
393
_uniffi_out_err : RustCallStatus ,
395
394
): RustBuffer .ByValue
396
395
397
- fun uniffi_xmtp_dh_fn_func_ecies_decrypt_k256_sha3_256 (
396
+ fun uniffi_xmtp_dh_fn_func_user_preferences_decrypt (
398
397
`publicKeyBytes`: RustBuffer .ByValue ,
399
398
`privateKeyBytes`: RustBuffer .ByValue ,
400
399
`messageBytes`: RustBuffer .ByValue ,
@@ -432,10 +431,10 @@ internal interface _UniFFILib : Library {
432
431
fun uniffi_xmtp_dh_checksum_func_diffie_hellman_k256 (
433
432
): Short
434
433
435
- fun uniffi_xmtp_dh_checksum_func_ecies_encrypt_k256_sha3_256 (
434
+ fun uniffi_xmtp_dh_checksum_func_user_preferences_encrypt (
436
435
): Short
437
436
438
- fun uniffi_xmtp_dh_checksum_func_ecies_decrypt_k256_sha3_256 (
437
+ fun uniffi_xmtp_dh_checksum_func_user_preferences_decrypt (
439
438
): Short
440
439
441
440
fun uniffi_xmtp_dh_checksum_func_generate_private_preferences_topic_identifier (
@@ -464,13 +463,13 @@ private fun uniffiCheckApiChecksums(lib: _UniFFILib) {
464
463
if (lib.uniffi_xmtp_dh_checksum_func_diffie_hellman_k256() != 64890 .toShort()) {
465
464
throw RuntimeException (" UniFFI API checksum mismatch: try cleaning and rebuilding your project" )
466
465
}
467
- if (lib.uniffi_xmtp_dh_checksum_func_ecies_encrypt_k256_sha3_256 () != 28010 .toShort()) {
466
+ if (lib.uniffi_xmtp_dh_checksum_func_user_preferences_encrypt () != 59502 .toShort()) {
468
467
throw RuntimeException (" UniFFI API checksum mismatch: try cleaning and rebuilding your project" )
469
468
}
470
- if (lib.uniffi_xmtp_dh_checksum_func_ecies_decrypt_k256_sha3_256 () != 45037 .toShort()) {
469
+ if (lib.uniffi_xmtp_dh_checksum_func_user_preferences_decrypt () != 60388 .toShort()) {
471
470
throw RuntimeException (" UniFFI API checksum mismatch: try cleaning and rebuilding your project" )
472
471
}
473
- if (lib.uniffi_xmtp_dh_checksum_func_generate_private_preferences_topic_identifier() != 65141 .toShort()) {
472
+ if (lib.uniffi_xmtp_dh_checksum_func_generate_private_preferences_topic_identifier() != 48427 .toShort()) {
474
473
throw RuntimeException (" UniFFI API checksum mismatch: try cleaning and rebuilding your project" )
475
474
}
476
475
if (lib.uniffi_xmtp_dh_checksum_func_verify_k256_sha256() != 45969 .toShort()) {
@@ -606,35 +605,36 @@ public object FfiConverterTypeDiffieHellmanError : FfiConverterRustBuffer<Diffie
606
605
}
607
606
608
607
609
- sealed class EciesException (message : String ) : Exception(message) {
608
+ sealed class UserPreferencesException (message : String ) : Exception(message) {
610
609
// Each variant is a nested class
611
610
// Flat enums carries a string error message, so no special implementation is necessary.
612
- class GenericException (message : String ) : EciesException (message)
611
+ class GenericException (message : String ) : UserPreferencesException (message)
613
612
614
613
615
- companion object ErrorHandler : CallStatusErrorHandler<EciesException > {
616
- override fun lift (error_buf : RustBuffer .ByValue ): EciesException =
617
- FfiConverterTypeEciesError .lift(error_buf)
614
+ companion object ErrorHandler : CallStatusErrorHandler<UserPreferencesException > {
615
+ override fun lift (error_buf : RustBuffer .ByValue ): UserPreferencesException =
616
+ FfiConverterTypeUserPreferencesError .lift(error_buf)
618
617
}
619
618
}
620
619
621
- public object FfiConverterTypeEciesError : FfiConverterRustBuffer<EciesException> {
622
- override fun read (buf : ByteBuffer ): EciesException {
620
+ public object FfiConverterTypeUserPreferencesError :
621
+ FfiConverterRustBuffer <UserPreferencesException > {
622
+ override fun read (buf : ByteBuffer ): UserPreferencesException {
623
623
624
624
return when (buf.getInt()) {
625
- 1 -> EciesException .GenericException (FfiConverterString .read(buf))
625
+ 1 -> UserPreferencesException .GenericException (FfiConverterString .read(buf))
626
626
else -> throw RuntimeException (" invalid error enum value, something is very wrong!!" )
627
627
}
628
628
629
629
}
630
630
631
- override fun allocationSize (value : EciesException ): Int {
631
+ override fun allocationSize (value : UserPreferencesException ): Int {
632
632
return 4
633
633
}
634
634
635
- override fun write (value : EciesException , buf : ByteBuffer ) {
635
+ override fun write (value : UserPreferencesException , buf : ByteBuffer ) {
636
636
when (value) {
637
- is EciesException .GenericException -> {
637
+ is UserPreferencesException .GenericException -> {
638
638
buf.putInt(1 )
639
639
Unit
640
640
}
@@ -720,16 +720,16 @@ fun `diffieHellmanK256`(
720
720
})
721
721
}
722
722
723
- @Throws(EciesException ::class )
723
+ @Throws(UserPreferencesException ::class )
724
724
725
- fun `eciesEncryptK256Sha3256 ` (
725
+ fun `userPreferencesEncrypt ` (
726
726
`publicKeyBytes`: List <UByte >,
727
727
`privateKeyBytes`: List <UByte >,
728
728
`messageBytes`: List <UByte >,
729
729
): List <UByte > {
730
730
return FfiConverterSequenceUByte .lift(
731
- rustCallWithError(EciesException ) { _status ->
732
- _UniFFILib .INSTANCE .uniffi_xmtp_dh_fn_func_ecies_encrypt_k256_sha3_256 (
731
+ rustCallWithError(UserPreferencesException ) { _status ->
732
+ _UniFFILib .INSTANCE .uniffi_xmtp_dh_fn_func_user_preferences_encrypt (
733
733
FfiConverterSequenceUByte .lower(`publicKeyBytes`),
734
734
FfiConverterSequenceUByte .lower(`privateKeyBytes`),
735
735
FfiConverterSequenceUByte .lower(`messageBytes`),
@@ -738,16 +738,16 @@ fun `eciesEncryptK256Sha3256`(
738
738
})
739
739
}
740
740
741
- @Throws(EciesException ::class )
741
+ @Throws(UserPreferencesException ::class )
742
742
743
- fun `eciesDecryptK256Sha3256 ` (
743
+ fun `userPreferencesDecrypt ` (
744
744
`publicKeyBytes`: List <UByte >,
745
745
`privateKeyBytes`: List <UByte >,
746
746
`messageBytes`: List <UByte >,
747
747
): List <UByte > {
748
748
return FfiConverterSequenceUByte .lift(
749
- rustCallWithError(EciesException ) { _status ->
750
- _UniFFILib .INSTANCE .uniffi_xmtp_dh_fn_func_ecies_decrypt_k256_sha3_256 (
749
+ rustCallWithError(UserPreferencesException ) { _status ->
750
+ _UniFFILib .INSTANCE .uniffi_xmtp_dh_fn_func_user_preferences_decrypt (
751
751
FfiConverterSequenceUByte .lower(`publicKeyBytes`),
752
752
FfiConverterSequenceUByte .lower(`privateKeyBytes`),
753
753
FfiConverterSequenceUByte .lower(`messageBytes`),
@@ -756,11 +756,11 @@ fun `eciesDecryptK256Sha3256`(
756
756
})
757
757
}
758
758
759
- @Throws(EciesException ::class )
759
+ @Throws(UserPreferencesException ::class )
760
760
761
761
fun `generatePrivatePreferencesTopicIdentifier` (`privateKeyBytes`: List <UByte >): String {
762
762
return FfiConverterString .lift(
763
- rustCallWithError(EciesException ) { _status ->
763
+ rustCallWithError(UserPreferencesException ) { _status ->
764
764
_UniFFILib .INSTANCE .uniffi_xmtp_dh_fn_func_generate_private_preferences_topic_identifier(
765
765
FfiConverterSequenceUByte .lower(`privateKeyBytes`),
766
766
_status
0 commit comments