Refactor code structure for improved readability and maintainability

This commit is contained in:
k1ngsterr1
2026-01-08 21:48:22 +05:00
parent 5b298a37b3
commit b877d6fa73
8 changed files with 51542 additions and 380 deletions

View File

@@ -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

View File

@@ -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)