Repository navigation
Conversation
…vice-link iOS needs the protocol through SharedCore, which can't take Compose or :ui:theme. The protocol, crypto, invite, PhoneLinker and PhoneLinkController move as-is, same package, so callers in apps/desktop and features/myaccount don't change. :apps:flipcash:shared:device-link keeps the screens, SeedVault and the keyring store. SeedVault isn't UI, but it is desktop storage; iOS passes its seed in rather than reading a vault. The fake-vault test moves with SeedVault into its own file.
LinkProtocolTest moves from jvmTest to commonTest and now also runs on iosSimulatorArm64 (7/7, real loopback sockets and the native libsodium). Android gets a device-test source set instead of a host test, because libsodium's Android binding loads its .so from the APK; chat-cipher has the same limit. shared-core-tests runs the iOS target.
device_link.json (canonical copy in the orchestrator's test-vectors/, from gen_device_link.py over PyNaCl) fixes keys, secret, transcript, both session keys, the six-digit code, and the sealed seed and ack frames for three cases, plus tampered seeds and bad invites. DeviceLinkVectorTest reproduces all of it on jvm and iosSimulatorArm64. LinkCrypto.seal gains an internal fixed-nonce overload for the test; production still draws a fresh nonce.
PhoneLinkSession wraps PhoneLinkController for Swift: scanned(text:), confirm(entropyB64:), cancel(), close(), and an onState callback instead of a StateFlow and suspend functions. The seed is an argument to confirm, since iOS already holds it, and is kept only until the controller reads it after the user confirms the codes. PhoneLinker is now internal, so no ktor or Result types reach SharedCore.h. SharedCoreKit adds SharedDeviceLink, which maps the Kotlin states to a Swift enum on the main actor, and DeviceLinkTests, which check the code and seed opening against device_link.json through DeviceLinkVectors.
Collaborator
Author
|
Landed in #1894 as one squash against code/cash. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lets iOS drive the phone side of linking a desktop, through SharedCore. Stacked on #1849.
Split. The protocol, crypto,
LinkInvite,PhoneLinkerandPhoneLinkControllermove to a new UI-free:libs:device-link(commonMain only,flipcash.kmp.library). The Compose screens,SeedVaultand the keyring vault stay in:apps:flipcash:shared:device-link, which depends on the core withapi. Package names didn't change, so the desktop and Android call sites are untouched.Targets. The core builds for android, jvm, iosArm64, iosSimulatorArm64, iosX64, and the macOS targets the plugin adds. ktor-network 3.4.1 and ionspin libsodium 0.9.5 both resolve for the Apple targets. Nothing in the core needed changing for Kotlin/Native.
Tests.
LinkProtocolTestmoved to commonTest and runs over real ktor loopback sockets on jvm andiosSimulatorArm64.DeviceLinkVectorTestchecks the code, session keys and sealed seed againstdevice_link.json, generated independently with PyNaCl in the orchestrator'stest-vectors/. Like chat-cipher, the android target has no host test: the libsodium.sodoesn't load on a host JVM.iOS API.
PhoneLinkSessionwraps the controller for Swift with a state callback instead of a flow and suspend functions:The seed is an argument to
confirm, since iOS already holds it, and is kept only until the controller reads it after the user confirms.PhoneLinkeris now internal, so no ktor orResulttypes reachSharedCore.h.SharedCoreKitaddsSharedDeviceLink, which maps the states to a Swift enum on the main actor, andDeviceLinkTestsagainst the same fixture throughDeviceLinkVectors.