diff options
author | Florian Dold <florian@dold.me> | 2021-01-13 16:58:39 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2021-01-13 16:58:39 +0100 |
commit | 91aeb349866471ccc06b6535df12ee7947c3a16c (patch) | |
tree | a8884857f5374368ca77c9bc10544553ec9052ad /sandbox/src/main/kotlin/tech/libeufin | |
parent | 8d39a41a1f771a950c62a9ac9584684a82c7d5ee (diff) | |
download | libeufin-91aeb349866471ccc06b6535df12ee7947c3a16c.tar.gz libeufin-91aeb349866471ccc06b6535df12ee7947c3a16c.tar.bz2 libeufin-91aeb349866471ccc06b6535df12ee7947c3a16c.zip |
sandbox cli
Diffstat (limited to 'sandbox/src/main/kotlin/tech/libeufin')
-rw-r--r-- | sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt index 69aa88b9..b030eeb0 100644 --- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt +++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt @@ -389,6 +389,8 @@ fun serverMain(dbName: String, port: Int) { } /** * Creates a new EBICS host. + * + * FIXME: This endpoint is deprecated. /hosts should be used instead. */ post("/admin/ebics/host") { val req = call.receive<EbicsHostCreateRequest>() @@ -411,6 +413,32 @@ fun serverMain(dbName: String, port: Int) { ) return@post } + + /** + * Creates a new EBICS host. + */ + post("/admin/ebics/hosts") { + val req = call.receive<EbicsHostCreateRequest>() + val pairA = CryptoUtil.generateRsaKeyPair(2048) + val pairB = CryptoUtil.generateRsaKeyPair(2048) + val pairC = CryptoUtil.generateRsaKeyPair(2048) + transaction { + EbicsHostEntity.new { + this.ebicsVersion = req.ebicsVersion + this.hostId = req.hostID + this.authenticationPrivateKey = ExposedBlob(pairA.private.encoded) + this.encryptionPrivateKey = ExposedBlob(pairB.private.encoded) + this.signaturePrivateKey = ExposedBlob(pairC.private.encoded) + } + } + call.respondText( + "Host '${req.hostID}' created.", + ContentType.Text.Plain, + HttpStatusCode.OK + ) + return@post + } + /** * Show the names of all the Ebics hosts */ |