[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [libeufin] branch master updated: DB initial design
From: |
gnunet |
Subject: |
[GNUnet-SVN] [libeufin] branch master updated: DB initial design |
Date: |
Wed, 25 Sep 2019 00:29:47 +0200 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository libeufin.
The following commit(s) were added to refs/heads/master by this push:
new 6970eca DB initial design
6970eca is described below
commit 6970eca6648067bf7100ec40b74fde42e668896e
Author: Marcello Stanisci <address@hidden>
AuthorDate: Wed Sep 25 00:29:41 2019 +0200
DB initial design
---
src/main/kotlin/Main.kt | 2 +
src/main/kotlin/tech/libeufin/DB.kt | 120 +++++++++++++++++++++++++++++++++++-
2 files changed, 119 insertions(+), 3 deletions(-)
diff --git a/src/main/kotlin/Main.kt b/src/main/kotlin/Main.kt
index ddc5d8c..812139c 100644
--- a/src/main/kotlin/Main.kt
+++ b/src/main/kotlin/Main.kt
@@ -32,6 +32,8 @@ import tech.libeufin.messages.HEVResponseDataType
import tech.libeufin.messages.ProtocolAndVersion
import javax.xml.bind.JAXBElement
+enum class Foo {BAR, BAZ}
+
fun main() {
var xmlProcess = XMLTransform()
diff --git a/src/main/kotlin/tech/libeufin/DB.kt
b/src/main/kotlin/tech/libeufin/DB.kt
index 92193bf..58c6db0 100644
--- a/src/main/kotlin/tech/libeufin/DB.kt
+++ b/src/main/kotlin/tech/libeufin/DB.kt
@@ -4,8 +4,123 @@ import org.jetbrains.exposed.dao.IntIdTable
import org.jetbrains.exposed.sql.*
import org.jetbrains.exposed.sql.transactions.transaction
-object SignKeys: IntIdTable(){
- val pub = binary("pub", 50)
+const val CUSTOMER_ID_MAX_LENGTH = 20
+const val SUBSCRIBER_ID_MAX_LENGTH = 10
+const val PUBLIC_KEY_MAX_LENGTH = 256 // FIXME review this value!
+const val PRIV_KEY_MAX_LENGTH = 512 // FIXME review this value!
+
+/**
+ * All the states to give a subscriber.
+ */
+enum class SubscriberStates {
+ /**
+ * No keys at all given to the bank.
+ */
+ NEW,
+
+ /**
+ * Only INI electronic message was succesfully sent.
+ */
+ PARTIALLY_INITIALIZED_INI,
+
+ /**
+ * Only HIA electronic message was succesfully sent.
+ */
+ PARTIALLY_INITIALIZED_HIA,
+
+ /**
+ * Both INI and HIA were electronically sent with success.
+ */
+ INITIALIZED,
+
+ /**
+ * All the keys accounted in INI and HIA have been confirmed
+ * via physical mail.
+ */
+ READY
+}
+
+/**
+ * All the states that one key can be assigned.
+ */
+enum class KeyStates {
+
+ /**
+ * The key was never communicated.
+ */
+ MISSING,
+
+ /**
+ * The key has been electronically sent.
+ */
+ NEW,
+
+ /**
+ * The key has been confirmed (either via physical mail
+ * or electronically -- e.g. with certificates)
+ */
+ RELEASED
+}
+
+
+
+/**
+ * This table information *not* related to EBICS, for all
+ * its customers.
+ */
+object Customer: IntIdTable() {
+ val customerId: Column<String> = varchar(
+ "customerId",
+ CUSTOMER_ID_MAX_LENGTH).primaryKey()
+}
+
+/**
+ * This table maps customers with EBICS subscribers.
+ */
+object CustomerSubscriberMap: IntIdTable(){
+ val customerId = reference("customerId", Customer)
+ val subscriberId = reference("subscriberId", Subscriber)
+}
+
+/**
+ * This table defines a EBICS subscriber.
+ */
+object Subscriber: IntIdTable(){
+ // is EBICS 'subscriber' ID?
+ val subscriberId: Column<String> = varchar(
+ "subscriberId",
+ SUBSCRIBER_ID_MAX_LENGTH).primaryKey()
+
+ val state = customEnumeration(
+ "state",
+ "ENUM('NEW', 'PARTIALLI_INITIALIZED_INI', 'PARTIALLY_INITIALIZED_HIA',
'INITIALIZED', 'READY')",
+ {SubscriberStates.values()[it as Int]},
+ {it.name}
+ )
+
+ val signatureKey = reference("signatureKey", EBICSPublicKEy)
+ val encryptionKey = reference("encryptionKey", EBICSPublicKEy)
+ val authorizationKey = reference("authorizationKey", EBICSPublicKEy)
+}
+
+/**
+ * This table stores RSA public keys.
+ */
+object EBICSPublicKEy: IntIdTable(){
+ val pub = binary("pub", PUBLIC_KEY_MAX_LENGTH)
+ val state = stringLiteral("state")
+}
+
+/**
+ * This table stores RSA private keys.
+ */
+object EBICSPrivateKEy: IntIdTable(){
+ val pub = binary("priv", PRIV_KEY_MAX_LENGTH)
+ val state = customEnumeration(
+ "state",
+ "ENUM('MISSING', 'NEW', 'RELEASED')",
+ {KeyStates.values()[it as Int]},
+ {it.name})
}
fun db() {
@@ -13,6 +128,5 @@ fun db() {
transaction {
addLogger(StdOutSqlLogger)
- SchemaUtils.create(SignKeys)
}
}
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
address@hidden.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [libeufin] branch master updated: DB initial design,
gnunet <=