Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade sd-jwt library to v0.10.0 #226

Merged
merged 1 commit into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dependencycheck = "11.1.0"
jacoco = "0.8.11"
swaggerUi = "5.18.2"
waltid = "0.9.0"
sdJwt = "0.9.0"
sdJwt = "0.10.0"

[libraries]
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutines" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package eu.europa.ec.eudi.verifier.endpoint.port.input
import arrow.core.Either
import arrow.core.getOrElse
import arrow.core.toNonEmptyListOrNull
import com.nimbusds.jwt.SignedJWT
import eu.europa.ec.eudi.sdjwt.*
import eu.europa.ec.eudi.sdjwt.vc.DefaultHttpClientFactory
import eu.europa.ec.eudi.sdjwt.vc.SdJwtVcVerifier
Expand Down Expand Up @@ -80,7 +81,7 @@ internal class ValidateSdJwtVc(
trustedIssuers: KeyStore?,
private val audience: Audience,
) {
private val verifier: SdJwtVcVerifier by lazy {
private val verifier: SdJwtVcVerifier<SignedJWT> by lazy {
val x5CShouldBe = trustedIssuers?.let {
X5CShouldBe.fromKeystore(it) {
isRevocationEnabled = false
Expand All @@ -95,7 +96,7 @@ internal class ValidateSdJwtVc(
)
} ?: false
}
SdJwtVcVerifier.usingX5cOrIssuerMetadata(
NimbusSdJwtOps.SdJwtVcVerifier.usingX5cOrIssuerMetadata(
x509CertificateTrust = x509CertificateTrust,
httpClientFactory = DefaultHttpClientFactory,
)
Expand All @@ -108,10 +109,8 @@ internal class ValidateSdJwtVc(
}

return Either.catch {
val (presentation, keyBinding) = verifier.verifyPresentation(unverified, challenge).getOrThrow()
checkNotNull(keyBinding) { "KeyBinding JWT cannot be null" }

val payload = with(DefaultSdJwtOps) {
val (presentation, _) = verifier.verify(unverified, challenge).getOrThrow()
val payload = with(NimbusSdJwtOps) {
presentation.recreateClaims(visitor = null)
}
SdJwtVcValidationResult.Valid(payload)
Expand Down
Loading