Minor improvements and version bumps
This commit is contained in:
parent
a245288359
commit
a8addf946b
@ -8,11 +8,10 @@ buildscript {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.github.ben-manes.versions' version '0.14.0'
|
id 'com.github.ben-manes.versions' version '0.15.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
subprojects {
|
subprojects {
|
||||||
apply plugin: 'java'
|
|
||||||
apply plugin: 'kotlin'
|
apply plugin: 'kotlin'
|
||||||
apply plugin: 'maven'
|
apply plugin: 'maven'
|
||||||
apply plugin: 'signing'
|
apply plugin: 'signing'
|
||||||
@ -21,6 +20,7 @@ subprojects {
|
|||||||
apply plugin: 'com.github.ben-manes.versions'
|
apply plugin: 'com.github.ben-manes.versions'
|
||||||
|
|
||||||
sourceCompatibility = 1.7
|
sourceCompatibility = 1.7
|
||||||
|
targetCompatibility = 1.7
|
||||||
group = 'ch.dissem.jabit'
|
group = 'ch.dissem.jabit'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
@ -28,7 +28,7 @@ subprojects {
|
|||||||
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
|
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"
|
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
|
||||||
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,6 @@ dependencies {
|
|||||||
compile 'ch.dissem.msgpack:msgpack:1.0.0'
|
compile 'ch.dissem.msgpack:msgpack:1.0.0'
|
||||||
testCompile 'junit:junit:4.12'
|
testCompile 'junit:junit:4.12'
|
||||||
testCompile 'org.hamcrest:hamcrest-library:1.3'
|
testCompile 'org.hamcrest:hamcrest-library:1.3'
|
||||||
testCompile 'com.nhaarman:mockito-kotlin:1.4.0'
|
testCompile 'com.nhaarman:mockito-kotlin:1.5.0'
|
||||||
testCompile project(':cryptography-bc')
|
testCompile project(':cryptography-bc')
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,6 @@ data class NetworkMessage(
|
|||||||
return byteArrayOf(d[0], d[1], d[2], d[3])
|
return byteArrayOf(d[0], d[1], d[2], d[3])
|
||||||
}
|
}
|
||||||
|
|
||||||
@Throws(IOException::class)
|
|
||||||
override fun write(out: OutputStream) {
|
override fun write(out: OutputStream) {
|
||||||
// magic
|
// magic
|
||||||
Encode.int32(MAGIC, out)
|
Encode.int32(MAGIC, out)
|
||||||
|
@ -36,14 +36,14 @@ import java.util.*
|
|||||||
import java.util.Collections
|
import java.util.Collections
|
||||||
import kotlin.collections.HashSet
|
import kotlin.collections.HashSet
|
||||||
|
|
||||||
internal fun message(encoding: Plaintext.Encoding, subject: String, body: String): ByteArray = when (encoding) {
|
private fun message(encoding: Plaintext.Encoding, subject: String, body: String): ByteArray = when (encoding) {
|
||||||
SIMPLE -> "Subject:$subject\nBody:$body".toByteArray()
|
SIMPLE -> "Subject:$subject\nBody:$body".toByteArray()
|
||||||
EXTENDED -> Message.Builder().subject(subject).body(body).build().zip()
|
EXTENDED -> Message.Builder().subject(subject).body(body).build().zip()
|
||||||
TRIVIAL -> (subject + body).toByteArray()
|
TRIVIAL -> (subject + body).toByteArray()
|
||||||
IGNORE -> ByteArray(0)
|
IGNORE -> ByteArray(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun ackData(type: Plaintext.Type, ackData: ByteArray?): ByteArray? {
|
private fun ackData(type: Plaintext.Type, ackData: ByteArray?): ByteArray? {
|
||||||
if (ackData != null) {
|
if (ackData != null) {
|
||||||
return ackData
|
return ackData
|
||||||
} else if (type == MSG) {
|
} else if (type == MSG) {
|
||||||
@ -54,7 +54,7 @@ internal fun ackData(type: Plaintext.Type, ackData: ByteArray?): ByteArray? {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The unencrypted message to be sent by 'msg' or 'broadcast'.
|
* A plaintext message before encryption or after decryption.
|
||||||
*/
|
*/
|
||||||
class Plaintext private constructor(
|
class Plaintext private constructor(
|
||||||
val type: Type,
|
val type: Type,
|
||||||
@ -464,7 +464,7 @@ class Plaintext private constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun removeLabel(type: Label.Type) {
|
fun removeLabel(type: Label.Type) {
|
||||||
labels.removeIf { it.type == type }
|
labels.removeAll { it.type == type }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isUnread(): Boolean {
|
fun isUnread(): Boolean {
|
||||||
|
@ -21,11 +21,11 @@ import java.util.*
|
|||||||
|
|
||||||
data class Label(
|
data class Label(
|
||||||
private val label: String,
|
private val label: String,
|
||||||
val type: Label.Type?,
|
val type: Label.Type? = null,
|
||||||
/**
|
/**
|
||||||
* RGBA representation for the color.
|
* RGBA representation for the color.
|
||||||
*/
|
*/
|
||||||
var color: Int
|
var color: Int = 0
|
||||||
) : Serializable {
|
) : Serializable {
|
||||||
|
|
||||||
var id: Any? = null
|
var id: Any? = null
|
||||||
|
@ -111,7 +111,6 @@ abstract class AbstractCryptography protected constructor(@JvmField protected va
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Throws(GeneralSecurityException::class)
|
|
||||||
protected fun doSign(data: ByteArray, privKey: java.security.PrivateKey): ByteArray {
|
protected fun doSign(data: ByteArray, privKey: java.security.PrivateKey): ByteArray {
|
||||||
// TODO: change this to ALGORITHM_EVP_SHA256 once it's generally used in the network
|
// TODO: change this to ALGORITHM_EVP_SHA256 once it's generally used in the network
|
||||||
val sig = Signature.getInstance(ALGORITHM_ECDSA_SHA1, provider)
|
val sig = Signature.getInstance(ALGORITHM_ECDSA_SHA1, provider)
|
||||||
@ -121,7 +120,6 @@ abstract class AbstractCryptography protected constructor(@JvmField protected va
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Throws(GeneralSecurityException::class)
|
|
||||||
protected fun doCheckSignature(data: ByteArray, signature: ByteArray, publicKey: PublicKey): Boolean {
|
protected fun doCheckSignature(data: ByteArray, signature: ByteArray, publicKey: PublicKey): Boolean {
|
||||||
for (algorithm in arrayOf(ALGORITHM_ECDSA_SHA1, ALGORITHM_EVP_SHA256)) {
|
for (algorithm in arrayOf(ALGORITHM_ECDSA_SHA1, ALGORITHM_EVP_SHA256)) {
|
||||||
val sig = Signature.getInstance(algorithm, provider)
|
val sig = Signature.getInstance(algorithm, provider)
|
||||||
|
@ -12,8 +12,8 @@ uploadArchives {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(':core')
|
compile project(':core')
|
||||||
compile 'org.bouncycastle:bcprov-jdk15on:1.56'
|
compile 'org.bouncycastle:bcprov-jdk15on:1.57'
|
||||||
testCompile 'junit:junit:4.12'
|
testCompile 'junit:junit:4.12'
|
||||||
testCompile 'org.mockito:mockito-core:2.7.21'
|
testCompile 'com.nhaarman:mockito-kotlin:1.5.0'
|
||||||
testCompile project(path: ':core', configuration: 'testArtifacts')
|
testCompile project(path: ':core', configuration: 'testArtifacts')
|
||||||
}
|
}
|
||||||
|
@ -12,8 +12,8 @@ uploadArchives {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(':core')
|
compile project(':core')
|
||||||
compile 'com.madgag.spongycastle:prov:1.54.0.0'
|
compile 'com.madgag.spongycastle:prov:1.56.0.0'
|
||||||
testCompile 'junit:junit:4.12'
|
testCompile 'junit:junit:4.12'
|
||||||
testCompile 'org.mockito:mockito-core:2.7.21'
|
testCompile 'com.nhaarman:mockito-kotlin:1.5.0'
|
||||||
testCompile project(path: ':core', configuration: 'testArtifacts')
|
testCompile project(path: ':core', configuration: 'testArtifacts')
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ uploadArchives {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sourceCompatibility = 1.8
|
sourceCompatibility = 1.8
|
||||||
|
targetCompatibility = 1.8
|
||||||
|
|
||||||
test.enabled = Boolean.valueOf(systemTestsEnabled)
|
test.enabled = Boolean.valueOf(systemTestsEnabled)
|
||||||
|
|
||||||
@ -30,8 +31,8 @@ dependencies {
|
|||||||
compile project(':wif')
|
compile project(':wif')
|
||||||
compile 'org.slf4j:slf4j-simple:1.7.25'
|
compile 'org.slf4j:slf4j-simple:1.7.25'
|
||||||
compile 'args4j:args4j:2.33'
|
compile 'args4j:args4j:2.33'
|
||||||
compile 'com.h2database:h2:1.4.194'
|
compile 'com.h2database:h2:1.4.196'
|
||||||
compile 'org.apache.commons:commons-lang3:3.5'
|
compile 'org.apache.commons:commons-lang3:3.6'
|
||||||
testCompile 'junit:junit:4.12'
|
testCompile 'junit:junit:4.12'
|
||||||
testCompile 'com.nhaarman:mockito-kotlin:1.4.0'
|
testCompile 'com.nhaarman:mockito-kotlin:1.5.0'
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ dependencies {
|
|||||||
compile project(':core')
|
compile project(':core')
|
||||||
testCompile 'junit:junit:4.12'
|
testCompile 'junit:junit:4.12'
|
||||||
testCompile 'org.slf4j:slf4j-simple:1.7.25'
|
testCompile 'org.slf4j:slf4j-simple:1.7.25'
|
||||||
testCompile 'org.mockito:mockito-core:2.7.21'
|
testCompile 'com.nhaarman:mockito-kotlin:1.5.0'
|
||||||
testCompile project(path: ':core', configuration: 'testArtifacts')
|
testCompile project(path: ':core', configuration: 'testArtifacts')
|
||||||
testCompile project(':cryptography-bc')
|
testCompile project(':cryptography-bc')
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ dependencies {
|
|||||||
compile project(':core')
|
compile project(':core')
|
||||||
testCompile 'junit:junit:4.12'
|
testCompile 'junit:junit:4.12'
|
||||||
testCompile 'org.slf4j:slf4j-simple:1.7.25'
|
testCompile 'org.slf4j:slf4j-simple:1.7.25'
|
||||||
testCompile 'com.nhaarman:mockito-kotlin:1.4.0'
|
testCompile 'com.nhaarman:mockito-kotlin:1.5.0'
|
||||||
testCompile project(path: ':core', configuration: 'testArtifacts')
|
testCompile project(path: ':core', configuration: 'testArtifacts')
|
||||||
testCompile project(':cryptography-bc')
|
testCompile project(':cryptography-bc')
|
||||||
}
|
}
|
||||||
|
@ -10,14 +10,12 @@ uploadArchives {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceCompatibility = 1.8
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(':core')
|
compile project(':core')
|
||||||
compile 'org.flywaydb:flyway-core:4.1.2'
|
compile 'org.flywaydb:flyway-core:4.2.0'
|
||||||
testCompile 'junit:junit:4.12'
|
testCompile 'junit:junit:4.12'
|
||||||
testCompile 'com.h2database:h2:1.4.194'
|
testCompile 'com.h2database:h2:1.4.196'
|
||||||
testCompile 'com.nhaarman:mockito-kotlin:1.4.0'
|
testCompile 'com.nhaarman:mockito-kotlin:1.5.0'
|
||||||
testCompile project(path: ':core', configuration: 'testArtifacts')
|
testCompile project(path: ':core', configuration: 'testArtifacts')
|
||||||
testCompile project(':cryptography-bc')
|
testCompile project(':cryptography-bc')
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@ class JdbcInventory(config: JdbcConfig) : JdbcHelper(config), Inventory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (c in cache.values) {
|
for (c in cache.values) {
|
||||||
c.entries.removeIf { e -> e.value < now - 5 * MINUTE }
|
c.entries.removeAll { e -> e.value < now - 5 * MINUTE }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,7 +235,6 @@ class JdbcMessageRepository(private val config: JdbcConfig) : AbstractMessageRep
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Throws(SQLException::class, IOException::class)
|
|
||||||
private fun update(connection: Connection, message: Plaintext) {
|
private fun update(connection: Connection, message: Plaintext) {
|
||||||
connection.prepareStatement(
|
connection.prepareStatement(
|
||||||
"UPDATE Message SET iv=?, type=?, sender=?, recipient=?, data=?, ack_data=?, sent=?, received=?, " +
|
"UPDATE Message SET iv=?, type=?, sender=?, recipient=?, data=?, ack_data=?, sent=?, received=?, " +
|
||||||
|
@ -14,7 +14,6 @@ dependencies {
|
|||||||
compile project(':core')
|
compile project(':core')
|
||||||
compile 'org.ini4j:ini4j:0.5.4'
|
compile 'org.ini4j:ini4j:0.5.4'
|
||||||
testCompile 'junit:junit:4.12'
|
testCompile 'junit:junit:4.12'
|
||||||
testCompile 'org.mockito:mockito-core:2.7.21'
|
testCompile 'com.nhaarman:mockito-kotlin:1.5.0'
|
||||||
testCompile 'com.nhaarman:mockito-kotlin:1.4.0'
|
|
||||||
testCompile project(':cryptography-bc')
|
testCompile project(':cryptography-bc')
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user