summaryrefslogtreecommitdiff
path: root/nexus/src/main/kotlin/tech
diff options
context:
space:
mode:
authorAntoine A <>2024-05-02 13:44:04 +0900
committerAntoine A <>2024-05-02 13:44:04 +0900
commit8f18b1b5c872a6e83d52539e88fafc89d5dba7a9 (patch)
treebde8f82fdd48ad8461e9ef9e176afced0e3221bb /nexus/src/main/kotlin/tech
parentc928ab9e189020c2d150d42ecb51ceb618412c19 (diff)
downloadlibeufin-8f18b1b5c872a6e83d52539e88fafc89d5dba7a9.tar.gz
libeufin-8f18b1b5c872a6e83d52539e88fafc89d5dba7a9.tar.bz2
libeufin-8f18b1b5c872a6e83d52539e88fafc89d5dba7a9.zip
nexus: remove convert-backup testing command
Diffstat (limited to 'nexus/src/main/kotlin/tech')
-rw-r--r--nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt99
1 files changed, 1 insertions, 98 deletions
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
index b3153a8e..68c8aa80 100644
--- 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