diff --git a/src/main/kotlin/mdnet/netty/Keys.kt b/src/main/kotlin/mdnet/netty/Keys.kt index f246596..c239941 100644 --- a/src/main/kotlin/mdnet/netty/Keys.kt +++ b/src/main/kotlin/mdnet/netty/Keys.kt @@ -24,6 +24,27 @@ import java.security.PrivateKey import java.security.spec.InvalidKeySpecException import java.security.spec.PKCS8EncodedKeySpec +// The code below is adapted from from https://github.com/Mastercard/client-encryption-java/blob/master/src/main/java/com/mastercard/developer/utils/EncryptionUtils.java +// +// Copyright (c) 2019 Mastercard +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. private const val PKCS_1_PEM_HEADER = "-----BEGIN RSA PRIVATE KEY-----" private const val PKCS_1_PEM_FOOTER = "-----END RSA PRIVATE KEY-----" private const val PKCS_8_PEM_HEADER = "-----BEGIN PRIVATE KEY-----" diff --git a/src/main/kotlin/mdnet/server/ImageServer.kt b/src/main/kotlin/mdnet/server/ImageServer.kt index 20a7683..4d569c1 100644 --- a/src/main/kotlin/mdnet/server/ImageServer.kt +++ b/src/main/kotlin/mdnet/server/ImageServer.kt @@ -78,7 +78,6 @@ private val JACKSON: ObjectMapper = jacksonObjectMapper() class ImageServer( private val storage: ImageStorage, - private val statistics: AtomicReference, private val client: HttpHandler, registry: PrometheusMeterRegistry ) { @@ -268,7 +267,6 @@ fun getServer( val imageServer = ImageServer( storage = storage, - statistics = statistics, client = client, registry = registry ) diff --git a/src/test/kotlin/mdnet/server/ImageServerTest.kt b/src/test/kotlin/mdnet/server/ImageServerTest.kt index 1c1c45d..4e91a54 100644 --- a/src/test/kotlin/mdnet/server/ImageServerTest.kt +++ b/src/test/kotlin/mdnet/server/ImageServerTest.kt @@ -32,7 +32,6 @@ import io.mockk.mockk import io.mockk.verify import kotlinx.coroutines.delay import mdnet.cache.ImageStorage -import mdnet.data.Statistics import mdnet.security.TweetNaclFast import org.apache.commons.io.IOUtils import org.http4k.core.HttpHandler @@ -48,7 +47,6 @@ import org.http4k.routing.bind import org.http4k.routing.routes import org.ktorm.database.Database import java.io.ByteArrayInputStream -import java.util.concurrent.atomic.AtomicReference class ImageServerTest : FreeSpec() { override fun isolationMode() = IsolationMode.InstancePerTest @@ -76,7 +74,6 @@ class ImageServerTest : FreeSpec() { val server = ImageServer( storage, - AtomicReference(Statistics()), client, registry ) @@ -125,7 +122,6 @@ class ImageServerTest : FreeSpec() { val server = ImageServer( storage, - AtomicReference(Statistics()), client, registry ) @@ -174,7 +170,6 @@ class ImageServerTest : FreeSpec() { val server = ImageServer( storage, - AtomicReference(Statistics()), client, registry )