Skip to content

fix(kmp): repair code/cash app compile broken by the KMP conversions - #1205

Merged
bmc08gt merged 2 commits into
code/cashfrom
fix/kmp-consumer-compile
Aug 7, 2026
Merged

fix(kmp): repair code/cash app compile broken by the KMP conversions#1205
bmc08gt merged 2 commits into
code/cashfrom
fix/kmp-consumer-compile

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

Repairs code/cash, which stopped compiling the app after the base58 (#1201) and sha256/sha512/hmac (#1202) KMP conversions. Those PRs were gated only on Kotlin commonTest, while assembleDebug was masked by the missing GoogleServices creds file — so Java/Kotlin consumer breaks slipped through (Kotlin objects/companions aren't Java-static without @JvmStatic; some fields became internal).

Three commits:

  1. fix(kmp): restore Java interop for sha256/sha512Sha256Hash.bytes made public (was internal, which broke Kotlin consumers such as persistence:sources reading .bytes); the now-redundant explicit getBytes() removed; @JvmStatic added to the Sha256Hash companion functions and to PBKDF2SHA512.derive for Java callers.
  2. ci: add cred-free compile-check job — runs :apps:flipcash:app:compileDebugSources (which precedes the creds-requiring processDebugGoogleServices step) so a future KMP change that breaks a downstream consumer fails CI instead of landing silently. This is the gate that would have caught feat(kmp): graduate shared-core to real KMP module — Base58 + randomBytes #1201/feat(kmp): sha256 / sha512 / hmac as KMP modules via kotlincrypto #1202.
  3. refactor(mnemonic): convert MnemonicCode + MnemonicException to Kotlin — replaces the Java classes with Kotlin (@JvmStatic toSeed, @JvmField INSTANCE), eliminating the Java-interop call sites in the mnemonic module.

Verification

  • :apps:flipcash:app:compileDebugSources — compiles clean (only processDebugGoogleServices fails, needs creds).
  • :libs:encryption:{sha256,sha512,hmac,base58}:testAndroidHostTest — cross-platform vector gates pass.
  • :libs:encryption:mnemonic:testDebugUnitTest — passes.

Note

The full BIP39 + SLIP-10 correctness gate (slip10.json) is an instrumented test (needs a device/emulator), so it did not run in this environment. Recommend running it on the CI emulator to fully validate the mnemonic Kotlin port's toEntropy / toMnemonic bit-manipulation before merge.

bmc08gt added 2 commits August 7, 2026 16:19
- Sha256Hash.bytes: internal → public val (restores cross-module Kotlin
  access and the auto-generated Java getBytes() accessor; removes now-
  redundant explicit getBytes() method that would clash with the getter)
- Sha256Hash companion functions: add @JvmStatic so Java callers can
  resolve hash(), hashTwice(), wrap(), wrapReversed(), of(), twiceOf()
  as static methods
- PBKDF2SHA512.derive: add @JvmStatic so Java callers can call
  PBKDF2SHA512.derive(...) from a static context
- MnemonicCode.java: replace Sha256Hash.newDigest() (an androidMain
  extension, not Java-callable) with an inline MessageDigest.getInstance
  call; Sha256Hash.hash() now resolves via @JvmStatic above
Adds a compile-check job that runs :apps:flipcash:app:compileDebugSources
before the flipcash-tests job. This task compiles all Kotlin/Java sources
but stops before processDebugGoogleServices, so it requires no secrets.

The missing gate is what allowed the KMP conversions in #1201 and #1202
to land on code/cash without surfacing the Java interop breaks (missing
@JvmStatic, internal visibility) — those were only caught by compiling
the full consumer graph, which CI never did without creds.
@bmc08gt
bmc08gt requested a review from jeffyanta as a code owner August 7, 2026 20:21
@github-actions github-actions Bot added type: fix Bug fix area: crypto Solana, keys, encryption, signing labels Aug 7, 2026
@bmc08gt
bmc08gt merged commit 80e1d35 into code/cash Aug 7, 2026
3 of 4 checks passed
@bmc08gt
bmc08gt deleted the fix/kmp-consumer-compile branch August 7, 2026 20:22
@bmc08gt bmc08gt changed the title fix(kmp): restore Java/cross-module interop for sha256 & sha512 + CI compile gate fix(kmp): repair code/cash app compile broken by the KMP conversions Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: crypto Solana, keys, encryption, signing type: fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant