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

Remove CWT Proofs #213

Merged
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ and requires the use of a suitable OAUTH2 server.
| [Credential Issuer MetaData](#credential-issuer-metadata) | Yes, using `scopes` |
| Batch Endpoint | ❌ |
| Deferred Endpoint | ✅ |
| Proof | ✅ JWT (`jwk`, `x5c`, `did:key`, `did:jwk`) , ❌ CWT |
| Proof | ✅ JWT (`jwk`, `x5c`, `did:key`, `did:jwk`) |

## How to use docker

Expand Down
3 changes: 0 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@ dependencies {
implementation(libs.keycloak.admin.client) {
because("To be able to fetch user attributes")
}
implementation(libs.authlete.cbor) {
because("To implement CWT proof")
}
implementation(libs.waltid.mdoc.credentials) {
because("To sign CBOR credentials")
}
Expand Down
3 changes: 0 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@ dependencyCheck = "10.0.3"
sonarqube = "5.0.0.4638"
bootstrap = "5.3.3"
jacoco = "0.8.11"

multiformat = "1.1.0"
resultMonad = "1.4.0"
keycloak = "25.0.1"
waltid = "0.3.1"
uri-kmp = "0.0.18"
authlete-cbor = "1.18"
zxing = "3.5.3"

[libraries]
Expand All @@ -44,7 +42,6 @@ result-monad = { module = "org.erwinkok.result:result-monad", version.ref = "res
keycloak-admin-client = { module = "org.keycloak:keycloak-admin-client", version.ref = "keycloak" }
waltid-mdoc-credentials = { module = "id.walt:waltid-mdoc-credentials-jvm", version.ref = "waltid" }
uri-kmp = { module = "com.eygraber:uri-kmp", version.ref = "uri-kmp" }
authlete-cbor = { module = "com.authlete:cbor", version.ref = "authlete-cbor" }
babisRoutis marked this conversation as resolved.
Show resolved Hide resolved
zxing = { module = "com.google.zxing:javase", version.ref = "zxing" }

[plugins]
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,11 @@ class ValidateProof(
fun jwt(jwt: UnvalidatedProof.Jwt): CredentialKey =
validateJwtProof(credentialIssuerId, jwt, expectedCNonce, credentialConfiguration)

fun cwt(cwt: UnvalidatedProof.Cwt): CredentialKey =
validateCwtProof(credentialIssuerId, cwt, expectedCNonce, credentialConfiguration)

fun ldpVp(ldpVp: UnvalidatedProof.LdpVp): CredentialKey =
raise(InvalidProof("Supporting only JWT proof"))

return when (unvalidatedProof) {
is UnvalidatedProof.Jwt -> jwt(unvalidatedProof)
is UnvalidatedProof.Cwt -> cwt(unvalidatedProof)
is UnvalidatedProof.LdpVp -> ldpVp(unvalidatedProof)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,6 @@ val MobileDrivingLicenceV1: MsoMdocCredentialConfiguration =
ProofType.Jwt(
signingAlgorithmsSupported = nonEmptySetOf(JWSAlgorithm.ES256),
),
ProofType.Cwt(
algorithms = nonEmptySetOf(CoseAlgorithm.ES256),
curves = nonEmptySetOf(CoseCurve.P_256),
),
),
),
policy = MsoMdocPolicy(oneTimeUse = false, batchSize = 2),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,6 @@ val PidMsoMdocV1: MsoMdocCredentialConfiguration =
proofTypesSupported = ProofTypesSupported(
nonEmptySetOf(
ProofType.Jwt(nonEmptySetOf(JWSAlgorithm.ES256)),
ProofType.Cwt(
algorithms = nonEmptySetOf(CoseAlgorithm.ES256),
curves = nonEmptySetOf(CoseCurve.P_256),
),
),
),
policy = MsoMdocPolicy(oneTimeUse = true),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,13 @@ sealed interface ProofType {
* A JWT is used as proof of possession.
*/
data class Jwt(val signingAlgorithmsSupported: NonEmptySet<JWSAlgorithm>) : ProofType

/**
* A CWT is used as proof of possession.
*/
data class Cwt(val algorithms: NonEmptySet<CoseAlgorithm>, val curves: NonEmptySet<CoseCurve>) : ProofType
}

fun ProofType.type(): ProofTypeEnum = when (this) {
is ProofType.Cwt -> ProofTypeEnum.CWT
is ProofType.Jwt -> ProofTypeEnum.JWT
}
enum class ProofTypeEnum {
JWT, CWT
JWT,
}

@JvmInline
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ sealed interface UnvalidatedProof {
*/
data class Jwt(val jwt: String) : UnvalidatedProof

/**
* Proof of possession using a CWT.
*/
data class Cwt(val cwt: String) : UnvalidatedProof

/**
* Proof of possession using a W3C Verifiable Presentation object signed using the Data Integrity Proof.
*/
Expand Down
52 changes: 0 additions & 52 deletions src/main/kotlin/eu/europa/ec/eudi/pidissuer/domain/Types.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
package eu.europa.ec.eudi.pidissuer.domain

import com.authlete.cose.constants.COSEAlgorithms
import com.authlete.cose.constants.COSEEllipticCurves
import com.nimbusds.jose.jwk.JWK
import org.slf4j.LoggerFactory
import java.net.MalformedURLException
Expand Down Expand Up @@ -123,53 +121,3 @@ data class IssuedCredential(
*/
@JvmInline
value class CredentialIdentifier(val value: String)

@JvmInline
value class CoseAlgorithm private constructor(val value: Int) {

fun name(): String =
checkNotNull(COSEAlgorithms.getNameByValue(value)) { "Cannot find name for COSE algorithm $value" }

companion object {

val ES256 = CoseAlgorithm(COSEAlgorithms.ES256)
val ES384 = CoseAlgorithm(COSEAlgorithms.ES384)
val ES512 = CoseAlgorithm(COSEAlgorithms.ES512)

operator fun invoke(value: Int): Result<CoseAlgorithm> = runCatching {
require(COSEAlgorithms.getNameByValue(value) != null) { "Unsupported COSE algorithm $value" }
CoseAlgorithm(value)
}

operator fun invoke(name: String): Result<CoseAlgorithm> = runCatching {
val value = COSEAlgorithms.getValueByName(name)
require(value != 0) { "Unsupported COSE algorithm $name" }
CoseAlgorithm(value)
}
}
}

@JvmInline
value class CoseCurve private constructor(val value: Int) {

fun name(): String =
checkNotNull(COSEEllipticCurves.getNameByValue(value)) { "Cannot find name for COSE Curve $value" }

companion object {

val P_256 = CoseCurve(COSEEllipticCurves.P_256)
val P_384 = CoseCurve(COSEEllipticCurves.P_384)
val P_521 = CoseCurve(COSEEllipticCurves.P_521)

operator fun invoke(value: Int): Result<CoseCurve> = runCatching {
require(COSEEllipticCurves.getNameByValue(value) != null) { "Unsupported COSE Curve $value" }
CoseCurve(value)
}

operator fun invoke(name: String): Result<CoseCurve> = runCatching {
val value = COSEEllipticCurves.getValueByName(name)
require(value != 0) { "Unsupported COSE Curve $name" }
CoseCurve(value)
}
}
}
Loading
Loading