Skip to content

feat(shared-core): add macOS Kotlin/Native targets - #1402

Open
bmc08gt wants to merge 24 commits into
code/cashfrom
feat/shared-core-mnemonic-derivation
Open

feat(shared-core): add macOS Kotlin/Native targets#1402
bmc08gt wants to merge 24 commits into
code/cashfrom
feat/shared-core-mnemonic-derivation

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

SharedCore.xcframework had no macOS slice, so FlipcashCoreVectors — a macOS SPM package and the shared-derivation work's regression gate on iOS — couldn't build against it. Adds macosArm64/macosX64 targets to the 7 SharedCore-exported modules plus the transitively-needed :libs:encryption:utils.

ed25519 needed its expect/actual pair moved from src/iosMain to src/appleMain: Kotlin's default target hierarchy only promotes a source set named appleMain to cover both iOS and macOS targets, not one named iosMain. The vendored orlp/ed25519 C source needed no changes — it compiles clean under macOS clang for both arm64 and x86_64.

Also adds macOS(.v14) to kmp/shared-core's kmmbridge SPM config and spm/Package.swift's platform list, so a future flipcash-shared-core-spm release publishes a macOS slice.

Test plan

  • ./gradlew :kmp:shared-core:assembleSharedCoreReleaseXCFramework — confirmed the assembled XCFramework's Info.plist lists a macos-arm64_x86_64 slice alongside the existing iOS slices
  • Verified end-to-end against a local iOS build: FlipcashCoreVectors' full test suite passes against this XCFramework via FLIPCASH_SHARED_CORE_LOCAL

androidDeviceTest needs getByName("androidDeviceTest") rather than a direct block accessor, matching the existing androidHostTest pattern in :libs:encryption:utils.
Verifies BIP39 seed -> SLIP-0010 ed25519 derivation against slip10.json on the JVM host, mirroring the ed25519/base58 commonTest gates from #718.

The androidHostTest JVM run needs the same JNI-backed Ed25519Kmp Android actual as :libs:encryption:ed25519's own host test, which loads libnative-lib.dylib/libed25519.dylib from a src/androidHostTest/jniLibs directory. mnemonic didn't have one, so createKeyPair() failed with UnsatisfiedLinkError; copying the same two prebuilt libraries in fixes it.
Mirrors Ed25519.swift/Hashes.swift: wraps the Kotlin Derive/MnemonicCode objects exported through the SharedCore XCFramework, plus the [Int64] -> KotlinLongArray bridge derivedKey(seed:hardenedIndexes:) needs.

Existing facade files import Foundation alongside SharedCore for Data; the plan's Derivation.swift sample omitted it, added here to match convention.
Verified via xcodebuild against a simulator destination, not the plan's swift test: the XCFramework has no macOS slice, so plain swift test fails with 'no library for this platform was found' (same issue the shared-core-tests.yml CI lane already works around). 1 test passed, 0 failed.
SharedCore.xcframework had no macOS slice, so FlipcashCoreVectors, a
macOS SPM package and Task 22's designated regression gate, couldn't
build against it. Add macosArm64/macosX64 to the 7 exported modules
plus the transitively-needed :libs:encryption:utils, and add
macOS(.v14) to kmp/shared-core's kmmbridge SPM config and
spm/Package.swift's platform list.

ed25519 needed its expect/actual pair moved from src/iosMain to
src/appleMain: Kotlin's default target hierarchy only promotes a
source set named appleMain to cover both iOS and macOS targets, not
one named iosMain. The vendored orlp/ed25519 C source needed no
changes, it compiles clean under macOS clang for both arm64 and
x86_64.
@bmc08gt
bmc08gt requested a review from jeffyanta as a code owner September 3, 2026 21:16
@bmc08gt bmc08gt self-assigned this Sep 3, 2026
@github-actions github-actions Bot added area: crypto Solana, keys, encryption, signing area: build-system Gradle, convention plugins, build-logic type: feature New functionality labels Sep 3, 2026
@bmc08gt
bmc08gt force-pushed the feat/shared-core-mnemonic-derivation branch from fd3480e to 4f34b7a Compare September 3, 2026 21:32
@github-actions github-actions Bot added the area: network gRPC, connectivity, API, exchange rates label Sep 3, 2026
Porting MnemonicCode to commonMain as an object made its backing wordList
field private again (only getWordList() is exposed), breaking
SeedInputViewModel's direct field access.
Picks up #1397 (UserFlags), #1401 (restores KikCode+Badge/KikCode+Figure/
SVGPath/KikCodeFigureTests), and #1400 (FocusPin/MessageRow/
MessageReadReporter/ReceiptRules) via the true fork point as the merge
base, correcting an earlier rewrite that had reparented this branch onto
code/cash's graph without actually merging its content.
@bmc08gt bmc08gt reopened this Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: build-system Gradle, convention plugins, build-logic area: crypto Solana, keys, encryption, signing area: network gRPC, connectivity, API, exchange rates area: onboarding type: feature New functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant