Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: rename root keys to seed keys in ui #1006

Merged
merged 4 commits into from
Apr 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import io.parity.signer.ui.theme.modal
@Composable
fun NewSeedBackup(signerDataModel: SignerDataModel) {
val confirmBackup = remember { mutableStateOf(false) }
val createRoots = remember { mutableStateOf(true) }
val createSeedKeys = remember { mutableStateOf(true) }
Surface(
color = MaterialTheme.colors.Bg200,
shape = MaterialTheme.shapes.modal
Expand All @@ -41,9 +41,9 @@ fun NewSeedBackup(signerDataModel: SignerDataModel) {
text = "I have written down my seed phrase"
)
CheckboxTemplate(
checked = createRoots.value,
onValueChange = { createRoots.value = it },
text = "Create root keys"
checked = createSeedKeys.value,
onValueChange = { createSeedKeys.value = it },
text = "Create seed keys"
)

BigButton(
Expand All @@ -56,7 +56,7 @@ fun NewSeedBackup(signerDataModel: SignerDataModel) {
signerDataModel.addSeed(
seedName = seedName,
seedPhrase = seedPhrase,
createRoots = createRoots.value
createSeedKeys = createSeedKeys.value
)
}
}
Expand Down
5 changes: 2 additions & 3 deletions android/app/src/main/java/io/parity/signer/models/Seed.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package io.parity.signer.models
import android.util.Log
import android.widget.Toast
import io.parity.signer.ButtonID
import org.json.JSONArray

//MARK: Seed management begin

Expand All @@ -30,7 +29,7 @@ internal fun SignerDataModel.refreshSeedNames(init: Boolean = false) {
fun SignerDataModel.addSeed(
seedName: String,
seedPhrase: String,
createRoots: Boolean
createSeedKeys: Boolean
) {

//Check if seed name already exists
Expand All @@ -55,7 +54,7 @@ fun SignerDataModel.addSeed(
refreshSeedNames()
pushButton(
button = ButtonID.GoForward,
details = if (createRoots) "true" else "false",
details = if (createSeedKeys) "true" else "false",
seedPhrase = seedPhrase
)
} catch (e: java.lang.Exception) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import io.parity.signer.components.HeadingOverline
import io.parity.signer.components.RestoreSeedPhraseBox
import io.parity.signer.components.RestoreSeedPhraseSuggest
import io.parity.signer.models.*
import org.json.JSONArray

@Composable
fun RecoverSeedPhrase(
Expand All @@ -37,7 +36,7 @@ fun RecoverSeedPhrase(
seedWordText,
selection = TextRange(seedWordText.length)
)
val createRoots = remember { mutableStateOf(true) }
val createSeedKeys = remember { mutableStateOf(true) }

Column(
verticalArrangement = Arrangement.Top,
Expand Down Expand Up @@ -73,14 +72,14 @@ fun RecoverSeedPhrase(
Row(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier.toggleable(
value = createRoots.value,
value = createSeedKeys.value,
role = Role.Checkbox,
onValueChange = { createRoots.value = it }
onValueChange = { createSeedKeys.value = it }
)) {
Checkbox(
checked = createRoots.value,
onCheckedChange = { createRoots.value = it })
Text("Create root keys")
checked = createSeedKeys.value,
onCheckedChange = { createSeedKeys.value = it })
Text("Create seed keys")
}
Spacer(Modifier.weight(0.1f))
//if (true) { //TODO: hide when keyboard is shown
Expand All @@ -93,7 +92,7 @@ fun RecoverSeedPhrase(
signerDataModel.addSeed(
seedName = seedName,
seedPhrase = it,
createRoots = createRoots.value
createSeedKeys = createSeedKeys.value
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion ios/NativeSigner/Modals/NewSeedBackupModal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct NewSeedBackupModal: View {
}) {
HStack {
Image(systemName: createRoots ? "checkmark.square" : "square").imageScale(.large)
Text("Create root keys")
Text("Create seed keys")
.multilineTextAlignment(.leading).foregroundColor(Color("Text500"))
Spacer()
}
Expand Down
2 changes: 1 addition & 1 deletion ios/NativeSigner/Screens/RecoverSeedPhrase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ struct RecoverSeedPhrase: View {
}) {
HStack {
Image(systemName: createRoots ? "checkmark.square" : "square").imageScale(.large)
Text("Create root keys")
Text("Create seed keys")
.multilineTextAlignment(.leading)
Spacer()
}
Expand Down
6 changes: 3 additions & 3 deletions rust/definitions/src/error_signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ impl ErrorSource for Signer {
DatabaseSigner::SpecsCollision{name, encryption} => format!("More than one entry for network specs with name {} and encryption {}.", name, encryption.show()),
DatabaseSigner::DifferentNamesSameGenesisHash{name1, name2, genesis_hash} => format!("Different network names ({}, {}) in database for same genesis hash {}.", name1, name2, hex::encode(genesis_hash)),
DatabaseSigner::CustomVerifierIsGeneral(key) => format!("Network with genesis hash {} verifier is set as a custom one. This custom verifier coinsides the database general verifier and not None. This should not have happened and likely indicates database corruption.", hex::encode(key.genesis_hash())),
DatabaseSigner::TwoRootKeys{seed_name, encryption} => format!("More than one root key (i.e. with empty path and without password) found for seed name {} and encryption {}.", seed_name, encryption.show()),
DatabaseSigner::TwoRootKeys{seed_name, encryption} => format!("More than one seed key (i.e. with empty path and without password) found for seed name {} and encryption {}.", seed_name, encryption.show()),
DatabaseSigner::DifferentBase58Specs{genesis_hash, base58_1, base58_2} => format!("More than one base58 prefix in network specs database entries for network with genesis hash {}: {} and {}.", hex::encode(genesis_hash), base58_1, base58_2),
};
format!("Database error. {}", insert)
Expand Down Expand Up @@ -699,7 +699,7 @@ pub enum DatabaseSigner {
/// Associated data is [`VerifierKey`] corresponding to faulty entry.
CustomVerifierIsGeneral(VerifierKey),

/// Database has two root addresses (i.e. with empty derivation path and no
/// Database has two seed addresses (i.e. with empty derivation path and no
/// password) for same seed name and [`Encryption`]
///
/// This indicates the database corruption, since the encrypion method,
Expand All @@ -708,7 +708,7 @@ pub enum DatabaseSigner {
/// seed name
seed_name: String,

/// encryption algorithm for which two root keys were found
/// encryption algorithm for which two seed keys were found
encryption: Encryption,
},

Expand Down
2 changes: 1 addition & 1 deletion rust/definitions/src/test_all_errors_signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1031,7 +1031,7 @@ mod tests {
"Database error. More than one entry for network specs with name westend and encryption sr25519."
"Database error. Different network names (westend, WeStEnD) in database for same genesis hash e143f23803ca50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e."
"Database error. Network with genesis hash 853faffbfc6713c1f899bf16547fcfbf733ae8361b8ca0129699d01d4f2181fd verifier is set as a custom one. This custom verifier coinsides the database general verifier and not None. This should not have happened and likely indicates database corruption."
"Database error. More than one root key (i.e. with empty path and without password) found for seed name Alice and encryption sr25519."
"Database error. More than one seed key (i.e. with empty path and without password) found for seed name Alice and encryption sr25519."
"Database error. More than one base58 prefix in network specs database entries for network with genesis hash e143f23803ca50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e: 42 and 104."
"Bad input data. Payload could not be decoded as `add_specs`."
"Bad input data. Payload could not be decoded as `load_meta`."
Expand Down
2 changes: 1 addition & 1 deletion rust/transaction_parsing/src/tests.rs

Large diffs are not rendered by default.