Skip to content

Commit 6b3d967

Browse files
authored
update to libxmtp 1.5.0 (#474)
Co-authored-by: cameronvoell <[email protected]>
1 parent b2386d4 commit 6b3d967

File tree

7 files changed

+206
-11
lines changed

7 files changed

+206
-11
lines changed

.github/workflows/release.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,20 @@ jobs:
2222
uses: gradle/actions/setup-gradle@v3
2323
- name: Run build with Gradle Wrapper
2424
run: ./gradlew build
25-
- name: Tag version 4.4.0
25+
- name: Tag version 4.5.0-rc1
2626
run: |
27-
git tag 4.4.0
28-
git push origin 4.4.0
29-
- name: Create a GitHub release for version 4.4.0
27+
git tag 4.5.0-rc1
28+
git push origin 4.5.0-rc1
29+
- name: Create a GitHub release for version 4.5.0-rc1
3030
uses: ncipollo/release-action@v1
3131
with:
32-
tag: "4.4.0"
33-
name: "v4.4.0"
32+
tag: "4.5.0-rc1"
33+
name: "v4.5.0-rc1"
3434
body: " "
3535

3636
- name: Gradle Publish
3737
env:
38-
RELEASE_VERSION: "4.4.0"
38+
RELEASE_VERSION: "4.5.0-rc1"
3939
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
4040
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
4141
SIGN_KEY: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
Version: 891411c0
2-
Branch: 09-02-unify_sort_and_filtering_for_conversations.list_
3-
Date: 2025-09-02 23:23:39 +0000
1+
Version: e5c3c7510
2+
Branch: release/v1.5
3+
Date: 2025-09-19 19:17:34 +0000

library/src/main/java/xmtpv3.kt

Lines changed: 196 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1256,6 +1256,14 @@ internal open class UniffiVTableCallbackInterfaceFfiPreferenceCallback(
12561256

12571257

12581258

1259+
1260+
1261+
1262+
1263+
1264+
1265+
1266+
12591267

12601268

12611269

@@ -1318,6 +1326,14 @@ fun uniffi_xmtpv3_checksum_func_enter_debug_writer(
13181326
): Short
13191327
fun uniffi_xmtpv3_checksum_func_enter_debug_writer_with_level(
13201328
): Short
1329+
fun uniffi_xmtpv3_checksum_func_ethereum_address_from_pubkey(
1330+
): Short
1331+
fun uniffi_xmtpv3_checksum_func_ethereum_generate_public_key(
1332+
): Short
1333+
fun uniffi_xmtpv3_checksum_func_ethereum_hash_personal(
1334+
): Short
1335+
fun uniffi_xmtpv3_checksum_func_ethereum_sign_recoverable(
1336+
): Short
13211337
fun uniffi_xmtpv3_checksum_func_exit_debug_writer(
13221338
): Short
13231339
fun uniffi_xmtpv3_checksum_func_generate_inbox_id(
@@ -2114,6 +2130,14 @@ fun uniffi_xmtpv3_fn_func_enter_debug_writer(`directory`: RustBuffer.ByValue,`lo
21142130
): Unit
21152131
fun uniffi_xmtpv3_fn_func_enter_debug_writer_with_level(`directory`: RustBuffer.ByValue,`rotation`: RustBuffer.ByValue,`maxFiles`: Int,`logLevel`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
21162132
): Unit
2133+
fun uniffi_xmtpv3_fn_func_ethereum_address_from_pubkey(`pubkey`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
2134+
): RustBuffer.ByValue
2135+
fun uniffi_xmtpv3_fn_func_ethereum_generate_public_key(`privateKey32`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
2136+
): RustBuffer.ByValue
2137+
fun uniffi_xmtpv3_fn_func_ethereum_hash_personal(`message`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
2138+
): RustBuffer.ByValue
2139+
fun uniffi_xmtpv3_fn_func_ethereum_sign_recoverable(`msg`: RustBuffer.ByValue,`privateKey32`: RustBuffer.ByValue,`hashing`: Byte,uniffi_out_err: UniffiRustCallStatus,
2140+
): RustBuffer.ByValue
21172141
fun uniffi_xmtpv3_fn_func_exit_debug_writer(uniffi_out_err: UniffiRustCallStatus,
21182142
): Unit
21192143
fun uniffi_xmtpv3_fn_func_generate_inbox_id(`accountIdentifier`: RustBuffer.ByValue,`nonce`: Long,uniffi_out_err: UniffiRustCallStatus,
@@ -2311,6 +2335,18 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) {
23112335
if (lib.uniffi_xmtpv3_checksum_func_enter_debug_writer_with_level() != 7232.toShort()) {
23122336
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
23132337
}
2338+
if (lib.uniffi_xmtpv3_checksum_func_ethereum_address_from_pubkey() != 12568.toShort()) {
2339+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
2340+
}
2341+
if (lib.uniffi_xmtpv3_checksum_func_ethereum_generate_public_key() != 36134.toShort()) {
2342+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
2343+
}
2344+
if (lib.uniffi_xmtpv3_checksum_func_ethereum_hash_personal() != 43764.toShort()) {
2345+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
2346+
}
2347+
if (lib.uniffi_xmtpv3_checksum_func_ethereum_sign_recoverable() != 58098.toShort()) {
2348+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
2349+
}
23142350
if (lib.uniffi_xmtpv3_checksum_func_exit_debug_writer() != 31716.toShort()) {
23152351
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
23162352
}
@@ -12011,7 +12047,8 @@ enum class FfiConversationType {
1201112047

1201212048
GROUP,
1201312049
DM,
12014-
SYNC;
12050+
SYNC,
12051+
ONESHOT;
1201512052
companion object
1201612053
}
1201712054

@@ -12037,6 +12074,104 @@ public object FfiConverterTypeFfiConversationType: FfiConverterRustBuffer<FfiCon
1203712074

1203812075

1203912076

12077+
12078+
12079+
sealed class FfiCryptoException: kotlin.Exception() {
12080+
12081+
class InvalidLength(
12082+
) : FfiCryptoException() {
12083+
override val message
12084+
get() = ""
12085+
}
12086+
12087+
class InvalidKey(
12088+
) : FfiCryptoException() {
12089+
override val message
12090+
get() = ""
12091+
}
12092+
12093+
class SignFailure(
12094+
) : FfiCryptoException() {
12095+
override val message
12096+
get() = ""
12097+
}
12098+
12099+
class DecompressFailure(
12100+
) : FfiCryptoException() {
12101+
override val message
12102+
get() = ""
12103+
}
12104+
12105+
12106+
companion object ErrorHandler : UniffiRustCallStatusErrorHandler<FfiCryptoException> {
12107+
override fun lift(error_buf: RustBuffer.ByValue): FfiCryptoException = FfiConverterTypeFfiCryptoError.lift(error_buf)
12108+
}
12109+
12110+
12111+
}
12112+
12113+
/**
12114+
* @suppress
12115+
*/
12116+
public object FfiConverterTypeFfiCryptoError : FfiConverterRustBuffer<FfiCryptoException> {
12117+
override fun read(buf: ByteBuffer): FfiCryptoException {
12118+
12119+
12120+
return when(buf.getInt()) {
12121+
1 -> FfiCryptoException.InvalidLength()
12122+
2 -> FfiCryptoException.InvalidKey()
12123+
3 -> FfiCryptoException.SignFailure()
12124+
4 -> FfiCryptoException.DecompressFailure()
12125+
else -> throw RuntimeException("invalid error enum value, something is very wrong!!")
12126+
}
12127+
}
12128+
12129+
override fun allocationSize(value: FfiCryptoException): ULong {
12130+
return when(value) {
12131+
is FfiCryptoException.InvalidLength -> (
12132+
// Add the size for the Int that specifies the variant plus the size needed for all fields
12133+
4UL
12134+
)
12135+
is FfiCryptoException.InvalidKey -> (
12136+
// Add the size for the Int that specifies the variant plus the size needed for all fields
12137+
4UL
12138+
)
12139+
is FfiCryptoException.SignFailure -> (
12140+
// Add the size for the Int that specifies the variant plus the size needed for all fields
12141+
4UL
12142+
)
12143+
is FfiCryptoException.DecompressFailure -> (
12144+
// Add the size for the Int that specifies the variant plus the size needed for all fields
12145+
4UL
12146+
)
12147+
}
12148+
}
12149+
12150+
override fun write(value: FfiCryptoException, buf: ByteBuffer) {
12151+
when(value) {
12152+
is FfiCryptoException.InvalidLength -> {
12153+
buf.putInt(1)
12154+
Unit
12155+
}
12156+
is FfiCryptoException.InvalidKey -> {
12157+
buf.putInt(2)
12158+
Unit
12159+
}
12160+
is FfiCryptoException.SignFailure -> {
12161+
buf.putInt(3)
12162+
Unit
12163+
}
12164+
is FfiCryptoException.DecompressFailure -> {
12165+
buf.putInt(4)
12166+
Unit
12167+
}
12168+
}.let { /* this makes the `when` an expression, which ensures it is exhaustive */ }
12169+
}
12170+
12171+
}
12172+
12173+
12174+
1204012175
sealed class FfiDecodedMessageBody {
1204112176

1204212177
data class Text(
@@ -15496,6 +15631,66 @@ public object FfiConverterMapTypeFfiIdentifierBoolean: FfiConverterRustBuffer<Ma
1549615631

1549715632

1549815633

15634+
/**
15635+
* 3) Ethereum address from public key (accepts 65-byte 0x04||XY or 64-byte XY).
15636+
*/
15637+
@Throws(FfiCryptoException::class) fun `ethereumAddressFromPubkey`(`pubkey`: kotlin.ByteArray): kotlin.String {
15638+
return FfiConverterString.lift(
15639+
uniffiRustCallWithError(FfiCryptoException) { _status ->
15640+
UniffiLib.INSTANCE.uniffi_xmtpv3_fn_func_ethereum_address_from_pubkey(
15641+
FfiConverterByteArray.lower(`pubkey`),_status)
15642+
}
15643+
)
15644+
}
15645+
15646+
15647+
/**
15648+
* 1) Ethereum compatible public key from 32-byte private key.
15649+
* Returns **65-byte uncompressed** (0x04 || X || Y)
15650+
* Private key is automatically zeroized after use for security
15651+
*/
15652+
@Throws(FfiCryptoException::class) fun `ethereumGeneratePublicKey`(`privateKey32`: kotlin.ByteArray): kotlin.ByteArray {
15653+
return FfiConverterByteArray.lift(
15654+
uniffiRustCallWithError(FfiCryptoException) { _status ->
15655+
UniffiLib.INSTANCE.uniffi_xmtpv3_fn_func_ethereum_generate_public_key(
15656+
FfiConverterByteArray.lower(`privateKey32`),_status)
15657+
}
15658+
)
15659+
}
15660+
15661+
15662+
/**
15663+
* 4) EIP-191 personal message hash: keccak256("\x19Ethereum Signed Message:\n{len}" || message)
15664+
*/
15665+
@Throws(FfiCryptoException::class) fun `ethereumHashPersonal`(`message`: kotlin.String): kotlin.ByteArray {
15666+
return FfiConverterByteArray.lift(
15667+
uniffiRustCallWithError(FfiCryptoException) { _status ->
15668+
UniffiLib.INSTANCE.uniffi_xmtpv3_fn_func_ethereum_hash_personal(
15669+
FfiConverterString.lower(`message`),_status)
15670+
}
15671+
)
15672+
}
15673+
15674+
15675+
/**
15676+
* 2) Ethereum recoverable signature (FFI).
15677+
* Returns 65 bytes `r || s || v`, with **v ∈ {27,28}**
15678+
* (legacy/Electrum encoding where **v = 27 + parity**, parity ∈ {0,1}).
15679+
* - If `hashing == true`: signs per **EIP-191**
15680+
* ("Ethereum Signed Message:\n{len(msg)}" || msg, then keccak256).
15681+
* - If `hashing == false`: `msg` must be a **32-byte** prehash (e.g., keccak256/EIP-712 digest).
15682+
* - Private key is automatically zeroized after signing for security
15683+
*/
15684+
@Throws(FfiCryptoException::class) fun `ethereumSignRecoverable`(`msg`: kotlin.ByteArray, `privateKey32`: kotlin.ByteArray, `hashing`: kotlin.Boolean): kotlin.ByteArray {
15685+
return FfiConverterByteArray.lift(
15686+
uniffiRustCallWithError(FfiCryptoException) { _status ->
15687+
UniffiLib.INSTANCE.uniffi_xmtpv3_fn_func_ethereum_sign_recoverable(
15688+
FfiConverterByteArray.lower(`msg`),FfiConverterByteArray.lower(`privateKey32`),FfiConverterBoolean.lower(`hashing`),_status)
15689+
}
15690+
)
15691+
}
15692+
15693+
1549915694
/**
1550015695
* Flush loglines from libxmtp log writer to the file, ensuring logs are written.
1550115696
* This should be called before the program exits, to ensure all the logs in memory have been

0 commit comments

Comments
 (0)