libeufin

Integration and sandbox testing for FinTech APIs and data formats
Log | Files | Refs | Submodules | README | LICENSE

commit 8f18b1b5c872a6e83d52539e88fafc89d5dba7a9
parent c928ab9e189020c2d150d42ecb51ceb618412c19
Author: Antoine A <>
Date:   Thu,  2 May 2024 13:44:04 +0900

nexus: remove convert-backup testing command

Diffstat:
Mnexus/src/main/kotlin/tech/libeufin/nexus/Main.kt | 99+------------------------------------------------------------------------------
1 file changed, 1 insertion(+), 98 deletions(-)

diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt @@ -145,103 +145,6 @@ class InitiatePayment: CliktCommand("Initiate an outgoing payment") { } } -class ConvertBackup: CliktCommand("Convert an old backup to the new config format") { - private val backupPath by argument( - "backup", - help = "Specifies the backup file" - ).path() - - @Serializable - data class EbicsKeysBackupJson( - val userID: String, - val partnerID: String, - val hostID: String, - val ebicsURL: String, - val authBlob: String, - val encBlob: String, - val sigBlob: String - ) - - override fun run() = cliCmd(logger, Level.INFO) { - val raw = backupPath.readText() - val backup = Json.decodeFromString<EbicsKeysBackupJson>(raw) - - val (authBlob, encBlob, sigBlob) = Triple( - EncryptedPrivateKeyInfo(backup.authBlob.decodeBase64()), - EncryptedPrivateKeyInfo(backup.encBlob.decodeBase64()), - EncryptedPrivateKeyInfo(backup.sigBlob.decodeBase64()) - ) - lateinit var keys: ClientPrivateKeysFile - while (true) { - val passphrase = prompt("Enter the backup password", hideInput = true)!! - try { - val (authKey, encKey, sigKey) = Triple( - CryptoUtil.decryptKey(authBlob, passphrase), - CryptoUtil.decryptKey(encBlob, passphrase), - CryptoUtil.decryptKey(sigBlob, passphrase) - ) - keys = ClientPrivateKeysFile( - signature_private_key = sigKey, - encryption_private_key = encKey, - authentication_private_key = authKey, - submitted_ini = false, - submitted_hia = false - ) - break - } catch (e: Exception) { - e.fmtLog(logger) - } - } - - - println("# KEYS") - println(JSON.encodeToString(kotlinx.serialization.serializer<ClientPrivateKeysFile>(), keys)) - - println("# CONFIG") - println(""" -[nexus-ebics] -CURRENCY = CHF - -HOST_BASE_URL = ${backup.ebicsURL} -BANK_DIALECT = postfinance - - -HOST_ID = ${backup.hostID} -USER_ID = ${backup.userID} -PARTNER_ID = ${backup.partnerID} -SYSTEM_ID = - -IBAN = -BIC = -NAME = -""") - - /*val (authKey, encKey, sigKey) = try { - Triple( - CryptoUtil.decryptKey( - EncryptedPrivateKeyInfo(base64ToBytes(ebicsBackup.authBlob)), - passphrase - ), - CryptoUtil.decryptKey( - EncryptedPrivateKeyInfo(base64ToBytes(ebicsBackup.encBlob)), - passphrase - ), - CryptoUtil.decryptKey( - EncryptedPrivateKeyInfo(base64ToBytes(ebicsBackup.sigBlob)), - passphrase - ) - ) - } catch (e: Exception) { - e.printStackTrace() - logger.info("Restoring keys failed, probably due to wrong passphrase") - throw NexusError( - HttpStatusCode.BadRequest, - "Bad backup given" - ) - }*/ - } -} - class FakeIncoming: CliktCommand("Genere a fake incoming payment") { private val common by CommonOption() private val amount by option( @@ -289,7 +192,7 @@ class FakeIncoming: CliktCommand("Genere a fake incoming payment") { class TestingCmd : CliktCommand("Testing helper commands", name = "testing") { init { - subcommands(FakeIncoming(), ConvertBackup()) + subcommands(FakeIncoming()) } override fun run() = Unit