Refactor code structure for improved readability and maintainability
This commit is contained in:
@@ -405,15 +405,14 @@ fun SetPasswordScreen(
|
||||
scope.launch {
|
||||
try {
|
||||
// Generate keys from seed phrase
|
||||
val privateKey = CryptoManager.seedPhraseToPrivateKey(seedPhrase)
|
||||
val keyPair = CryptoManager.generateKeyPairFromSeed(privateKey)
|
||||
val keyPair = CryptoManager.generateKeyPairFromSeed(seedPhrase)
|
||||
|
||||
// Encrypt private key and seed phrase
|
||||
val encryptedPrivateKey = CryptoManager.encryptWithPassword(
|
||||
password, keyPair.privateKey
|
||||
keyPair.privateKey, password
|
||||
)
|
||||
val encryptedSeedPhrase = CryptoManager.encryptWithPassword(
|
||||
password, seedPhrase.joinToString(" ")
|
||||
seedPhrase.joinToString(" "), password
|
||||
)
|
||||
|
||||
// Save account
|
||||
|
||||
@@ -226,7 +226,7 @@ fun UnlockScreen(
|
||||
|
||||
// Try to decrypt
|
||||
val decryptedPrivateKey = CryptoManager.decryptWithPassword(
|
||||
password, account.encryptedPrivateKey
|
||||
account.encryptedPrivateKey, password
|
||||
)
|
||||
|
||||
if (decryptedPrivateKey == null) {
|
||||
@@ -236,7 +236,7 @@ fun UnlockScreen(
|
||||
}
|
||||
|
||||
val decryptedSeedPhrase = CryptoManager.decryptWithPassword(
|
||||
password, account.encryptedSeedPhrase
|
||||
account.encryptedSeedPhrase, password
|
||||
)?.split(" ") ?: emptyList()
|
||||
|
||||
val privateKeyHash = CryptoManager.generatePrivateKeyHash(decryptedPrivateKey)
|
||||
|
||||
Reference in New Issue
Block a user