From 42af9e5295d178925d80a4ddcd19df5569478ab0 Mon Sep 17 00:00:00 2001 From: waltkb <68587968+waltkb@users.noreply.github.com> Date: Wed, 30 Aug 2023 11:41:29 +0200 Subject: [PATCH] Upgrade ktor, hoplite --- build.gradle.kts | 22 ++--- .../services/ecosystems/cheqd/CheqdService.kt | 10 ++- .../id/walt/services/jwt/WaltIdJwtService.kt | 2 +- ...plate-VerifiableDiploma-1677576124951.json | 83 ------------------- vc-template-VerifiableId-1677576065840.json | 49 ----------- 5 files changed, 18 insertions(+), 148 deletions(-) delete mode 100644 vc-template-VerifiableDiploma-1677576124951.json delete mode 100644 vc-template-VerifiableId-1677576065840.json diff --git a/build.gradle.kts b/build.gradle.kts index dbc1f370d..14633bcfb 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -73,14 +73,14 @@ dependencies { implementation("com.github.ben-manes.caffeine:caffeine:3.1.5") // HTTP - implementation("io.ktor:ktor-client-jackson-jvm:2.2.4") - implementation("io.ktor:ktor-client-content-negotiation:2.2.4") - implementation("io.ktor:ktor-client-core-jvm:2.2.4") - implementation("io.ktor:ktor-client-cio-jvm:2.2.4") - implementation("io.ktor:ktor-client-auth:2.2.4") - implementation("io.ktor:ktor-client-okhttp:2.2.4") - implementation("io.ktor:ktor-serialization-kotlinx-json:2.2.4") - implementation("io.ktor:ktor-client-logging-jvm:2.2.4") + implementation("io.ktor:ktor-client-jackson-jvm:2.3.3") + implementation("io.ktor:ktor-client-content-negotiation:2.3.3") + implementation("io.ktor:ktor-client-core-jvm:2.3.3") + implementation("io.ktor:ktor-client-cio-jvm:2.3.3") + implementation("io.ktor:ktor-client-auth-jvm:2.3.3") + implementation("io.ktor:ktor-client-okhttp-jvm:2.3.3") + implementation("io.ktor:ktor-serialization-kotlinx-json:2.3.3") + implementation("io.ktor:ktor-client-logging-jvm:2.3.3") // REST implementation("io.javalin:javalin:4.6.7") @@ -94,9 +94,9 @@ dependencies { implementation("io.github.microutils:kotlin-logging-jvm:3.0.4") // Config - implementation("com.sksamuel.hoplite:hoplite-core:2.6.5") - implementation("com.sksamuel.hoplite:hoplite-yaml:2.6.5") - implementation("com.sksamuel.hoplite:hoplite-hikaricp:2.6.5") + implementation("com.sksamuel.hoplite:hoplite-core:2.7.5") + implementation("com.sksamuel.hoplite:hoplite-yaml:2.7.5") + implementation("com.sksamuel.hoplite:hoplite-hikaricp:2.7.5") // Service-Matrix implementation("id.walt.servicematrix:WaltID-ServiceMatrix:1.1.3") diff --git a/src/main/kotlin/id/walt/services/ecosystems/cheqd/CheqdService.kt b/src/main/kotlin/id/walt/services/ecosystems/cheqd/CheqdService.kt index 8c3104ea5..c527aa156 100644 --- a/src/main/kotlin/id/walt/services/ecosystems/cheqd/CheqdService.kt +++ b/src/main/kotlin/id/walt/services/ecosystems/cheqd/CheqdService.kt @@ -40,8 +40,6 @@ object CheqdService { //private const val registrarUrl = "https://registrar.walt.id/cheqd" private const val registrarUrl = "https://did-registrar.cheqd.net" private const val registrarApiVersion = "1.0" - private const val didCreateUrl = - "$registrarUrl/$registrarApiVersion/did-document?verificationMethod=%s&methodSpecificIdAlgo=%s&network=%s&publicKeyHex=%s" private const val didRegisterUrl = "$registrarUrl/$registrarApiVersion/create" private const val didDeactivateUrl = "$registrarUrl/$registrarApiVersion/deactivate" private const val didUpdateUrl = "$registrarUrl/$registrarApiVersion/update" @@ -53,7 +51,11 @@ object CheqdService { val pubKeyHex = Hex.toHexString(key.getPublicKeyBytes()) // step#1. fetch the did document from cheqd registrar val response = runBlocking { - client.get(String.format(didCreateUrl, verificationMethod, methodSpecificIdAlgo, network, pubKeyHex)).bodyAsText() + client.get("$registrarUrl/$registrarApiVersion/did-document" + + "?verificationMethod=$verificationMethod" + + "&methodSpecificIdAlgo=$methodSpecificIdAlgo" + + "&network=$network" + + "&publicKeyHex=$pubKeyHex").bodyAsText() } // step#2. onboard did with cheqd registrar KlaxonWithConverters().parse(response)?.let { @@ -76,7 +78,7 @@ object CheqdService { } fun deactivateDid(did: String) { - val job = initiateDidJob(didCreateUrl, KlaxonWithConverters().toJsonString(JobDeactivateRequest(did))) + val job = initiateDidJob(didDeactivateUrl, KlaxonWithConverters().toJsonString(JobDeactivateRequest(did))) ?: throw Exception("Failed to initialize the did onboarding process") val signatures = signPayload(KeyId(""), job) val didDocument = (finalizeDidJob( diff --git a/src/main/kotlin/id/walt/services/jwt/WaltIdJwtService.kt b/src/main/kotlin/id/walt/services/jwt/WaltIdJwtService.kt index 98f196957..fab1b5528 100644 --- a/src/main/kotlin/id/walt/services/jwt/WaltIdJwtService.kt +++ b/src/main/kotlin/id/walt/services/jwt/WaltIdJwtService.kt @@ -172,7 +172,7 @@ open class WaltIdJwtService : JwtService() { val res = verifyJwt(verifierKey, jwt) - log.debug { "JWT verified returned: $res" } + log.debug { "JWT verified returned: $res (with key: ${verifierKey.keyId})" } return JwtVerificationResult(res) } diff --git a/vc-template-VerifiableDiploma-1677576124951.json b/vc-template-VerifiableDiploma-1677576124951.json deleted file mode 100644 index 326551788..000000000 --- a/vc-template-VerifiableDiploma-1677576124951.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "type":[ - "VerifiableCredential", - "VerifiableAttestation", - "VerifiableDiploma" - ], - "@context":[ - "https://www.w3.org/2018/credentials/v1" - ], - "id":"education#higherEducation#392ac7f6-399a-437b-a268-4691ead8f176", - "issuer":"did:ebsi:2A9BZ9SUe6BatacSpvs1V5CdjHvLpQ7bEsi2Jb6LdHKnQxaN", - "issuanceDate":"2021-08-31T00:00:00Z", - "issued":"2021-08-31T00:00:00Z", - "validFrom":"2021-08-31T00:00:00Z", - "expirationDate":"2022-08-31T00:00:00Z", - "credentialSchema":{ - "id":"https://api.preprod.ebsi.eu/trusted-schemas-registry/v1/schemas/0xbf78fc08a7a9f28f5479f58dea269d3657f54f13ca37d380cd4e92237fb691dd", - "type":"JsonSchemaValidator2018" - }, - "credentialSubject":{ - "id":"did:ebsi:2AEMAqXWKYMu1JHPAgGcga4dxu7ThgfgN95VyJBJGZbSJUtp", - "awardingOpportunity":{ - "awardingBody":{ - "eidasLegalIdentifier":"Unknown", - "homepage":"https://leaston.bcdiploma.com/", - "id":"did:ebsi:2A9BZ9SUe6BatacSpvs1V5CdjHvLpQ7bEsi2Jb6LdHKnQxaN", - "preferredName":"Leaston University", - "registration":"0597065J" - }, - "endedAtTime":"2020-06-26T00:00:00Z", - "id":"https://leaston.bcdiploma.com/law-economics-management#AwardingOpportunity", - "identifier":"https://certificate-demo.bcdiploma.com/check/87ED2F2270E6C41456E94B86B9D9115B4E35BCCAD200A49B846592C14F79C86BV1Fnbllta0NZTnJkR3lDWlRmTDlSRUJEVFZISmNmYzJhUU5sZUJ5Z2FJSHpWbmZZ", - "location":"FRANCE", - "startedAtTime":"2019-09-02T00:00:00Z" - }, - "dateOfBirth":"1993-04-08", - "familyName":"DOE", - "givenNames":"Jane", - "gradingScheme":{ - "id":"https://leaston.bcdiploma.com/law-economics-management#GradingScheme", - "title":"Lower Second-Class Honours" - }, - "identifier":"0904008084H", - "learningAchievement":{ - "additionalNote":[ - "DISTRIBUTION MANAGEMENT" - ], - "description":"MARKETING AND SALES", - "id":"https://leaston.bcdiploma.com/law-economics-management#LearningAchievment", - "title":"MASTERS LAW, - ECONOMICS AND MANAGEMENT" - }, - "learningSpecification":{ - "ectsCreditPoints":120, - "eqfLevel":7, - "id":"https://leaston.bcdiploma.com/law-economics-management#LearningSpecification", - "iscedfCode":[ - "7" - ], - "nqfLevel":[ - "7" - ] - } - }, - "credentialStatus":{ - "id":"https://essif.europa.eu/status/education#higherEducation#392ac7f6-399a-437b-a268-4691ead8f176", - "type":"CredentialStatusList2020" - }, - "evidence":{ - "documentPresence":[ - "Physical" - ], - "evidenceDocument":[ - "Passport" - ], - "id":"https://essif.europa.eu/tsr-va/evidence/f2aeec97-fc0d-42bf-8ca7-0548192d5678", - "subjectPresence":"Physical", - "type":[ - "DocumentVerification" - ], - "verifier":"did:ebsi:2962fb784df61baa267c8132497539f8c674b37c1244a7a" - } -} \ No newline at end of file diff --git a/vc-template-VerifiableId-1677576065840.json b/vc-template-VerifiableId-1677576065840.json deleted file mode 100644 index e2a24eab0..000000000 --- a/vc-template-VerifiableId-1677576065840.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "type":[ - "VerifiableCredential", - "VerifiableAttestation", - "VerifiableId" - ], - "@context":[ - "https://www.w3.org/2018/credentials/v1" - ], - "id":"urn:uuid:3add94f4-28ec-42a1-8704-4e4aa51006b4", - "issuer":"did:ebsi:2A9BZ9SUe6BatacSpvs1V5CdjHvLpQ7bEsi2Jb6LdHKnQxaN", - "issuanceDate":"2021-08-31T00:00:00Z", - "issued":"2021-08-31T00:00:00Z", - "validFrom":"2021-08-31T00:00:00Z", - "credentialSchema":{ - "id":"https://raw.githubusercontent.com/walt-id/waltid-ssikit-vclib/master/src/test/resources/schemas/VerifiableId.json", - "type":"FullJsonSchemaValidator2021" - }, - "credentialSubject":{ - "id":"did:ebsi:2AEMAqXWKYMu1JHPAgGcga4dxu7ThgfgN95VyJBJGZbSJUtp", - "currentAddress":[ - "1 Boulevard de la Liberté, - 59800 Lille" - ], - "dateOfBirth":"1993-04-08", - "familyName":"DOE", - "firstName":"Jane", - "gender":"FEMALE", - "nameAndFamilyNameAtBirth":"Jane DOE", - "personalIdentifier":"0904008084H", - "placeOfBirth":"LILLE, - FRANCE" - }, - "evidence":[ - { - "documentPresence":[ - "Physical" - ], - "evidenceDocument":[ - "Passport" - ], - "subjectPresence":"Physical", - "type":[ - "DocumentVerification" - ], - "verifier":"did:ebsi:2A9BZ9SUe6BatacSpvs1V5CdjHvLpQ7bEsi2Jb6LdHKnQxaN" - } - ] -} \ No newline at end of file