Update jwt-circe

This commit is contained in:
eikek 2023-11-05 23:15:52 +01:00
parent bf0f692cd9
commit 9ecd11ed7f
2 changed files with 18 additions and 18 deletions

View File

@ -32,7 +32,7 @@ object SignatureAlgo {
case object ES256 extends SignatureAlgo case object ES256 extends SignatureAlgo
case object ES384 extends SignatureAlgo case object ES384 extends SignatureAlgo
case object ES512 extends SignatureAlgo case object ES512 extends SignatureAlgo
case object Ed25519 extends SignatureAlgo case object EdDSA extends SignatureAlgo
case object HMD5 extends SignatureAlgo case object HMD5 extends SignatureAlgo
case object HS224 extends SignatureAlgo case object HS224 extends SignatureAlgo
@ -48,7 +48,7 @@ object SignatureAlgo {
ES256, ES256,
ES384, ES384,
ES512, ES512,
Ed25519, EdDSA,
HMD5, HMD5,
HS224, HS224,
HS256, HS256,
@ -58,19 +58,19 @@ object SignatureAlgo {
def fromString(str: String): Either[String, SignatureAlgo] = def fromString(str: String): Either[String, SignatureAlgo] =
str.toUpperCase() match { str.toUpperCase() match {
case "RS256" => Right(RS256) case "RS256" => Right(RS256)
case "RS384" => Right(RS384) case "RS384" => Right(RS384)
case "RS512" => Right(RS512) case "RS512" => Right(RS512)
case "ES256" => Right(ES256) case "ES256" => Right(ES256)
case "ES384" => Right(ES384) case "ES384" => Right(ES384)
case "ES512" => Right(ES512) case "ES512" => Right(ES512)
case "ED25519" => Right(Ed25519) case "EDDSA" => Right(EdDSA)
case "HMD5" => Right(HMD5) case "HMD5" => Right(HMD5)
case "HS224" => Right(HS224) case "HS224" => Right(HS224)
case "HS256" => Right(HS256) case "HS256" => Right(HS256)
case "HS384" => Right(HS384) case "HS384" => Right(HS384)
case "HS512" => Right(HS512) case "HS512" => Right(HS512)
case _ => Left(s"Unknown signature algo: $str") case _ => Left(s"Unknown signature algo: $str")
} }
def unsafeFromString(str: String): SignatureAlgo = def unsafeFromString(str: String): SignatureAlgo =
@ -127,11 +127,11 @@ object SignatureAlgo {
.toEither .toEither
} yield Jwt.create(decoded) } yield Jwt.create(decoded)
case Ed25519 => case EdDSA =>
for { for {
pubKey <- createPublicKey(sigKey, "EdDSA") pubKey <- createPublicKey(sigKey, "EdDSA")
decoded <- JwtCirce decoded <- JwtCirce
.decodeJsonAll(token, pubKey, Seq(JwtAlgorithm.Ed25519)) .decodeJsonAll(token, pubKey, Seq(JwtAlgorithm.EdDSA))
.toEither .toEither
} yield Jwt.create(decoded) } yield Jwt.create(decoded)

View File

@ -26,7 +26,7 @@ object Dependencies {
val Icu4jVersion = "74.1" val Icu4jVersion = "74.1"
val JavaOtpVersion = "0.4.0" val JavaOtpVersion = "0.4.0"
val JsoupVersion = "1.16.2" val JsoupVersion = "1.16.2"
val JwtScalaVersion = "9.2.0" val JwtScalaVersion = "9.4.4"
val KindProjectorVersion = "0.10.3" val KindProjectorVersion = "0.10.3"
val KittensVersion = "3.1.0" val KittensVersion = "3.1.0"
val LevigoJbig2Version = "2.0" val LevigoJbig2Version = "2.0"