From 7eae59789243bfdaf6049715f0a203899b4d3719 Mon Sep 17 00:00:00 2001 From: Graham Date: Fri, 21 May 2021 20:06:29 +0100 Subject: [PATCH] Move RsaKeyProvider to the config module I think this makes more sense, as we're loading it from the etc directory, just like etc/config.yaml, and it isn't required by most of the users of the crypto module. Signed-off-by: Graham --- conf/build.gradle.kts | 1 + conf/src/main/kotlin/org/openrs2/conf/ConfigModule.kt | 5 +++++ .../src/main/kotlin/org/openrs2/conf}/RsaKeyProvider.kt | 3 ++- crypto/src/main/kotlin/org/openrs2/crypto/CryptoModule.kt | 6 ------ patcher/build.gradle.kts | 1 - 5 files changed, 8 insertions(+), 8 deletions(-) rename {crypto/src/main/kotlin/org/openrs2/crypto => conf/src/main/kotlin/org/openrs2/conf}/RsaKeyProvider.kt (91%) diff --git a/conf/build.gradle.kts b/conf/build.gradle.kts index 7478ac55..73201fd4 100644 --- a/conf/build.gradle.kts +++ b/conf/build.gradle.kts @@ -4,6 +4,7 @@ plugins { } dependencies { + api(projects.crypto) api(libs.guice) implementation(projects.yaml) diff --git a/conf/src/main/kotlin/org/openrs2/conf/ConfigModule.kt b/conf/src/main/kotlin/org/openrs2/conf/ConfigModule.kt index 1a97c90b..4a5caaa1 100644 --- a/conf/src/main/kotlin/org/openrs2/conf/ConfigModule.kt +++ b/conf/src/main/kotlin/org/openrs2/conf/ConfigModule.kt @@ -2,6 +2,7 @@ package org.openrs2.conf import com.google.inject.AbstractModule import com.google.inject.Scopes +import org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters import org.openrs2.yaml.YamlModule public object ConfigModule : AbstractModule() { @@ -11,5 +12,9 @@ public object ConfigModule : AbstractModule() { bind(Config::class.java) .toProvider(ConfigProvider::class.java) .`in`(Scopes.SINGLETON) + + bind(RSAPrivateCrtKeyParameters::class.java) + .toProvider(RsaKeyProvider::class.java) + .`in`(Scopes.SINGLETON) } } diff --git a/crypto/src/main/kotlin/org/openrs2/crypto/RsaKeyProvider.kt b/conf/src/main/kotlin/org/openrs2/conf/RsaKeyProvider.kt similarity index 91% rename from crypto/src/main/kotlin/org/openrs2/crypto/RsaKeyProvider.kt rename to conf/src/main/kotlin/org/openrs2/conf/RsaKeyProvider.kt index c1da9615..c752d51c 100644 --- a/crypto/src/main/kotlin/org/openrs2/crypto/RsaKeyProvider.kt +++ b/conf/src/main/kotlin/org/openrs2/conf/RsaKeyProvider.kt @@ -1,6 +1,7 @@ -package org.openrs2.crypto +package org.openrs2.conf import org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters +import org.openrs2.crypto.Rsa import java.nio.file.Files import java.nio.file.Path import javax.inject.Provider diff --git a/crypto/src/main/kotlin/org/openrs2/crypto/CryptoModule.kt b/crypto/src/main/kotlin/org/openrs2/crypto/CryptoModule.kt index f0f748ae..f4f0cdd3 100644 --- a/crypto/src/main/kotlin/org/openrs2/crypto/CryptoModule.kt +++ b/crypto/src/main/kotlin/org/openrs2/crypto/CryptoModule.kt @@ -2,16 +2,10 @@ package org.openrs2.crypto import com.fasterxml.jackson.databind.Module import com.google.inject.AbstractModule -import com.google.inject.Scopes import com.google.inject.multibindings.Multibinder -import org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters public object CryptoModule : AbstractModule() { override fun configure() { - bind(RSAPrivateCrtKeyParameters::class.java) - .toProvider(RsaKeyProvider::class.java) - .`in`(Scopes.SINGLETON) - Multibinder.newSetBinder(binder(), Module::class.java) .addBinding().to(CryptoJacksonModule::class.java) } diff --git a/patcher/build.gradle.kts b/patcher/build.gradle.kts index 8395f2e9..e68e1128 100644 --- a/patcher/build.gradle.kts +++ b/patcher/build.gradle.kts @@ -14,7 +14,6 @@ dependencies { api(libs.guice) implementation(projects.conf) - implementation(projects.crypto) implementation(projects.inject) implementation(libs.openrs2.natives) }