Hi I would need help with FakeKMS ... don't unders...
# http4k
n
Hi I would need help with FakeKMS ... don't understand how to use it. The example in http4k-connect uses it along with another KMSEncrypt server ... don't understand why the two are needed ..
my use case is: i only read from KMS, so I would like to put, in test, my test values into the fake...
d
well what do you want to do>
encrypt/decrypt or sign.verify?
you don't want SecretsManager by any chance>?
n
Well I thought kms and secretsmanager were the same thing .... ehm ..
d
erm - no! 🙂
KMS is for key management (the K and the M) 😂
n
I see ... sorry!
but is there a wrapper for secrets manager in http4k connect?
d
certainly is!
you can create/get etc..
n
ehm .. is there an example ... somewhere ?
d
Copy code
`nst val USE_REAL_CLIENT = false

fun main() {
    // we can connect to the real service or the fake (drop in replacement)
    val http: HttpHandler = if (USE_REAL_CLIENT) JavaHttpClient() else FakeSecretsManager()

    // create a client
    val client =
        SecretsManager.Http(Region.of("us-east-1"), { AwsCredentials("accessKeyId", "secretKey") }, http.debug())

    val secretId = SecretId.of("a-secret-id")

    // all operations return a Result monad of the API type
    val createdSecretResult: Result<CreatedSecret, RemoteFailure> =
        client.createSecret(secretId.value, UUID.randomUUID(), "value")
    println(createdSecretResult.valueOrNull())

    // get the secret value back
    println(client.getSecretValue(secretId).valueOrNull())
}
it's all in the README 🙂
n
ah haven't read it
thanks a lot
d
NP 🙂