diff --git a/composeApp/src/commonMain/composeResources/values/strings.xml b/composeApp/src/commonMain/composeResources/values/strings.xml
index 393549ba..17414def 100644
--- a/composeApp/src/commonMain/composeResources/values/strings.xml
+++ b/composeApp/src/commonMain/composeResources/values/strings.xml
@@ -180,8 +180,6 @@
Reindex events
reposted
Review
- Review and confirm
- Review and contribute
Review and join
Say what now?
Search
@@ -241,7 +239,6 @@
This group has not been asked to sign anything yet.
This group has not signed anything yet.
This is fixed once the ceremony runs. Changing it later means generating a new key.
- This is the last thing the ceremony needs from you.
This will be shown when people open the chat for more details.
This will be shown when people open your profile.
This will be the display name for this chat room.
@@ -370,8 +367,6 @@
The subgroup's key ceremony needs you
%1$s key ceremonies need you
Join it by publishing your device's key
- Send your contribution to the key
- Check the combined result and confirm it
The group has its key — finish setting it up
Open the shared key ceremony
Open the proposal
@@ -452,4 +447,15 @@
You already have a chat with %1$s.
Checking whether %1$s can receive messages here.
%1$s hasn't set up encrypted messaging yet. Try again later, or ask them to open Giza.
+ Join the key ceremony?
+ Join the ceremony
+ this group
+ %1$s is creating a shared key that takes %2$d of %3$d members to sign with.
+ Your device publishes the key it will be identified by for the rest of the ceremony.
+ Once everyone has joined, your device contributes to the key, checks the combined result and confirms it. You will not be asked again.
+ Your share of the key never leaves this device.
+ The ceremony cannot finish until every member has taken part. If it stalls on someone, any member can abandon it from the ceremony screen.
+ Nothing has been published from this device yet. Declining leaves the ceremony for the others to abandon or wait on, and you can join later from the shared key screen.
+ Once everyone has joined, each member's device commits to its part of the key. Nobody is asked.
+ Each member's device checks the combined result against what it sent, and confirms it if they match.
diff --git a/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/DkgApprovalScaffold.kt b/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/DkgApprovalScaffold.kt
index b8b60f2e..6f534e28 100644
--- a/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/DkgApprovalScaffold.kt
+++ b/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/DkgApprovalScaffold.kt
@@ -49,13 +49,13 @@ import mobi.giza.compose.ui.composable.widgets.NavigateBackButton
import mobi.giza.compose.ui.theme.readableContent
/**
- * The frame every ChillDKG approval screen sits in: the view model, the states
- * where there is nothing to approve, and the approve/decline bar.
+ * The frame a ChillDKG approval screen sits in: the view model, the states where
+ * there is nothing to approve, and the approve/decline bar.
*
- * The three screens are separate because each is asking for something different
- * and has its own case to make. What they share is only the chrome and, more
- * importantly, the guard below — which is a correctness concern rather than a
- * cosmetic one and should not be re-argued three times.
+ * There is one such screen now, the join (docs/automatic-key-ceremony.md); there
+ * were three, and the frame stays apart from it because the guard below is a
+ * correctness concern rather than a cosmetic one, and is the same whatever step a
+ * screen asks about.
*/
@OptIn(ExperimentalMaterial3Api::class)
@Composable
diff --git a/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/DkgJoinApprovalScreen.kt b/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/DkgJoinApprovalScreen.kt
index add63732..e53a9760 100644
--- a/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/DkgJoinApprovalScreen.kt
+++ b/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/DkgJoinApprovalScreen.kt
@@ -17,17 +17,34 @@ import mobi.giza.compose.repository.DkgRepository
import com.vitorpamplona.quartz.nip01Core.core.HexKey
import mobi.giza.compose.identity.Identity
import kotlinx.coroutines.flow.StateFlow
+import mobi.giza.compose.resources.join_the_ceremony
+import mobi.giza.compose.resources.join_the_key_ceremony_question
+import mobi.giza.compose.resources.nothing_has_been_published_from_this_device_yet_declining
+import mobi.giza.compose.resources.once_everyone_has_joined_your_device_contributes_to
+import mobi.giza.compose.resources.s_is_creating_a_shared_key_that_takes
+import mobi.giza.compose.resources.taking_part_with_these_members
+import mobi.giza.compose.resources.the_ceremony_cannot_finish_until_every_member_has
+import mobi.giza.compose.resources.this_group
+import mobi.giza.compose.resources.you
+import mobi.giza.compose.resources.your_device_publishes_the_key_it_will_be
+import mobi.giza.compose.resources.your_share_of_the_key_never_leaves_this
import mobi.giza.compose.ui.theme.spacing
/**
* Asks whether to join a shared key ceremony somebody else opened.
*
- * The first and most consequential of the three approvals. Publishing a host key
- * is what puts this member in the participant set, and the set is what `n` is
- * counted over — so a member who joins and then stops answering does not merely
- * fail to help, they hold the ceremony open for everybody else. Saying that
+ * The one approval a ceremony asks for (docs/automatic-key-ceremony.md). Publishing
+ * a host key is what puts this member in the participant set, and the set is what
+ * `n` is counted over — so a member who joins and then stops answering does not
+ * merely fail to help, they hold the ceremony open for everybody else. Saying that
* plainly here is the point of the screen.
*
+ * Everything after it runs without asking: the device contributes once everyone
+ * has joined, checks the combined result itself and confirms it. So this screen
+ * carries what the round-one screen used to, the members in particular. Who the
+ * key is being made with was settled by the proposal before anyone joined, so it
+ * was never something a later screen knew and this one could not.
+ *
* Until this is approved nothing has left the device, which is worth stating
* outright: the member is being asked to start, not to continue.
*/
@@ -43,8 +60,8 @@ fun DkgJoinApprovalScreen(
) {
DkgApprovalScaffold(
step = DkgApprovalStep.HOST_KEY,
- title = "Join the key ceremony?",
- approveLabel = "Join the ceremony",
+ title = stringResource(Res.string.join_the_key_ceremony_question),
+ approveLabel = stringResource(Res.string.join_the_ceremony),
activeUserPublicKey = activeUserPublicKey,
chatRoomId = chatRoomId,
dkgSessionId = dkgSessionId,
@@ -55,11 +72,15 @@ fun DkgJoinApprovalScreen(
canApprove = { state -> !state.session.isGuardedSubgroup },
) { state ->
val session = state.session
- val group = state.localChatRoom.chatRoom.subject ?: "this group"
+ val group = state.localChatRoom.chatRoom.subject ?: stringResource(Res.string.this_group)
Text(
- text = "$group is creating a shared key that takes " +
- "${session.threshold} of ${state.participantCount} members to sign with.",
+ text = stringResource(
+ Res.string.s_is_creating_a_shared_key_that_takes,
+ group,
+ session.threshold,
+ state.participantCount
+ ),
style = MaterialTheme.typography.bodyLarge
)
@@ -78,17 +99,41 @@ fun DkgJoinApprovalScreen(
modifier = Modifier.fillMaxWidth(),
verticalArrangement = Arrangement.spacedBy(MaterialTheme.spacing.itemGap)
) {
- DkgApprovalPoint("Your device publishes the key it will be identified by for the rest of the ceremony.")
- DkgApprovalPoint("You will be asked twice more before anything of your key material goes out.")
- DkgApprovalPoint(
- "The ceremony cannot finish until every member has taken part, so joining and " +
- "then stopping leaves the group waiting."
- )
+ DkgApprovalPoint(stringResource(Res.string.your_device_publishes_the_key_it_will_be))
+ DkgApprovalPoint(stringResource(Res.string.once_everyone_has_joined_your_device_contributes_to))
+ DkgApprovalPoint(stringResource(Res.string.your_share_of_the_key_never_leaves_this))
+ DkgApprovalPoint(stringResource(Res.string.the_ceremony_cannot_finish_until_every_member_has))
+ }
+
+ // The members, named: this is the last moment "who am I making a key
+ // with" is a question the member can act on, and from here it is the
+ // only one they are asked.
+ Text(
+ text = stringResource(Res.string.taking_part_with_these_members),
+ style = MaterialTheme.typography.titleSmall
+ )
+
+ Column(
+ modifier = Modifier.fillMaxWidth(),
+ verticalArrangement = Arrangement.spacedBy(MaterialTheme.spacing.relatedGap)
+ ) {
+ state.ritualMembers.forEach { member ->
+ val key = member.participant.participantPublicKey
+
+ Text(
+ text = if (key == activeUserPublicKey) {
+ stringResource(Res.string.you)
+ } else {
+ member.profile?.humanReadableNameOrPubkey() ?: key.take(12)
+ },
+ style = MaterialTheme.typography.bodyMedium,
+ color = MaterialTheme.colorScheme.onSurfaceVariant
+ )
+ }
}
Text(
- text = "Nothing has been published from this device yet. Declining leaves the ceremony " +
- "for the others to abandon or wait on, and you can join later from the shared key screen.",
+ text = stringResource(Res.string.nothing_has_been_published_from_this_device_yet_declining),
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant
)
diff --git a/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/DkgRitualScreen.kt b/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/DkgRitualScreen.kt
index 37350c21..545f92ca 100644
--- a/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/DkgRitualScreen.kt
+++ b/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/DkgRitualScreen.kt
@@ -76,8 +76,6 @@ import mobi.giza.compose.database.model.types.DkgApprovalStep
import mobi.giza.compose.ui.composable.navigation.routes.DkgJoinApprovalRoute
import mobi.giza.compose.ui.composable.navigation.routes.SelectSubgroupAdminsRoute
import mobi.giza.compose.ui.composable.navigation.routes.CreateSharedKeyRoute
-import mobi.giza.compose.ui.composable.navigation.routes.DkgRound1ApprovalRoute
-import mobi.giza.compose.ui.composable.navigation.routes.DkgRound2ApprovalRoute
import mobi.giza.compose.ui.composable.navigation.routes.Route
import mobi.giza.compose.ui.view.model.DkgRitualViewModel
import mobi.giza.compose.ui.view.state.DkgRitualUIState
@@ -101,9 +99,9 @@ import mobi.giza.compose.resources.the_parent_group_has_certified_this_subgroup
import mobi.giza.compose.resources.key
import mobi.giza.compose.resources.members
import mobi.giza.compose.resources.nothing_was_created_and_no_key_exists_it_is
-import mobi.giza.compose.resources.review_and_confirm
-import mobi.giza.compose.resources.review_and_contribute
import mobi.giza.compose.resources.review_and_join
+import mobi.giza.compose.resources.once_everyone_has_joined_each_member_s_device_commits
+import mobi.giza.compose.resources.each_member_s_device_checks_the_combined_result_against
import mobi.giza.compose.resources.shared_key
import mobi.giza.compose.resources.the_ceremony_was_abandoned
import mobi.giza.compose.resources.the_group_has_a_shared_key
@@ -206,40 +204,23 @@ fun DkgRitualScreen(
)
},
bottomBar = {
- val pending = dkgRitualUIState.pendingApproval
-
// The ceremony is stopped, waiting on this member, and will stay
// stopped until they act -- so this outranks everything else the
- // bar could offer.
- if (pending != null) {
+ // bar could offer. Joining is the only thing a ceremony asks, so
+ // it is the only thing this can be (docs/automatic-key-ceremony.md).
+ if (dkgRitualUIState.pendingApproval == DkgApprovalStep.HOST_KEY) {
BottomAppBar(
floatingActionButton = {
ExtendedFab(
- label = when (pending) {
- DkgApprovalStep.HOST_KEY -> stringResource(Res.string.review_and_join)
- DkgApprovalStep.ROUND_1 -> stringResource(Res.string.review_and_contribute)
- DkgApprovalStep.ROUND_2 -> stringResource(Res.string.review_and_confirm)
- },
+ label = stringResource(Res.string.review_and_join),
icon = { Icon(Icons.Default.Key, contentDescription = Decorative) },
onClick = {
onNavigateToRoute(
- when (pending) {
- DkgApprovalStep.HOST_KEY -> DkgJoinApprovalRoute(
- activeUserPublicKey = activeUserPublicKey,
- chatRoomId = chatRoomId,
- dkgSessionId = session.id
- )
- DkgApprovalStep.ROUND_1 -> DkgRound1ApprovalRoute(
- activeUserPublicKey = activeUserPublicKey,
- chatRoomId = chatRoomId,
- dkgSessionId = session.id
- )
- DkgApprovalStep.ROUND_2 -> DkgRound2ApprovalRoute(
- activeUserPublicKey = activeUserPublicKey,
- chatRoomId = chatRoomId,
- dkgSessionId = session.id
- )
- }
+ DkgJoinApprovalRoute(
+ activeUserPublicKey = activeUserPublicKey,
+ chatRoomId = chatRoomId,
+ dkgSessionId = session.id
+ )
)
}
)
@@ -471,9 +452,12 @@ private fun RitualProgress(
isDone = stage != DkgRitualStage.COLLECTING_HOST_KEYS
)
+ // Said as something each device does rather than something each member is
+ // waiting to be asked: nobody is asked after joining, and a rung that read as a
+ // task would send the reader looking for a button that is not there.
RitualStep(
title = "Round one",
- detail = "Each member commits to their part of the key.",
+ detail = stringResource(Res.string.once_everyone_has_joined_each_member_s_device_commits),
count = round1Count,
total = participantCount,
isDone = stage == DkgRitualStage.COLLECTING_ROUND_2 || stage == DkgRitualStage.COMPLETE
@@ -481,7 +465,7 @@ private fun RitualProgress(
RitualStep(
title = "Round two",
- detail = "Each member confirms everyone else's part.",
+ detail = stringResource(Res.string.each_member_s_device_checks_the_combined_result_against),
count = round2Count,
total = participantCount,
isDone = stage == DkgRitualStage.COMPLETE
diff --git a/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/DkgRound1ApprovalScreen.kt b/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/DkgRound1ApprovalScreen.kt
deleted file mode 100644
index 3249a31c..00000000
--- a/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/DkgRound1ApprovalScreen.kt
+++ /dev/null
@@ -1,101 +0,0 @@
-package mobi.giza.compose.ui.composable
-
-import androidx.compose.foundation.layout.Arrangement
-import androidx.compose.foundation.layout.Column
-import androidx.compose.foundation.layout.fillMaxWidth
-import androidx.compose.material3.MaterialTheme
-import androidx.compose.material3.Text
-import androidx.compose.runtime.Composable
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.unit.dp
-import mobi.giza.compose.database.model.types.DkgApprovalStep
-import mobi.giza.compose.repository.ChatRepository
-import mobi.giza.compose.repository.DkgRepository
-import com.vitorpamplona.quartz.nip01Core.core.HexKey
-import mobi.giza.compose.identity.Identity
-import kotlinx.coroutines.flow.StateFlow
-import mobi.giza.compose.ui.theme.spacing
-import mobi.giza.compose.resources.Res
-import org.jetbrains.compose.resources.stringResource
-import mobi.giza.compose.resources.taking_part_with_these_members
-import mobi.giza.compose.resources.you
-
-/**
- * Asks whether to contribute to the key itself.
- *
- * The step where the member's own secret material first shapes the outcome.
- * Joining settled who is in the ceremony; this settles what the key is, and once
- * it is out there is no version of the key that does not include it.
- *
- * The participant set is worth showing here rather than a count, because this is
- * the last moment at which "who am I making a key with" is still a question the
- * member can act on — everyone is now known, and the ceremony has not yet
- * committed to anything.
- */
-@Composable
-fun DkgRound1ApprovalScreen(
- activeUserPublicKey: HexKey,
- chatRoomId: String,
- dkgSessionId: String,
- activeIdentityStateFlow: StateFlow,
- chatRepository: ChatRepository,
- dkgRepository: DkgRepository,
- onDone: () -> Unit,
-) {
- DkgApprovalScaffold(
- step = DkgApprovalStep.ROUND_1,
- title = "Contribute to the shared key?",
- approveLabel = "Contribute",
- activeUserPublicKey = activeUserPublicKey,
- chatRoomId = chatRoomId,
- dkgSessionId = dkgSessionId,
- activeIdentityStateFlow = activeIdentityStateFlow,
- chatRepository = chatRepository,
- dkgRepository = dkgRepository,
- onDone = onDone
- ) { state ->
- val session = state.session
-
- Text(
- text = "Everyone has joined. ${state.participantCount} members are making a key that " +
- "takes ${session.threshold} of them to sign with.",
- style = MaterialTheme.typography.bodyLarge
- )
-
- Column(
- modifier = Modifier.fillMaxWidth(),
- verticalArrangement = Arrangement.spacedBy(MaterialTheme.spacing.itemGap)
- ) {
- DkgApprovalPoint(
- "Your device publishes its contribution to the key. Every member's is mixed in, " +
- "so no single device ever holds the whole key."
- )
- DkgApprovalPoint("Your share of it never leaves this device.")
- DkgApprovalPoint("You will be asked once more, to check the combined result before it is final.")
- }
-
- Text(
- text = stringResource(Res.string.taking_part_with_these_members),
- style = MaterialTheme.typography.titleSmall
- )
-
- Column(
- modifier = Modifier.fillMaxWidth(),
- verticalArrangement = Arrangement.spacedBy(MaterialTheme.spacing.relatedGap)
- ) {
- state.ritualMembers.forEach { member ->
- val key = member.participant.participantPublicKey
-
- Text(
- text = if (key == activeUserPublicKey) {
- stringResource(Res.string.you)
- } else {
- member.profile?.humanReadableNameOrPubkey() ?: key.take(12)
- },
- style = MaterialTheme.typography.bodyMedium,
- color = MaterialTheme.colorScheme.onSurfaceVariant
- )
- }
- }
- }
-}
diff --git a/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/DkgRound2ApprovalScreen.kt b/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/DkgRound2ApprovalScreen.kt
deleted file mode 100644
index d69d9147..00000000
--- a/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/DkgRound2ApprovalScreen.kt
+++ /dev/null
@@ -1,87 +0,0 @@
-package mobi.giza.compose.ui.composable
-
-import androidx.compose.foundation.layout.Arrangement
-import androidx.compose.foundation.layout.Column
-import androidx.compose.foundation.layout.fillMaxWidth
-import androidx.compose.material3.MaterialTheme
-import androidx.compose.material3.Text
-import androidx.compose.runtime.Composable
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.unit.dp
-import mobi.giza.compose.database.model.types.DkgApprovalStep
-import mobi.giza.compose.repository.ChatRepository
-import mobi.giza.compose.repository.DkgRepository
-import com.vitorpamplona.quartz.nip01Core.core.HexKey
-import mobi.giza.compose.identity.Identity
-import kotlinx.coroutines.flow.StateFlow
-import mobi.giza.compose.ui.theme.spacing
-import mobi.giza.compose.resources.Res
-import org.jetbrains.compose.resources.stringResource
-import mobi.giza.compose.resources.this_is_the_last_thing_the_ceremony_needs
-
-/**
- * Asks whether to confirm the combined result.
- *
- * The one approval of the three that is a check rather than a decision. Every
- * member signs to say the coordinator's combined result matches what they
- * themselves sent, and it is that agreement — not the coordinator's word — which
- * makes the key final. A coordinator trying to substitute a key the members never
- * contributed to is caught precisely here.
- *
- * The check itself is done by the device, which has the member's own round-1
- * message to compare against and would refuse a mismatch outright. So this screen
- * is not asking the member to verify anything by eye; it is asking whether to put
- * their name to a result their device has already found consistent.
- */
-@Composable
-fun DkgRound2ApprovalScreen(
- activeUserPublicKey: HexKey,
- chatRoomId: String,
- dkgSessionId: String,
- activeIdentityStateFlow: StateFlow,
- chatRepository: ChatRepository,
- dkgRepository: DkgRepository,
- onDone: () -> Unit,
-) {
- DkgApprovalScaffold(
- step = DkgApprovalStep.ROUND_2,
- title = "Confirm the shared key?",
- approveLabel = "Confirm",
- activeUserPublicKey = activeUserPublicKey,
- chatRoomId = chatRoomId,
- dkgSessionId = dkgSessionId,
- activeIdentityStateFlow = activeIdentityStateFlow,
- chatRepository = chatRepository,
- dkgRepository = dkgRepository,
- onDone = onDone
- ) { state ->
- val session = state.session
-
- Text(
- text = "Everyone's contributions have been combined into a " +
- "${session.threshold}-of-${state.participantCount} key.",
- style = MaterialTheme.typography.bodyLarge
- )
-
- Column(
- modifier = Modifier.fillMaxWidth(),
- verticalArrangement = Arrangement.spacedBy(MaterialTheme.spacing.itemGap)
- ) {
- DkgApprovalPoint(
- "Your device has checked the combined result against what it sent, and they match."
- )
- DkgApprovalPoint(
- "Confirming signs to say so. The key becomes final once every member has confirmed."
- )
- DkgApprovalPoint(
- "It is this step that stops anyone substituting a key the group did not make together."
- )
- }
-
- Text(
- text = stringResource(Res.string.this_is_the_last_thing_the_ceremony_needs),
- style = MaterialTheme.typography.bodySmall,
- color = MaterialTheme.colorScheme.onSurfaceVariant
- )
- }
-}
diff --git a/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/navigation/GizaNavHost.kt b/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/navigation/GizaNavHost.kt
index 7ba054d6..96e19041 100644
--- a/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/navigation/GizaNavHost.kt
+++ b/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/navigation/GizaNavHost.kt
@@ -39,8 +39,6 @@ import mobi.giza.compose.ui.composable.CreateProfileScreen
import mobi.giza.compose.ui.composable.DkgJoinApprovalScreen
import mobi.giza.compose.ui.composable.CreateSharedKeyScreen
import mobi.giza.compose.ui.composable.DkgRitualScreen
-import mobi.giza.compose.ui.composable.DkgRound1ApprovalScreen
-import mobi.giza.compose.ui.composable.DkgRound2ApprovalScreen
import mobi.giza.compose.ui.composable.HomeScreen
import mobi.giza.compose.ui.composable.ImplementationPendingScreen
import mobi.giza.compose.ui.composable.KeyPackageManagementScreen
@@ -76,8 +74,6 @@ import mobi.giza.compose.ui.composable.navigation.routes.CreateProfileRoute
import mobi.giza.compose.ui.composable.navigation.routes.DkgJoinApprovalRoute
import mobi.giza.compose.ui.composable.navigation.routes.CreateSharedKeyRoute
import mobi.giza.compose.ui.composable.navigation.routes.DkgRitualRoute
-import mobi.giza.compose.ui.composable.navigation.routes.DkgRound1ApprovalRoute
-import mobi.giza.compose.ui.composable.navigation.routes.DkgRound2ApprovalRoute
import mobi.giza.compose.ui.composable.navigation.routes.HomeRoute
import mobi.giza.compose.ui.composable.navigation.routes.ImplementationPendingRoute
import mobi.giza.compose.ui.composable.navigation.routes.KeyPackageManagementRoute
@@ -631,32 +627,6 @@ fun GizaNavHost(
onDone = { navController.popBackStack() }
)
}
- composable { backStackEntry ->
- val route = backStackEntry.toRoute()
-
- DkgRound1ApprovalScreen(
- activeUserPublicKey = route.activeUserPublicKey,
- chatRoomId = route.chatRoomId,
- dkgSessionId = route.dkgSessionId,
- activeIdentityStateFlow = sovereignWalletViewModel.activeIdentity,
- chatRepository = databaseChatRepository,
- dkgRepository = databaseDkgRepository,
- onDone = { navController.popBackStack() }
- )
- }
- composable { backStackEntry ->
- val route = backStackEntry.toRoute()
-
- DkgRound2ApprovalScreen(
- activeUserPublicKey = route.activeUserPublicKey,
- chatRoomId = route.chatRoomId,
- dkgSessionId = route.dkgSessionId,
- activeIdentityStateFlow = sovereignWalletViewModel.activeIdentity,
- chatRepository = databaseChatRepository,
- dkgRepository = databaseDkgRepository,
- onDone = { navController.popBackStack() }
- )
- }
composable { backStackEntry ->
val route = backStackEntry.toRoute()
diff --git a/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/navigation/routes/DkgRound1ApprovalRoute.kt b/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/navigation/routes/DkgRound1ApprovalRoute.kt
deleted file mode 100644
index 7bcf9520..00000000
--- a/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/navigation/routes/DkgRound1ApprovalRoute.kt
+++ /dev/null
@@ -1,19 +0,0 @@
-package mobi.giza.compose.ui.composable.navigation.routes
-
-import kotlinx.serialization.Serializable
-
-/**
- * Contributing this device's share to a shared key.
- *
- * Its own route rather than a step on a shared one: each approval is a separate
- * decision with its own case to make, and being separately addressable is what
- * lets the chat line and the ritual screen send a member straight to the one the
- * ceremony is actually waiting on.
- */
-@Serializable
-data class DkgRound1ApprovalRoute(
- val activeUserPublicKey: String,
- val chatRoomId: String,
- /** The ceremony being approved. Required, for the reason `DkgRitualRoute`'s is. */
- val dkgSessionId: String
-): Route()
diff --git a/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/navigation/routes/DkgRound2ApprovalRoute.kt b/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/navigation/routes/DkgRound2ApprovalRoute.kt
deleted file mode 100644
index 55abf678..00000000
--- a/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/navigation/routes/DkgRound2ApprovalRoute.kt
+++ /dev/null
@@ -1,19 +0,0 @@
-package mobi.giza.compose.ui.composable.navigation.routes
-
-import kotlinx.serialization.Serializable
-
-/**
- * Confirming the combined result of a shared-key ceremony.
- *
- * Its own route rather than a step on a shared one: each approval is a separate
- * decision with its own case to make, and being separately addressable is what
- * lets the chat line and the ritual screen send a member straight to the one the
- * ceremony is actually waiting on.
- */
-@Serializable
-data class DkgRound2ApprovalRoute(
- val activeUserPublicKey: String,
- val chatRoomId: String,
- /** The ceremony being approved. Required, for the reason `DkgRitualRoute`'s is. */
- val dkgSessionId: String
-): Route()
diff --git a/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/widgets/chat/ChatTranscript.kt b/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/widgets/chat/ChatTranscript.kt
index e70b510c..eeb5e695 100644
--- a/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/widgets/chat/ChatTranscript.kt
+++ b/composeApp/src/commonMain/kotlin/mobi/giza/compose/ui/composable/widgets/chat/ChatTranscript.kt
@@ -20,8 +20,6 @@ import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.AccountTree
import mobi.giza.compose.resources.open
import mobi.giza.compose.resources.the_group_has_its_key_finish_setting_it_up
-import mobi.giza.compose.resources.check_the_combined_result
-import mobi.giza.compose.resources.send_your_contribution_to_the_key
import mobi.giza.compose.resources.join_the_ceremony_by_publishing_your_key
import mobi.giza.compose.resources.the_subgroups_key_ceremony_needs_you
import mobi.giza.compose.resources.the_key_ceremony_needs_you
@@ -617,17 +615,18 @@ private fun CeremoniesAwaitingYouNotice(
else -> stringResource(Res.string.the_key_ceremony_needs_you)
}
- // What it wants, in the words the approval screens use for the same step, so
+ // What it wants, in the words the approval screen uses for the same step, so
// a member is not asked twice in two vocabularies. The gate comes first: an
// approval is owed by this member and cannot be done by anybody else, while
- // finishing the setup is work the coordinator can come back to. The Lightning
- // wallet's gates are buttons on its ceremony screen, and say what those say.
+ // finishing the setup is work the coordinator can come back to.
+ //
+ // Joining is the only gate a ceremony has (docs/automatic-key-ceremony.md).
+ // The two rounds after it are never asked for, so they say nothing here.
val detail = single?.let {
when (val ask = it.ask) {
is ChatMessageListViewModel.Ask.SharedKeyStep -> when (ask.step) {
DkgApprovalStep.HOST_KEY -> stringResource(Res.string.join_the_ceremony_by_publishing_your_key)
- DkgApprovalStep.ROUND_1 -> stringResource(Res.string.send_your_contribution_to_the_key)
- DkgApprovalStep.ROUND_2 -> stringResource(Res.string.check_the_combined_result)
+ DkgApprovalStep.ROUND_1, DkgApprovalStep.ROUND_2 -> null
}
is ChatMessageListViewModel.Ask.RoomCreation -> stringResource(Res.string.the_group_has_its_key_finish_setting_it_up)
}
diff --git a/composeApp/src/commonTest/kotlin/mobi/giza/compose/database/model/TranscriptRequestStateTest.kt b/composeApp/src/commonTest/kotlin/mobi/giza/compose/database/model/TranscriptRequestStateTest.kt
index 2db0b501..065d9f71 100644
--- a/composeApp/src/commonTest/kotlin/mobi/giza/compose/database/model/TranscriptRequestStateTest.kt
+++ b/composeApp/src/commonTest/kotlin/mobi/giza/compose/database/model/TranscriptRequestStateTest.kt
@@ -208,4 +208,23 @@ class TranscriptRequestStateTest {
assertEquals(setOf(hostKey.id), ChatMessage.answeredRequests(transcript))
}
+
+ /**
+ * A round request written by a build that still asked reads as answered once
+ * the round goes out on its own. The line the round writes is the same one a
+ * tapped approval wrote, so nothing told the transcript the gate had gone.
+ */
+ @Test
+ fun `a round request from an older build is answered by the automatic round`() {
+ val roundOne = line(ChatMessage.TYPE_DKG_APPROVAL_NEEDED_ROUND_1, at = 10)
+ val roundTwo = line(ChatMessage.TYPE_DKG_APPROVAL_NEEDED_ROUND_2, at = 12)
+ val transcript = listOf(
+ roundOne,
+ line(ChatMessage.TYPE_DKG_ROUND_1, at = 11),
+ roundTwo,
+ line(ChatMessage.TYPE_DKG_ROUND_2, at = 13),
+ )
+
+ assertEquals(setOf(roundOne.id, roundTwo.id), ChatMessage.answeredRequests(transcript))
+ }
}
diff --git a/composeApp/src/jvmTest/kotlin/mobi/giza/compose/ui/view/model/DkgRitualViewModelJvmTest.kt b/composeApp/src/jvmTest/kotlin/mobi/giza/compose/ui/view/model/DkgRitualViewModelJvmTest.kt
index c543fb1f..bff196ee 100644
--- a/composeApp/src/jvmTest/kotlin/mobi/giza/compose/ui/view/model/DkgRitualViewModelJvmTest.kt
+++ b/composeApp/src/jvmTest/kotlin/mobi/giza/compose/ui/view/model/DkgRitualViewModelJvmTest.kt
@@ -140,10 +140,13 @@ class DkgRitualViewModelJvmTest {
signingSessions
// A deliberately slow answer, so a read-modify-write around it would have
- // the widest possible window to lose somebody else's write in.
+ // the widest possible window to lose somebody else's write in. Shaped like
+ // the real one: joining is the only thing asked, and it is asked until this
+ // member's host key is out.
override suspend fun pendingApproval(session: DkgSession): DkgApprovalStep? {
delay(5)
- return if (messages.value.size >= session.participantCount) DkgApprovalStep.ROUND_1 else null
+ val joined = messages.value.any { it.participantPublicKey == session.userPublicKey }
+ return if (joined) null else DkgApprovalStep.HOST_KEY
}
override suspend fun approve(
@@ -264,7 +267,7 @@ class DkgRitualViewModelJvmTest {
val settled = viewModel.awaitLoaded {
it.session?.stage == DkgRitualStage.COLLECTING_ROUND_1 &&
it.hostKeyParticipants.size == 3 &&
- it.pendingApproval == DkgApprovalStep.ROUND_1
+ it.pendingApproval == null
}
assertEquals(sessionId, settled.session?.id)
assertEquals(setOf(ada, bob, "c".repeat(64)), settled.hostKeyParticipants)