diff options
Diffstat (limited to 'src/main/kotlin/DatabaseController.kt')
-rw-r--r-- | src/main/kotlin/DatabaseController.kt | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/src/main/kotlin/DatabaseController.kt b/src/main/kotlin/DatabaseController.kt index d60f278..5316bb0 100644 --- a/src/main/kotlin/DatabaseController.kt +++ b/src/main/kotlin/DatabaseController.kt @@ -25,7 +25,6 @@ class DatabaseController { val userId = integer("userId").references(UserData.id) val accessId = varchar("accessId", 64).uniqueIndex() val isShared = bool("isShared").default(false) - val encryptIV = binary("iv", 16) // empty if directory } /** @@ -317,7 +316,7 @@ class DatabaseController { /** * Adds the uploaded file to the database */ - fun addFile(fileLocation: String, usersId: Int, isDirectoryBool: Boolean = false, iv: ByteArray = ByteArray(16)): Boolean { + fun addFile(fileLocation: String, usersId: Int, isDirectoryBool: Boolean = false): Boolean { return transaction { try { if (FileLocation.select { (FileLocation.path eq fileLocation) and (FileLocation.userId eq usersId) }.empty()) { @@ -326,7 +325,6 @@ class DatabaseController { it[userId] = usersId it[accessId] = generateRandomString() it[isDirectory] = isDirectoryBool - it[encryptIV] = iv } true } else { @@ -355,19 +353,6 @@ class DatabaseController { } /** - * Returns IV of given file - */ - fun getFileIV(fileLocation: String, userId: Int): ByteArray { - return transaction { - try { - FileLocation.select { (FileLocation.path eq fileLocation) and (FileLocation.userId eq userId) }.map { it[FileLocation.encryptIV] }[0] - } catch (err: Exception) { - ByteArray(16) - } - } - } - - /** * Returns the accessId of the given file */ fun getAccessId(fileLocation: String, userId: Int): String { @@ -519,7 +504,7 @@ class DatabaseController { } } -data class ReturnFileData ( +data class ReturnFileData( val userId: Int, val fileLocation: String, val isDirectory: Boolean |