Skip to content

fix(kotlin)!: migrate timestamps to kotlin.time.Instant - #2556

Open
Garzas wants to merge 1 commit into
release/10.xfrom
kubaz/chore/update-kotlinx-datetime
Open

fix(kotlin)!: migrate timestamps to kotlin.time.Instant#2556
Garzas wants to merge 1 commit into
release/10.xfrom
kubaz/chore/update-kotlinx-datetime

Conversation

@Garzas

@Garzas Garzas commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Core Crypto's Kotlin bindings still use kotlinx-datetime 0.6.1 and expose kotlinx.datetime.Instant. This keeps consumers such as Kalium dependent on the 0.6.x compatibility artifact when moving to kotlinx-datetime 0.7.1.

Update kotlinx-datetime to 0.7.1 and migrate the UniFFI timestamp mappings to kotlin.time.Instant and the standard library's Java conversion functions. Add a JVM regression test that verifies the generated Timestamp type accepts kotlin.time.Instant and preserves nanosecond precision through FFI serialization.

Breaking API change: the generated JVM and Android Timestamp alias now resolves to kotlin.time.Instant. This affects certificate validity fields such as notBefore and notAfter. Consumers must rebuild and migrate any uses of kotlinx.datetime.Instant at this boundary.

Validation: generated JVM and Android bindings successfully, passed all 62 JVM tests, and compiled Android Kotlin sources. Full Android packaging and runtime validation remain unverified because native Android .so libraries were unavailable; the native-library preparation step was skipped for the Kotlin compilation check.

@Garzas
Garzas requested a review from a team September 9, 2026 09:20
import kotlin.test.assertEquals
import kotlin.time.Instant

class TimestampTest {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this live in shared/src/commonTest instead?

@istankovic

Copy link
Copy Markdown
Member

@Garzas what do you mean by this?

the native-library preparation step was skipped for the Kotlin compilation check.


class TimestampTest {
@Test
fun timestampPreservesNanosecondsAcrossFfiConversion() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of this test?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants