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

@@ -73,9 +73,10 @@ object CryptoManager {
}
/**
* Generate key pair from private key using secp256k1 curve
* Generate key pair from seed phrase using secp256k1 curve
*/
fun generateKeyPairFromSeed(privateKeyHex: String): KeyPairData {
fun generateKeyPairFromSeed(seedPhrase: List<String>): KeyPairData {
val privateKeyHex = seedPhraseToPrivateKey(seedPhrase)
val ecSpec = ECNamedCurveTable.getParameterSpec("secp256k1")
// Use first 32 bytes of private key for secp256k1
@@ -109,7 +110,7 @@ object CryptoManager {
/**
* Encrypt data with password using PBKDF2 + AES
*/
fun encryptWithPassword(password: String, data: String): String {
fun encryptWithPassword(data: String, password: String): String {
// Compress data
val compressed = compress(data.toByteArray())
@@ -139,7 +140,7 @@ object CryptoManager {
/**
* Decrypt data with password
*/
fun decryptWithPassword(password: String, encryptedData: String): String? {
fun decryptWithPassword(encryptedData: String, password: String): String? {
return try {
val parts = encryptedData.split(":")
if (parts.size != 2) return null