commit c27be27b55184ce88feb53a21bcb0e42a0072299
parent 9f97caddceb2ff30222d4dfef79ecb4cc716c369
Author: Marcello Stanisci <stanisci.m@gmail.com>
Date: Tue, 1 Oct 2019 13:26:06 +0200
done with definition of "letter" JSON types
Diffstat:
2 files changed, 53 insertions(+), 19 deletions(-)
diff --git a/src/main/kotlin/tech/libeufin/JSON.kt b/src/main/kotlin/tech/libeufin/JSON.kt
@@ -32,9 +32,18 @@ data class CustomerEbicsInfo(
)
/**
- * Request for INI / HIA letter(s).
+ * Wrapper type around initialization letters
+ * for RSA keys.
*/
data class IniHiaLetters(
+ val INI: IniLetter,
+ val HIA: HiaLetter
+)
+
+/**
+ * Request for INI letter.
+ */
+data class IniLetter(
val userId: String,
val customerId: String,
@@ -42,28 +51,31 @@ data class IniHiaLetters(
val date: String,
val time: String,
val recipient: String,
+ val exp_length: Int,
val exponent: String,
+ val mod_length: Int,
val modulus: String,
- val hash: String,
- val INI: IniVersion,
- val HIA: HiaVersion
-)
-
-/**
- * INI specific version numbers
- */
-data class IniVersion(
- // Signature key
- val es_version: String
+ val hash: String
)
/**
- * INI specific version numbers
+ * Request for HIA letter.
*/
-data class HiaVersion(
-
- // Identification and authentication key
- val ia_version: String,
- // Encryption key
- val enc_version: String
+data class HiaLetter(
+ val userId: String,
+ val customerId: String,
+ val name: String,
+ val date: String,
+ val time: String,
+ val recipient: String,
+ val ia_exp_length: Int,
+ val ia_exponent: String,
+ val ia_mod_length: Int,
+ val ia_modulus: String,
+ val ia_hash: String,
+ val enc_exp_length: Int,
+ val enc_exponent: String,
+ val enc_mod_length: Int,
+ val enc_modulus: String,
+ val enc_hash: String
)
\ No newline at end of file
diff --git a/src/main/kotlin/tech/libeufin/Main.kt b/src/main/kotlin/tech/libeufin/Main.kt
@@ -138,6 +138,28 @@ fun main() {
call.respond(HttpStatusCode.OK, customerInfo)
}
+ post("/admin/customers/{id}/ebics/keyletter") {
+ val body = try {
+ call.receive<IniHiaLetters>()
+ } catch (e: Exception) {
+ e.printStackTrace()
+ call.respond(
+ HttpStatusCode.BadRequest,
+ SandboxError(e.message.toString())
+ )
+ return@post
+ }
+ logger.info(body.toString())
+
+ /**********************************************/
+
+ // Extract keys and compare them to what was
+ // received via the INI and HIA orders.
+
+ /**********************************************/
+
+ }
+
post("/ebicsweb") {
val body: String = call.receiveText()
logger.debug("Body: $body")