key storage spotless

This commit is contained in:
nrobi144
2026-01-06 06:50:31 +02:00
parent 4339247815
commit df9d648988
5 changed files with 48 additions and 20 deletions
@@ -63,8 +63,9 @@ class AccountManager(
// and use SecureKeyStorage to retrieve the private key
val lastNpub = getLastNpub() ?: return Result.failure(Exception("No saved account"))
val privKeyHex = secureStorage.getPrivateKey(lastNpub)
?: return Result.failure(Exception("Private key not found for $lastNpub"))
val privKeyHex =
secureStorage.getPrivateKey(lastNpub)
?: return Result.failure(Exception("Private key not found for $lastNpub"))
val keyPair = KeyPair(privKey = privKeyHex.hexToByteArray())
val signer = NostrSignerInternal(keyPair)
@@ -94,8 +95,9 @@ class AccountManager(
}
return try {
val privKeyHex = decodePrivateKeyAsHexOrNull(current.nsec)
?: return Result.failure(Exception("Invalid nsec format"))
val privKeyHex =
decodePrivateKeyAsHexOrNull(current.nsec)
?: return Result.failure(Exception("Invalid nsec format"))
secureStorage.savePrivateKey(current.npub, privKeyHex)
saveLastNpub(current.npub)