From 005cbc2f23441312289c5126dbaf96613c2088ec Mon Sep 17 00:00:00 2001 From: Kgothatso Ngako Date: Wed, 18 Nov 2026 16:08:52 +0200 Subject: [PATCH] refactor: composeApp stops importing lightning-kmp (wallet removal, Phase 7a) W3: a Lightning invoice in a note is a card that opens a lightning: link in the device's own wallet app, undecoded -- decoding was lightning-kmp's, and paying from the card was never wired. The dead pay and zap hooks go. Lightning.randomBytes becomes quartz's RandomInstance; the tests' LocalKeyManager becomes PhraseKeys; NodeParamsManager.chain becomes PROFILE_CHAIN, the mainnet constant every profile's preference files are named under. What is left of the library is storage (keystore, credentials, seed file, preferences). Moving it into the app and off the composite build is Phase 7b, which needs an iOS build and a device to check, and is left for its own branch. Co-Authored-By: Claude Opus 5.5 --- .../composeResources/values/strings.xml | 7 +- .../extensions/WalletManagerExtension.kt | 12 -- .../giza/compose/identity/IdentityWriter.kt | 7 +- .../giza/compose/identity/ProfileChain.kt | 14 ++ .../SovereignWalletStartupScreen.kt | 5 +- .../widgets/content/ContentSegment.kt | 3 +- .../ui/composable/widgets/content/Helpers.kt | 14 +- .../widgets/content/InvoicePayState.kt | 5 - .../widgets/content/LightningInvoiceCard.kt | 185 ++++-------------- .../composable/widgets/content/NoteActions.kt | 2 - .../composable/widgets/content/RichContent.kt | 7 +- .../ui/view/model/NewProfileWriters.kt | 7 +- .../ui/view/model/SovereignWalletViewModel.kt | 3 +- .../identity/AddProfileFromInsideJvmTest.kt | 10 +- .../compose/identity/IdentitySwitchJvmTest.kt | 10 +- .../compose/identity/IdentityWriterJvmTest.kt | 19 +- .../MultipleProfilesRoundTripJvmTest.kt | 8 +- .../identity/NpubPreviewRoundTripJvmTest.kt | 10 +- .../identity/NsecRestoreRoundTripJvmTest.kt | 8 +- .../identity/SeedCredentialsJvmTest.kt | 18 +- docs/giza-wallet-removal.md | 4 +- 21 files changed, 103 insertions(+), 255 deletions(-) delete mode 100644 composeApp/src/commonMain/kotlin/mobi/giza/compose/extensions/WalletManagerExtension.kt create mode 100644 composeApp/src/commonMain/kotlin/mobi/giza/compose/identity/ProfileChain.kt delete mode 100644 composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/widgets/content/InvoicePayState.kt diff --git a/composeApp/src/commonMain/composeResources/values/strings.xml b/composeApp/src/commonMain/composeResources/values/strings.xml index 8c7e88a5..393549ba 100644 --- a/composeApp/src/commonMain/composeResources/values/strings.xml +++ b/composeApp/src/commonMain/composeResources/values/strings.xml @@ -32,7 +32,6 @@ Add to group After this there is no turning back. All broadcasts are queued so that we can manage data usage on metered connections. - Any amount ARTICLE As long as you control your keys there can be no dispute about who YOU actually is. Back @@ -83,8 +82,6 @@ Everything is cryptographical sound. Just announcing your profile to the world. Everything is cryptographical sound. Just indexing your profile on the device. Everything is cryptographical sound. Just need to queue your profile and announce it to the world. - Expired - ✗ Failed follow follow back functionality coming soon. @@ -116,6 +113,7 @@ Removal sent; it takes effect once a relay accepts it Library Lightning invoice + Open in a wallet app LIVE Live stream Loading @@ -154,9 +152,6 @@ Nothing is waiting for your signature. Nothing was created and no key exists. It is safe to run it again. Open chat - ✓ Paid - Pay - Pay now Post post functionality coming soon. Private to you diff --git a/composeApp/src/commonMain/kotlin/mobi/giza/compose/extensions/WalletManagerExtension.kt b/composeApp/src/commonMain/kotlin/mobi/giza/compose/extensions/WalletManagerExtension.kt deleted file mode 100644 index cf75afbf..00000000 --- a/composeApp/src/commonMain/kotlin/mobi/giza/compose/extensions/WalletManagerExtension.kt +++ /dev/null @@ -1,12 +0,0 @@ -package mobi.giza.compose.extensions - -import com.vitorpamplona.quartz.nip01Core.core.toHexKey -import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair -import fr.acinq.lightning.crypto.LocalKeyManager -import fr.acinq.phoenix.managers.nostrPrivateKey - -fun LocalKeyManager.nostrPublicKey(): String { - return KeyPair( - privKey = nostrPrivateKey().value.toByteArray() - ).pubKey.toHexKey() -} \ No newline at end of file diff --git a/composeApp/src/commonMain/kotlin/mobi/giza/compose/identity/IdentityWriter.kt b/composeApp/src/commonMain/kotlin/mobi/giza/compose/identity/IdentityWriter.kt index f0e9b02c..8ac43c92 100644 --- a/composeApp/src/commonMain/kotlin/mobi/giza/compose/identity/IdentityWriter.kt +++ b/composeApp/src/commonMain/kotlin/mobi/giza/compose/identity/IdentityWriter.kt @@ -7,7 +7,6 @@ import fr.acinq.phoenix.PhoenixGlobal import fr.acinq.phoenix.data.ElectrumConfig import fr.acinq.phoenix.data.WalletId import fr.acinq.phoenix.managers.DataStoreManager -import fr.acinq.phoenix.managers.NodeParamsManager import fr.acinq.phoenix.managers.NostrCredentialManager import fr.acinq.phoenix.managers.SeedManager import fr.acinq.phoenix.managers.nostrPrivateKey @@ -74,7 +73,7 @@ object IdentityWriter { globalPrefs.saveLastUsedAppCode(AppVersion.versionCode) val dataStoreManager = DataStoreManager( phoenixGlobal.ctx, - chain = NodeParamsManager.chain, + chain = PROFILE_CHAIN, ) val userPrefs = dataStoreManager.loadUserPrefsForWallet(walletId = id) userPrefs.saveIsTorEnabled(isTorEnabled) @@ -182,7 +181,7 @@ object IdentityWriter { // wallet's -- fresh, as a new wallet's are, which is right: there is // a new secret to back up. The files under the bare key's id would // otherwise sit on the disk with nothing reading them. - DataStoreManager(phoenixGlobal.ctx, chain = NodeParamsManager.chain).deleteNodeUserPrefs(bareKeyId) + DataStoreManager(phoenixGlobal.ctx, chain = PROFILE_CHAIN).deleteNodeUserPrefs(bareKeyId) } } } @@ -351,7 +350,7 @@ object IdentityWriter { NostrCredentialManager.writeToDisk(phoenixGlobal, EncryptedNostrCredentials.encrypt(existing - nostrPublicKey)) log.i("forgot nostr credential for identity=$id") - DataStoreManager(phoenixGlobal.ctx, chain = NodeParamsManager.chain).deleteNodeUserPrefs(id) + DataStoreManager(phoenixGlobal.ctx, chain = PROFILE_CHAIN).deleteNodeUserPrefs(id) return ForgetNostrCredentialResult.Forgotten } diff --git a/composeApp/src/commonMain/kotlin/mobi/giza/compose/identity/ProfileChain.kt b/composeApp/src/commonMain/kotlin/mobi/giza/compose/identity/ProfileChain.kt new file mode 100644 index 00000000..a34fae13 --- /dev/null +++ b/composeApp/src/commonMain/kotlin/mobi/giza/compose/identity/ProfileChain.kt @@ -0,0 +1,14 @@ +package mobi.giza.compose.identity + +import fr.acinq.bitcoin.Chain + +/** + * The chain a profile's preference files are filed under: mainnet, always. + * + * It was `NodeParamsManager.chain`, which was a constant, `Chain.Mainnet`, so every + * profile on every device has its files under it. Giza runs no node any more + * (docs/giza-wallet-removal.md), and this is the one thing the node's chain still + * decides. It must not move: another chain would be a fresh set of empty preference + * files for every profile. + */ +val PROFILE_CHAIN: Chain = Chain.Mainnet diff --git a/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/SovereignWalletStartupScreen.kt b/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/SovereignWalletStartupScreen.kt index e7a8702c..84126250 100644 --- a/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/SovereignWalletStartupScreen.kt +++ b/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/SovereignWalletStartupScreen.kt @@ -1,5 +1,7 @@ package mobi.giza.compose.ui.composable +import mobi.giza.compose.identity.PROFILE_CHAIN + import androidx.compose.foundation.layout.* import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text @@ -19,7 +21,6 @@ import mobi.giza.compose.ui.composable.widgets.LoadingDataIndicator import fr.acinq.phoenix.data.ListWalletState import fr.acinq.phoenix.data.WalletId import fr.acinq.phoenix.managers.DataStoreManager -import fr.acinq.phoenix.managers.NodeParamsManager import fr.acinq.phoenix.utils.preferences.UserPrefs import fr.acinq.phoenix.utils.preferences.UserWalletMetadata import fr.acinq.phoenix.utils.preferences.getByWalletIdOrDefault @@ -186,7 +187,7 @@ fun SovereignWalletStartupScreen( val metadata = remember { availableWalletMetadata.getByWalletIdOrDefault(stored.id) } val dataStoreManager = DataStoreManager( ctx = sovereignWalletViewModel.phoenixGlobal.ctx, - chain = NodeParamsManager.chain + chain = PROFILE_CHAIN ) // The screen-lock gate wraps both kinds. It only ever needed the // id, to read the lock preferences, so it sits outside the branch diff --git a/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/widgets/content/ContentSegment.kt b/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/widgets/content/ContentSegment.kt index 9d8c1184..42d9b5b6 100644 --- a/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/widgets/content/ContentSegment.kt +++ b/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/widgets/content/ContentSegment.kt @@ -4,7 +4,6 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.normalizeRelayUrl import com.vitorpamplona.quartz.nip19Bech32.entities.NAddress import com.vitorpamplona.quartz.nip19Bech32.entities.NEvent import com.vitorpamplona.quartz.nip19Bech32.entities.NProfile -import fr.acinq.lightning.payment.Bolt11Invoice internal sealed interface ContentSegment { @@ -82,6 +81,6 @@ internal sealed interface ContentSegment { } data class CustomEmojiSegment(val shortcode: String, val url: String) : ContentSegment data class HashtagSegment(val tag: String) : ContentSegment - data class LightningInvoiceSegment(val invoice: String, val decoded: Bolt11Invoice) : ContentSegment + data class LightningInvoiceSegment(val invoice: String) : ContentSegment data class GroupInviteSegment(val relayUrl: String, val groupId: String) : ContentSegment } \ No newline at end of file diff --git a/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/widgets/content/Helpers.kt b/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/widgets/content/Helpers.kt index 4e4cb101..54a4ca33 100644 --- a/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/widgets/content/Helpers.kt +++ b/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/widgets/content/Helpers.kt @@ -3,7 +3,6 @@ package mobi.giza.compose.ui.composable.widgets.content import com.vitorpamplona.quartz.nip68Picture.PictureEvent import com.vitorpamplona.quartz.nip71Video.VideoNormalEvent import com.vitorpamplona.quartz.nip71Video.VideoShortEvent -import fr.acinq.lightning.payment.Bolt11Invoice import io.ktor.http.Url import io.ktor.http.fullPath import kotlinx.coroutines.Dispatchers @@ -71,18 +70,15 @@ internal object Helpers { var lastEnd = 0 var anyFound = false for (match in matches) { - val raw = match.value - val invoice = raw.removePrefix("lightning:").removePrefix("LIGHTNING:").lowercase() - val bolt11Invoice = Bolt11Invoice.read(invoice) - if (bolt11Invoice.isFailure) { - continue - } - val decoded = bolt11Invoice.get() + // Not decoded: Giza keeps no wallet and no longer carries lightning-kmp's + // decoder. An invoice is shown as one and opened in the device's wallet app, + // which is where it is checked (docs/giza-wallet-removal.md, W3). + val invoice = match.value.removePrefix("lightning:").removePrefix("LIGHTNING:").lowercase() anyFound = true if (match.range.first > lastEnd) { result.add(ContentSegment.TextSegment(text.substring(lastEnd, match.range.first))) } - result.add(ContentSegment.LightningInvoiceSegment(invoice, decoded)) + result.add(ContentSegment.LightningInvoiceSegment(invoice)) lastEnd = match.range.last + 1 } if (!anyFound) return listOf(ContentSegment.TextSegment(text)) diff --git a/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/widgets/content/InvoicePayState.kt b/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/widgets/content/InvoicePayState.kt deleted file mode 100644 index efeda414..00000000 --- a/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/widgets/content/InvoicePayState.kt +++ /dev/null @@ -1,5 +0,0 @@ -package mobi.giza.compose.ui.composable.widgets.content - -internal enum class InvoicePayState { - Idle, Paying, Success, Failed -} \ No newline at end of file diff --git a/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/widgets/content/LightningInvoiceCard.kt b/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/widgets/content/LightningInvoiceCard.kt index b6e095da..36c22165 100644 --- a/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/widgets/content/LightningInvoiceCard.kt +++ b/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/widgets/content/LightningInvoiceCard.kt @@ -1,187 +1,68 @@ package mobi.giza.compose.ui.composable.widgets.content -import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width -import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Bolt -import androidx.compose.material3.AlertDialog -import androidx.compose.material3.Button -import androidx.compose.material3.ButtonDefaults -import androidx.compose.material3.CircularProgressIndicator import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme -import androidx.compose.material3.Surface +import androidx.compose.material3.OutlinedCard import androidx.compose.material3.Text import androidx.compose.material3.TextButton import androidx.compose.runtime.Composable -import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember -import androidx.compose.runtime.rememberCoroutineScope -import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.unit.dp -import fr.acinq.lightning.payment.Bolt11Invoice -import kotlinx.coroutines.delay -import kotlinx.coroutines.launch -import mobi.giza.compose.ui.theme.spacing -import mobi.giza.compose.ui.composable.widgets.Decorative +import androidx.compose.ui.platform.LocalUriHandler +import androidx.compose.ui.text.style.TextOverflow import mobi.giza.compose.resources.Res -import org.jetbrains.compose.resources.stringResource -import mobi.giza.compose.resources.any_amount -import mobi.giza.compose.resources.cancel -import mobi.giza.compose.resources.expired -import mobi.giza.compose.resources.failed import mobi.giza.compose.resources.lightning_invoice -import mobi.giza.compose.resources.paid -import mobi.giza.compose.resources.pay -import mobi.giza.compose.resources.pay_now +import mobi.giza.compose.resources.open_in_a_wallet_app +import mobi.giza.compose.ui.composable.widgets.Decorative +import mobi.giza.compose.ui.theme.spacing +import org.jetbrains.compose.resources.stringResource +/** + * A Lightning invoice in a note, handed to the device's own wallet app. + * + * Giza keeps no wallet (docs/giza-wallet-removal.md, W3), so it neither decodes an + * invoice nor pays one: decoding needs lightning-kmp, which Giza no longer depends on + * for anything else, and paying from the card was never wired up. What it can do is + * say this is an invoice rather than a run of letters, and open it as a `lightning:` + * link for whatever wallet the device has. + */ @Composable -internal fun LightningInvoiceCard( - invoice: String, - decoded: Bolt11Invoice, - onPayInvoice: (suspend (String) -> Boolean)? -) { - val primary = MaterialTheme.colorScheme.primary - val onPrimary = MaterialTheme.colorScheme.onPrimary - val isExpired = decoded.isExpired() - var showConfirm by remember { mutableStateOf(false) } - var payState by remember { mutableStateOf(InvoicePayState.Idle) } - val scope = rememberCoroutineScope() +internal fun LightningInvoiceCard(invoice: String) { + val uriHandler = LocalUriHandler.current - if (showConfirm) { - AlertDialog( - onDismissRequest = { showConfirm = false }, - title = { Text(stringResource(Res.string.lightning_invoice)) }, - text = { - Column { - Text( - text = "${decoded.amount?.truncateToSatoshi() ?: "Any amount"}" - ) - if (!decoded.description.isNullOrBlank()) { - Spacer(Modifier.height(MaterialTheme.spacing.space50)) - Text( - text = decoded.description!!, - style = MaterialTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant - ) - } - } - }, - confirmButton = { - Button( - onClick = { - showConfirm = false - if (onPayInvoice != null) { - scope.launch { - payState = InvoicePayState.Paying - val success = onPayInvoice(invoice) - payState = if (success) InvoicePayState.Success else InvoicePayState.Failed - delay(3000) - payState = InvoicePayState.Idle - } - } - }, - colors = ButtonDefaults.buttonColors( - containerColor = primary, - contentColor = onPrimary - ) - ) { Text(stringResource(Res.string.pay)) } - }, - dismissButton = { - TextButton(onClick = { showConfirm = false }) { - Text(stringResource(Res.string.cancel)) - } - } - ) - } - - Surface( - modifier = Modifier - .fillMaxWidth() - .padding(vertical = MaterialTheme.spacing.space50), - shape = RoundedCornerShape(12.dp), - color = MaterialTheme.colorScheme.surfaceVariant, - border = BorderStroke(1.dp, primary.copy(alpha = 0.4f)) - ) { + OutlinedCard(modifier = Modifier.fillMaxWidth().padding(vertical = MaterialTheme.spacing.space50)) { Row( modifier = Modifier.padding(horizontal = MaterialTheme.spacing.space150, vertical = MaterialTheme.spacing.space125), verticalAlignment = Alignment.CenterVertically ) { - Icon( - Icons.Default.Bolt, - contentDescription = Decorative, - tint = primary, - modifier = Modifier.size(20.dp) - ) + Icon(Icons.Default.Bolt, contentDescription = Decorative, tint = MaterialTheme.colorScheme.primary) Spacer(Modifier.width(MaterialTheme.spacing.space125)) Column(Modifier.weight(1f)) { Text( - text = if (decoded.amount != null) - "${decoded.amount!!.truncateToSatoshi()}" - else stringResource(Res.string.any_amount), + text = stringResource(Res.string.lightning_invoice), style = MaterialTheme.typography.titleSmall, - color = primary ) - if (!decoded.description.isNullOrBlank()) { - Text( - text = decoded.description!!, - style = MaterialTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, - maxLines = 2 - ) - } - if (isExpired) { - Text( - text = stringResource(Res.string.expired), - style = MaterialTheme.typography.labelSmall, - color = MaterialTheme.colorScheme.error - ) - } + Text( + text = invoice, + style = MaterialTheme.typography.bodySmall, + color = MaterialTheme.colorScheme.onSurfaceVariant, + maxLines = 1, + overflow = TextOverflow.MiddleEllipsis, + ) } - if (onPayInvoice != null) { - Spacer(Modifier.width(MaterialTheme.spacing.space100)) - when (payState) { - InvoicePayState.Paying -> CircularProgressIndicator( - modifier = Modifier.size(24.dp), - color = primary, - strokeWidth = 2.dp - ) - InvoicePayState.Success -> Text( - text = stringResource(Res.string.paid), - style = MaterialTheme.typography.labelMedium, - color = primary - ) - InvoicePayState.Failed -> Text( - text = stringResource(Res.string.failed), - style = MaterialTheme.typography.labelMedium, - color = MaterialTheme.colorScheme.error - ) - InvoicePayState.Idle -> Button( - onClick = { if (!isExpired) showConfirm = true }, - enabled = !isExpired, - colors = ButtonDefaults.buttonColors( - containerColor = primary, - contentColor = onPrimary - ) - ) { - Text( - if (isExpired) stringResource(Res.string.expired) - else stringResource(Res.string.pay_now) - ) - } - } + // No wallet app is a normal state on a desktop, and not an error worth more + // than doing nothing. + TextButton(onClick = { runCatching { uriHandler.openUri("lightning:$invoice") } }) { + Text(stringResource(Res.string.open_in_a_wallet_app)) } } } -} \ No newline at end of file +} diff --git a/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/widgets/content/NoteActions.kt b/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/widgets/content/NoteActions.kt index 7426b15e..fb924f49 100644 --- a/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/widgets/content/NoteActions.kt +++ b/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/widgets/content/NoteActions.kt @@ -7,7 +7,6 @@ data class NoteActions( val onReact: (NostrEvent, String) -> Unit = { _, _ -> }, val onRepost: (NostrEvent) -> Unit = {}, val onQuote: (NostrEvent) -> Unit = {}, - val onZap: (NostrEvent) -> Unit = {}, val onProfileClick: (String) -> Unit = {}, val onNoteClick: (String) -> Unit = {}, val onAddToList: (String) -> Unit = {}, @@ -21,7 +20,6 @@ data class NoteActions( val onHashtagClick: ((String) -> Unit)? = null, val onRelayClick: ((String) -> Unit)? = null, val onArticleClick: ((Int, String, String) -> Unit)? = null, - val onPayInvoice: (suspend (String) -> Boolean)? = null, val onGroupRoom: ((String, String) -> Unit)? = null, val onLiveStreamClick: ((hostPubkey: String, dTag: String, relayHint: String?) -> Unit)? = null, // val groupMetadataProvider: ((String, String) -> Nip29.GroupMetadata?)? = null, diff --git a/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/widgets/content/RichContent.kt b/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/widgets/content/RichContent.kt index 2cd987c0..4399eb2c 100644 --- a/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/widgets/content/RichContent.kt +++ b/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/widgets/content/RichContent.kt @@ -26,7 +26,6 @@ import androidx.compose.ui.text.buildAnnotatedString import androidx.compose.ui.text.style.TextDecoration import androidx.compose.ui.text.withLink import androidx.compose.ui.text.withStyle -import androidx.compose.ui.unit.dp import co.touchlab.kermit.Logger import coil3.compose.AsyncImage import com.vitorpamplona.quartz.nip01Core.core.HexKey @@ -368,11 +367,7 @@ fun RichContent( } } is ContentSegment.LightningInvoiceSegment -> { - LightningInvoiceCard( - invoice = segment.invoice, - decoded = segment.decoded, - onPayInvoice = noteActions?.onPayInvoice - ) + LightningInvoiceCard(invoice = segment.invoice) } // is ContentSegment.GroupInviteSegment -> { // GroupInviteCard( diff --git a/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/view/model/NewProfileWriters.kt b/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/view/model/NewProfileWriters.kt index 137a3a8c..4700a924 100644 --- a/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/view/model/NewProfileWriters.kt +++ b/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/view/model/NewProfileWriters.kt @@ -1,8 +1,9 @@ package mobi.giza.compose.ui.view.model +import com.vitorpamplona.quartz.utils.RandomInstance + import fr.acinq.bitcoin.MnemonicCode import fr.acinq.bitcoin.PrivateKey -import fr.acinq.lightning.Lightning import fr.acinq.phoenix.managers.nostrPublicKeyHex import fr.acinq.phoenix.utils.MnemonicLanguage import kotlinx.coroutines.CompletableDeferred @@ -18,7 +19,7 @@ import mobi.giza.compose.identity.StoredIdentity * fires. */ fun SovereignWalletViewModel.seedProfileWriter(): NewProfileWriter = NewProfileWriter { - val words = MnemonicCode.toMnemonics(Lightning.randomBytes(16), MnemonicLanguage.English.wordlist()) + val words = MnemonicCode.toMnemonics(RandomInstance.bytes(16), MnemonicLanguage.English.wordlist()) val outcome = CompletableDeferred>() writeSeed( mnemonics = words, @@ -31,7 +32,7 @@ fun SovereignWalletViewModel.seedProfileWriter(): NewProfileWriter = NewProfileW /** A profile that is a key: thirty-two random bytes, written the way a pasted nsec is. */ fun SovereignWalletViewModel.bareKeyProfileWriter(): NewProfileWriter = NewProfileWriter { - val key = PrivateKey(Lightning.randomBytes(32)) + val key = PrivateKey(RandomInstance.bytes(32)) when (val result = writeNostrKey(key)) { is IdentityWriter.WriteNostrCredentialResult.Written -> Result.success(NewProfile(key.nostrPublicKeyHex(), result.id)) is IdentityWriter.WriteNostrCredentialResult.AlreadyExists -> Result.failure(IllegalStateException("a fresh key collided with one already here")) diff --git a/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/view/model/SovereignWalletViewModel.kt b/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/view/model/SovereignWalletViewModel.kt index 0268320a..feb1b4c9 100644 --- a/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/view/model/SovereignWalletViewModel.kt +++ b/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/view/model/SovereignWalletViewModel.kt @@ -9,7 +9,6 @@ import androidx.lifecycle.viewModelScope import androidx.lifecycle.viewmodel.initializer import androidx.lifecycle.viewmodel.viewModelFactory import co.touchlab.kermit.Logger -import fr.acinq.lightning.logging.error import fr.acinq.phoenix.PhoenixGlobal import com.vitorpamplona.quartz.nip01Core.core.HexKey import fr.acinq.bitcoin.PrivateKey @@ -177,7 +176,7 @@ class SovereignWalletViewModel( val wallets: Map = when (val result = loadAndDecryptSeed(phoenixGlobal)) { is DecryptSeedResult.Failure.SerializationError -> { - log.error {"cannot deserialize seed file: "} + log.e {"cannot deserialize seed file: "} _listWalletState.value = ListWalletState.Error.Serialization return@launch } diff --git a/composeApp/src/jvmTest/kotlin/mobi/giza/compose/identity/AddProfileFromInsideJvmTest.kt b/composeApp/src/jvmTest/kotlin/mobi/giza/compose/identity/AddProfileFromInsideJvmTest.kt index 9041c8f1..3d6a8620 100644 --- a/composeApp/src/jvmTest/kotlin/mobi/giza/compose/identity/AddProfileFromInsideJvmTest.kt +++ b/composeApp/src/jvmTest/kotlin/mobi/giza/compose/identity/AddProfileFromInsideJvmTest.kt @@ -1,14 +1,14 @@ package mobi.giza.compose.identity +import com.vitorpamplona.quartz.utils.RandomInstance + import androidx.room3.Room import co.touchlab.kermit.Logger import fr.acinq.bitcoin.PrivateKey -import fr.acinq.lightning.Lightning import fr.acinq.phoenix.PhoenixGlobal import fr.acinq.phoenix.data.WalletId import fr.acinq.phoenix.jvm.BusinessManager import fr.acinq.phoenix.managers.DataStoreManager -import fr.acinq.phoenix.managers.NodeParamsManager import fr.acinq.phoenix.managers.nostrPublicKeyHex import fr.acinq.phoenix.security.JvmKeyStore import fr.acinq.phoenix.utils.PlatformContext @@ -63,8 +63,8 @@ class AddProfileFromInsideJvmTest { private val marmotRepository = DatabaseMarmotRepository(db, scope) private val log = Logger.withTag("AddProfileFromInsideJvmTest") - private val keyA = PrivateKey(Lightning.randomBytes(32)) - private val keyB = PrivateKey(Lightning.randomBytes(32)) + private val keyA = PrivateKey(RandomInstance.bytes(32)) + private val keyB = PrivateKey(RandomInstance.bytes(32)) @BeforeTest fun setUp() { @@ -98,7 +98,7 @@ class AddProfileFromInsideJvmTest { ) private fun activated(stored: StoredIdentity.NostrSecret): Identity { - val dataStoreManager = DataStoreManager(phoenixGlobal.ctx, chain = NodeParamsManager.chain) + val dataStoreManager = DataStoreManager(phoenixGlobal.ctx, chain = PROFILE_CHAIN) return Identity.signing( id = stored.id, kind = IdentityKind.NostrSecret, diff --git a/composeApp/src/jvmTest/kotlin/mobi/giza/compose/identity/IdentitySwitchJvmTest.kt b/composeApp/src/jvmTest/kotlin/mobi/giza/compose/identity/IdentitySwitchJvmTest.kt index 4e9f0898..2a956869 100644 --- a/composeApp/src/jvmTest/kotlin/mobi/giza/compose/identity/IdentitySwitchJvmTest.kt +++ b/composeApp/src/jvmTest/kotlin/mobi/giza/compose/identity/IdentitySwitchJvmTest.kt @@ -1,14 +1,14 @@ package mobi.giza.compose.identity +import com.vitorpamplona.quartz.utils.RandomInstance + import androidx.room3.Room import co.touchlab.kermit.Logger import fr.acinq.bitcoin.PrivateKey -import fr.acinq.lightning.Lightning import fr.acinq.phoenix.PhoenixGlobal import fr.acinq.phoenix.data.WalletId import fr.acinq.phoenix.jvm.BusinessManager import fr.acinq.phoenix.managers.DataStoreManager -import fr.acinq.phoenix.managers.NodeParamsManager import fr.acinq.phoenix.managers.nostrPublicKeyHex import fr.acinq.phoenix.security.JvmKeyStore import fr.acinq.phoenix.utils.PlatformContext @@ -71,8 +71,8 @@ class IdentitySwitchJvmTest { private val marmotRepository = DatabaseMarmotRepository(db, scope) private val log = Logger.withTag("IdentitySwitchJvmTest") - private val keyA = PrivateKey(Lightning.randomBytes(32)) - private val keyB = PrivateKey(Lightning.randomBytes(32)) + private val keyA = PrivateKey(RandomInstance.bytes(32)) + private val keyB = PrivateKey(RandomInstance.bytes(32)) @BeforeTest @@ -106,7 +106,7 @@ class IdentitySwitchJvmTest { /** What the startup screen's bare-key branch builds. */ private fun activated(stored: StoredIdentity.NostrSecret): Identity { - val dataStoreManager = DataStoreManager(phoenixGlobal.ctx, chain = NodeParamsManager.chain) + val dataStoreManager = DataStoreManager(phoenixGlobal.ctx, chain = PROFILE_CHAIN) return Identity.signing( id = stored.id, kind = IdentityKind.NostrSecret, diff --git a/composeApp/src/jvmTest/kotlin/mobi/giza/compose/identity/IdentityWriterJvmTest.kt b/composeApp/src/jvmTest/kotlin/mobi/giza/compose/identity/IdentityWriterJvmTest.kt index 03e3bdfa..e1cb96ed 100644 --- a/composeApp/src/jvmTest/kotlin/mobi/giza/compose/identity/IdentityWriterJvmTest.kt +++ b/composeApp/src/jvmTest/kotlin/mobi/giza/compose/identity/IdentityWriterJvmTest.kt @@ -1,15 +1,13 @@ package mobi.giza.compose.identity +import com.vitorpamplona.quartz.utils.RandomInstance + import androidx.datastore.preferences.core.PreferenceDataStoreFactory import co.touchlab.kermit.Logger import fr.acinq.bitcoin.MnemonicCode import fr.acinq.bitcoin.PrivateKey -import fr.acinq.bitcoin.byteVector -import fr.acinq.lightning.Lightning -import fr.acinq.lightning.crypto.LocalKeyManager import fr.acinq.phoenix.PhoenixGlobal import fr.acinq.phoenix.data.WalletId -import fr.acinq.phoenix.managers.NodeParamsManager import fr.acinq.phoenix.managers.NostrCredentialManager import fr.acinq.phoenix.managers.SeedManager import fr.acinq.phoenix.managers.computePreferencePath @@ -67,8 +65,8 @@ class IdentityWriterJvmTest { // Fresh keys per test, not fixed ones: DataStoreManager caches each id's preferences // in a companion object for the life of the process, so a fixed key would be served // the UserPrefs an earlier test created in an earlier temp directory. - private val first = PrivateKey(Lightning.randomBytes(32)) - private val second = PrivateKey(Lightning.randomBytes(32)) + private val first = PrivateKey(RandomInstance.bytes(32)) + private val second = PrivateKey(RandomInstance.bytes(32)) private val scope = CoroutineScope(Job()) @@ -101,13 +99,8 @@ class IdentityWriterJvmTest { /** Twelve fresh words, and what they derive. */ private class Phrase { - val words: List = MnemonicCode.toMnemonics(Lightning.randomBytes(16), MnemonicLanguage.English.wordlist()) - private val keyManager = LocalKeyManager( - seed = MnemonicCode.toSeed(words, "").byteVector(), - chain = NodeParamsManager.chain, - remoteSwapInExtendedPublicKey = NodeParamsManager.remoteSwapInXpub, - ) - val walletId = WalletId(keyManager.nodeKeys.nodeKey.publicKey) + val words: List = MnemonicCode.toMnemonics(RandomInstance.bytes(16), MnemonicLanguage.English.wordlist()) + val walletId = PhraseKeys.profileId(words) val nostrKey = StoredIdentity.nostrPrivateKeyOf(words) val nostrPublicKey = nostrKey.nostrPublicKeyHex() } diff --git a/composeApp/src/jvmTest/kotlin/mobi/giza/compose/identity/MultipleProfilesRoundTripJvmTest.kt b/composeApp/src/jvmTest/kotlin/mobi/giza/compose/identity/MultipleProfilesRoundTripJvmTest.kt index d4c27c9f..56c39513 100644 --- a/composeApp/src/jvmTest/kotlin/mobi/giza/compose/identity/MultipleProfilesRoundTripJvmTest.kt +++ b/composeApp/src/jvmTest/kotlin/mobi/giza/compose/identity/MultipleProfilesRoundTripJvmTest.kt @@ -1,14 +1,14 @@ package mobi.giza.compose.identity +import com.vitorpamplona.quartz.utils.RandomInstance + import androidx.room3.Room import fr.acinq.bitcoin.PrivateKey -import fr.acinq.lightning.Lightning import fr.acinq.phoenix.PhoenixGlobal import fr.acinq.phoenix.data.EmptyWalletId import fr.acinq.phoenix.data.WalletId import fr.acinq.phoenix.jvm.BusinessManager import fr.acinq.phoenix.managers.DataStoreManager -import fr.acinq.phoenix.managers.NodeParamsManager import fr.acinq.phoenix.managers.NostrCredentialManager import fr.acinq.phoenix.managers.nostrPublicKeyHex import fr.acinq.phoenix.security.JvmKeyStore @@ -78,7 +78,7 @@ class MultipleProfilesRoundTripJvmTest { private val chatRepository = DatabaseChatRepository(db, scope) private val marmotRepository = DatabaseMarmotRepository(db, scope) - private val keyB = PrivateKey(Lightning.randomBytes(32)) + private val keyB = PrivateKey(RandomInstance.bytes(32)) @BeforeTest fun setUp() { @@ -99,7 +99,7 @@ class MultipleProfilesRoundTripJvmTest { appDir.deleteRecursively() } - private val dataStoreManager by lazy { DataStoreManager(phoenixGlobal.ctx, chain = NodeParamsManager.chain) } + private val dataStoreManager by lazy { DataStoreManager(phoenixGlobal.ctx, chain = PROFILE_CHAIN) } private suspend fun listed(sovereign: SovereignWalletViewModel, size: Int): Map { val done = CompletableDeferred() diff --git a/composeApp/src/jvmTest/kotlin/mobi/giza/compose/identity/NpubPreviewRoundTripJvmTest.kt b/composeApp/src/jvmTest/kotlin/mobi/giza/compose/identity/NpubPreviewRoundTripJvmTest.kt index f4052a81..1e1581a7 100644 --- a/composeApp/src/jvmTest/kotlin/mobi/giza/compose/identity/NpubPreviewRoundTripJvmTest.kt +++ b/composeApp/src/jvmTest/kotlin/mobi/giza/compose/identity/NpubPreviewRoundTripJvmTest.kt @@ -1,15 +1,15 @@ package mobi.giza.compose.identity +import com.vitorpamplona.quartz.utils.RandomInstance + import androidx.datastore.preferences.core.PreferenceDataStoreFactory import androidx.room3.Room import co.touchlab.kermit.Logger import com.vitorpamplona.quartz.nip01Core.metadata.MetadataEvent import fr.acinq.bitcoin.PrivateKey -import fr.acinq.lightning.Lightning import fr.acinq.phoenix.PhoenixGlobal import fr.acinq.phoenix.jvm.BusinessManager import fr.acinq.phoenix.managers.DataStoreManager -import fr.acinq.phoenix.managers.NodeParamsManager import fr.acinq.phoenix.managers.NostrCredentialManager import fr.acinq.phoenix.managers.SeedManager import fr.acinq.phoenix.managers.computePreferencePath @@ -85,7 +85,7 @@ class NpubPreviewRoundTripJvmTest { private val marmotRepository = DatabaseMarmotRepository(db, scope) private val log = Logger.withTag("NpubPreviewRoundTripJvmTest") - private val privateKey = PrivateKey(Lightning.randomBytes(32)) + private val privateKey = PrivateKey(RandomInstance.bytes(32)) private val publicKey = privateKey.nostrPublicKeyHex() private val at = Instant.fromEpochSeconds(1_700_000_000) @@ -146,7 +146,7 @@ class NpubPreviewRoundTripJvmTest { assertEquals(publicKey, stored.nostrPublicKey) // 3. What the startup screen's NostrPublic branch does: an identity with nothing behind it. - val dataStoreManager = DataStoreManager(phoenixGlobal.ctx, chain = NodeParamsManager.chain) + val dataStoreManager = DataStoreManager(phoenixGlobal.ctx, chain = PROFILE_CHAIN) val identity = Identity.readOnly( id = stored.id, nostrPublicKey = stored.nostrPublicKey, @@ -216,7 +216,7 @@ class NpubPreviewRoundTripJvmTest { signInViewModel().commit(SignInCredential.NostrSecret(privateKey, publicKey)) ) val stored = assertIs(listed()[signedIn.id]) - val dataStoreManager = DataStoreManager(phoenixGlobal.ctx, chain = NodeParamsManager.chain) + val dataStoreManager = DataStoreManager(phoenixGlobal.ctx, chain = PROFILE_CHAIN) val identity = Identity.signing( id = stored.id, kind = IdentityKind.NostrSecret, diff --git a/composeApp/src/jvmTest/kotlin/mobi/giza/compose/identity/NsecRestoreRoundTripJvmTest.kt b/composeApp/src/jvmTest/kotlin/mobi/giza/compose/identity/NsecRestoreRoundTripJvmTest.kt index b2a311b1..478daed0 100644 --- a/composeApp/src/jvmTest/kotlin/mobi/giza/compose/identity/NsecRestoreRoundTripJvmTest.kt +++ b/composeApp/src/jvmTest/kotlin/mobi/giza/compose/identity/NsecRestoreRoundTripJvmTest.kt @@ -1,14 +1,14 @@ package mobi.giza.compose.identity +import com.vitorpamplona.quartz.utils.RandomInstance + import androidx.datastore.preferences.core.PreferenceDataStoreFactory import co.touchlab.kermit.Logger import com.vitorpamplona.quartz.nip01Core.core.HexKey import fr.acinq.bitcoin.PrivateKey -import fr.acinq.lightning.Lightning import fr.acinq.phoenix.PhoenixGlobal import fr.acinq.phoenix.jvm.BusinessManager import fr.acinq.phoenix.managers.DataStoreManager -import fr.acinq.phoenix.managers.NodeParamsManager import fr.acinq.phoenix.managers.NostrCredentialManager import fr.acinq.phoenix.managers.SeedManager import fr.acinq.phoenix.managers.computePreferencePath @@ -62,7 +62,7 @@ class NsecRestoreRoundTripJvmTest { private lateinit var globalPrefs: GlobalPrefs private val log = Logger.withTag("NsecRestoreRoundTripJvmTest") - private val privateKey = PrivateKey(Lightning.randomBytes(32)) + private val privateKey = PrivateKey(RandomInstance.bytes(32)) private val at = Instant.fromEpochSeconds(1_700_000_000) @BeforeTest @@ -124,7 +124,7 @@ class NsecRestoreRoundTripJvmTest { val stored = assertIs(identities[written.id], "the imported key is listed under the id the writer returned") // 3. What the startup screen's NostrSecret branch does: an identity, no node. - val dataStoreManager = DataStoreManager(phoenixGlobal.ctx, chain = NodeParamsManager.chain) + val dataStoreManager = DataStoreManager(phoenixGlobal.ctx, chain = PROFILE_CHAIN) val identity = Identity.signing( id = stored.id, kind = IdentityKind.NostrSecret, diff --git a/composeApp/src/jvmTest/kotlin/mobi/giza/compose/identity/SeedCredentialsJvmTest.kt b/composeApp/src/jvmTest/kotlin/mobi/giza/compose/identity/SeedCredentialsJvmTest.kt index a92a3e8d..c7caa74a 100644 --- a/composeApp/src/jvmTest/kotlin/mobi/giza/compose/identity/SeedCredentialsJvmTest.kt +++ b/composeApp/src/jvmTest/kotlin/mobi/giza/compose/identity/SeedCredentialsJvmTest.kt @@ -1,13 +1,10 @@ package mobi.giza.compose.identity +import com.vitorpamplona.quartz.utils.RandomInstance + import co.touchlab.kermit.Logger import fr.acinq.bitcoin.MnemonicCode -import fr.acinq.bitcoin.byteVector -import fr.acinq.lightning.Lightning -import fr.acinq.lightning.crypto.LocalKeyManager import fr.acinq.phoenix.PhoenixGlobal -import fr.acinq.phoenix.data.WalletId -import fr.acinq.phoenix.managers.NodeParamsManager import fr.acinq.phoenix.managers.NostrCredentialManager import fr.acinq.phoenix.managers.SeedManager import fr.acinq.phoenix.managers.nostrPublicKeyHex @@ -47,17 +44,12 @@ class SeedCredentialsJvmTest { private val log = Logger.withTag("SeedCredentialsJvmTest") private class Seed(val words: List) { - val keyManager = LocalKeyManager( - seed = MnemonicCode.toSeed(words, "").byteVector(), - chain = NodeParamsManager.chain, - remoteSwapInExtendedPublicKey = NodeParamsManager.remoteSwapInXpub, - ) - val walletId = WalletId(keyManager.nodeKeys.nodeKey.publicKey) + val walletId = PhraseKeys.profileId(words) val nostrKey = StoredIdentity.nostrPrivateKeyOf(words) val nostrPublicKey = nostrKey.nostrPublicKeyHex() } - private fun freshSeed() = Seed(MnemonicCode.toMnemonics(Lightning.randomBytes(16), MnemonicLanguage.English.wordlist())) + private fun freshSeed() = Seed(MnemonicCode.toMnemonics(RandomInstance.bytes(16), MnemonicLanguage.English.wordlist())) private val first = freshSeed() private val second = freshSeed() @@ -150,7 +142,7 @@ class SeedCredentialsJvmTest { @Test fun `bare keys already in the file are untouched`() { writeSeedsOnly(first) - val bare = StoredIdentity.nostrSecret(fr.acinq.bitcoin.PrivateKey(Lightning.randomBytes(32))) + val bare = StoredIdentity.nostrSecret(fr.acinq.bitcoin.PrivateKey(RandomInstance.bytes(32))) NostrCredentialManager.writeToDisk( phoenixGlobal, EncryptedNostrCredentials.encrypt(mapOf(bare.nostrPublicKey to NostrCredential.Secret(bare.privateKey))), diff --git a/docs/giza-wallet-removal.md b/docs/giza-wallet-removal.md index 1b3af8d9..a7871636 100644 --- a/docs/giza-wallet-removal.md +++ b/docs/giza-wallet-removal.md @@ -25,7 +25,9 @@ written against `caf1fb18`. | 3 | built, as **member wallets only** (see below). The member-wallet events (30334, 30335, 30336, 30337), `MemberWalletManager`, `MemberWalletDerivation`, the repository and DAO, five screens with their view models, states and routes, and their 74 strings. `GuardianManager` stops reading member certificates. `jvmTest` 1,311 run, 0 failed (one `IdentitySwitchJvmTest` timeout under the full suite's load, which passes three times in three alone and at baseline) | | 4 | built: the on-chain wallet, its guardians and the subgroup wallet policy, together. `wallet/` (Electrum included), `nostr/wallet/`, the policy and guardian tags, `GroupWalletDerivation`, `GroupWalletManager`, `GuardianDerivation`, `GuardianManager`, `ProposedSpend`, three screens with their view models, states and routes, and FROST's spend half. Every 30332 is filed declined without being read. Certificates and ceremonies carry no wallet tag, and a guarded subgroup's ceremony is filed and not joined (W5). The last `bennu/` derivation tag is gone from the code, and with it the last wallet pins. `jvmTest` 1,148 run, 0 failed | | 5 | built: `MIGRATION_35_36` drops the sixteen tables, the three columns, the wallets' 32 line types and every signing session over a transaction or a sweep, with their items and messages; `schemas/…/36.json` is committed. The line-type constants and the transcript's arms for them go with the rows. `RemoveWalletsMigrationJvmTest` checks the shape against Room's v36 and the rows kept and deleted. `jvmTest` 1,150 run, 0 failed | -| 6 | built. `PhraseKeys` derives a phrase's nostr key and profile id with bitcoin-kmp's `DeterministicWallet` and lands on Phase 0's pins unchanged; `StoredIdentity` and `IdentityWriter` use it. No node starts for any profile: `Identity.business`, `startupNode`, the start-state machine, `platformStartupLogic`, `schedulePlatformLogic`, `updateBusinessActiveInUI` and `stopPlatformBusiness` go, with `LightningApplication`, `BusinessManager.initialize`, the NFC hooks and `POST_NOTIFICATIONS`. Copy that promised funds is reworded, and the switcher's *Wallet* badge says *Recovery phrase*. Android compiles; **the two iOS actuals were edited without an iOS build**. `jvmTest` 1,149 run, 0 failed but the `IdentitySwitchJvmTest` timeout seen in Phase 3 (passes alone) | Paths below are under +| 6 | built. `PhraseKeys` derives a phrase's nostr key and profile id with bitcoin-kmp's `DeterministicWallet` and lands on Phase 0's pins unchanged; `StoredIdentity` and `IdentityWriter` use it. No node starts for any profile: `Identity.business`, `startupNode`, the start-state machine, `platformStartupLogic`, `schedulePlatformLogic`, `updateBusinessActiveInUI` and `stopPlatformBusiness` go, with `LightningApplication`, `BusinessManager.initialize`, the NFC hooks and `POST_NOTIFICATIONS`. Copy that promised funds is reworded, and the switcher's *Wallet* badge says *Recovery phrase*. Android compiles; **the two iOS actuals were edited without an iOS build**. `jvmTest` 1,149 run, 0 failed but the `IdentitySwitchJvmTest` timeout seen in Phase 3 (passes alone) | +| 7a | built: **`composeApp` imports nothing from lightning-kmp.** W3: a Lightning invoice in a note is a card that opens a `lightning:` link in the device's own wallet app, undecoded; the never-wired pay and zap hooks go. `Lightning.randomBytes` becomes quartz's `RandomInstance`, the tests' `LocalKeyManager` becomes `PhraseKeys`, and `NodeParamsManager.chain` becomes `PROFILE_CHAIN`, the constant mainnet that names every profile's preference files. `jvmTest` 1,149 run, 0 failed | +| 7b | **not built.** Vendoring the storage classes into `composeApp` and re-pointing the build at the bitcoin-kmp fork. It is a rewrite rather than a move -- `UserPrefs` is built on lightning-kmp types, `PhoenixGlobal` builds a node's managers and an app database, the keystore has an actual per platform -- and a wrong preference key or keychain detail silently loses people's profiles. Its own checks are an iOS build and an Android install over a Phase 6 build with the same profiles opening, neither of which this tree can run. Left for its own branch, as the plan already said of this phase | Paths below are under `composeApp/src/commonMain/kotlin/mobi/giza/compose/` unless they say otherwise. Line numbers were right at that commit; confirm them with a grep before using them.