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 <gpe@openrs2.org>
Graham 4 years ago
parent 7e8883b430
commit 7eae597892
  1. 1
      conf/build.gradle.kts
  2. 5
      conf/src/main/kotlin/org/openrs2/conf/ConfigModule.kt
  3. 3
      conf/src/main/kotlin/org/openrs2/conf/RsaKeyProvider.kt
  4. 6
      crypto/src/main/kotlin/org/openrs2/crypto/CryptoModule.kt
  5. 1
      patcher/build.gradle.kts

@ -4,6 +4,7 @@ plugins {
} }
dependencies { dependencies {
api(projects.crypto)
api(libs.guice) api(libs.guice)
implementation(projects.yaml) implementation(projects.yaml)

@ -2,6 +2,7 @@ package org.openrs2.conf
import com.google.inject.AbstractModule import com.google.inject.AbstractModule
import com.google.inject.Scopes import com.google.inject.Scopes
import org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters
import org.openrs2.yaml.YamlModule import org.openrs2.yaml.YamlModule
public object ConfigModule : AbstractModule() { public object ConfigModule : AbstractModule() {
@ -11,5 +12,9 @@ public object ConfigModule : AbstractModule() {
bind(Config::class.java) bind(Config::class.java)
.toProvider(ConfigProvider::class.java) .toProvider(ConfigProvider::class.java)
.`in`(Scopes.SINGLETON) .`in`(Scopes.SINGLETON)
bind(RSAPrivateCrtKeyParameters::class.java)
.toProvider(RsaKeyProvider::class.java)
.`in`(Scopes.SINGLETON)
} }
} }

@ -1,6 +1,7 @@
package org.openrs2.crypto package org.openrs2.conf
import org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters import org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters
import org.openrs2.crypto.Rsa
import java.nio.file.Files import java.nio.file.Files
import java.nio.file.Path import java.nio.file.Path
import javax.inject.Provider import javax.inject.Provider

@ -2,16 +2,10 @@ package org.openrs2.crypto
import com.fasterxml.jackson.databind.Module import com.fasterxml.jackson.databind.Module
import com.google.inject.AbstractModule import com.google.inject.AbstractModule
import com.google.inject.Scopes
import com.google.inject.multibindings.Multibinder import com.google.inject.multibindings.Multibinder
import org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters
public object CryptoModule : AbstractModule() { public object CryptoModule : AbstractModule() {
override fun configure() { override fun configure() {
bind(RSAPrivateCrtKeyParameters::class.java)
.toProvider(RsaKeyProvider::class.java)
.`in`(Scopes.SINGLETON)
Multibinder.newSetBinder(binder(), Module::class.java) Multibinder.newSetBinder(binder(), Module::class.java)
.addBinding().to(CryptoJacksonModule::class.java) .addBinding().to(CryptoJacksonModule::class.java)
} }

@ -14,7 +14,6 @@ dependencies {
api(libs.guice) api(libs.guice)
implementation(projects.conf) implementation(projects.conf)
implementation(projects.crypto)
implementation(projects.inject) implementation(projects.inject)
implementation(libs.openrs2.natives) implementation(libs.openrs2.natives)
} }

Loading…
Cancel
Save