-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
properly decode the ciphertext into a blob using base64 decoding
- Loading branch information
Showing
3 changed files
with
59 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.dwolla.config | ||
|
||
import cats.effect.* | ||
import fs2.compression.Compression | ||
import fs2.io.file.Files | ||
import fs2.io.net.Network | ||
import org.http4s.ember.client.EmberClientBuilder | ||
import pureconfig.module.catseffect.loadF | ||
import pureconfig.{ConfigReader, ConfigSource} | ||
import smithy4s.aws.{AwsEnvironment, AwsRegion} | ||
|
||
object ExampleApp extends ResourceApp.Simple { | ||
private def reader[F[_] : Async : Compression : Files : Network] = | ||
for { | ||
httpClient <- EmberClientBuilder.default.build | ||
awsEnv <- AwsEnvironment.default[F](httpClient, AwsRegion.US_WEST_2) // TODO get region from environment | ||
secureReader <- SecureReader[F](awsEnv) | ||
} yield secureReader | ||
|
||
override def run: Resource[IO, Unit] = | ||
reader[IO].evalMap { implicit r: ConfigReader[IO[SecurableString]] => | ||
loadF[IO, Foo[IO]](ConfigSource.string( | ||
""" | ||
|foo = "SECURE: AQICAHh38+DAqADvcRLU4+t2AYhr82YbZuuFQdjdX95NTppHhwEQd+ovBiiMlelM0yL+97WRAAAAYTBfBgkqhkiG9w0BBwagUjBQAgEAMEsGCSqGSIb3DQEHATAeBglghkgBZQMEAS4wEQQMlNQWVvaAt/VACynHAgEQgB4AzBpBA1ozpJFZTIhC91Q+Emlx40gbhTFmXyqBE+g=" | ||
|""".stripMargin)) | ||
.flatTap(IO.println(_)) | ||
.flatMap(_.foo) | ||
.flatMap(IO.println(_)) | ||
} | ||
} | ||
|
||
case class Foo[F[_]](foo: F[SecurableString]) | ||
object Foo { | ||
implicit def configReader[F[_]](implicit ev: ConfigReader[F[SecurableString]]): ConfigReader[Foo[F]] = ConfigReader.forProduct1("foo")(Foo.apply[F] _) | ||
} |