diff --git a/tests/integration-tests/src/test/kotlin/abilities/ListenToEvents.kt b/tests/integration-tests/src/test/kotlin/abilities/ListenToEvents.kt index e2116d6793..e9a09dc5ec 100644 --- a/tests/integration-tests/src/test/kotlin/abilities/ListenToEvents.kt +++ b/tests/integration-tests/src/test/kotlin/abilities/ListenToEvents.kt @@ -3,19 +3,29 @@ package abilities import com.google.gson.GsonBuilder import common.TestConstants import io.iohk.atala.automation.restassured.CustomGsonObjectMapperFactory -import io.ktor.http.* -import io.ktor.server.application.* -import io.ktor.server.engine.* -import io.ktor.server.netty.* -import io.ktor.server.request.* -import io.ktor.server.response.* -import io.ktor.server.routing.* -import models.* +import io.ktor.http.HttpStatusCode +import io.ktor.server.application.Application +import io.ktor.server.application.call +import io.ktor.server.engine.ApplicationEngine +import io.ktor.server.engine.embeddedServer +import io.ktor.server.netty.Netty +import io.ktor.server.request.receiveText +import io.ktor.server.response.respond +import io.ktor.server.routing.get +import io.ktor.server.routing.post +import io.ktor.server.routing.routing +import models.ConnectionEvent +import models.CredentialEvent +import models.DidEvent +import models.Event +import models.PresentationEvent +import models.PresentationStatusAdapter import net.serenitybdd.screenplay.Ability import net.serenitybdd.screenplay.Actor import net.serenitybdd.screenplay.HasTeardown import net.serenitybdd.screenplay.Question -import org.hyperledger.identus.client.models.* +import org.hyperledger.identus.client.models.Connection +import org.hyperledger.identus.client.models.IssueCredentialRecord import java.net.URL import java.time.OffsetDateTime diff --git a/tests/integration-tests/src/test/kotlin/common/DidDocumentTemplate.kt b/tests/integration-tests/src/test/kotlin/common/DidDocumentTemplate.kt new file mode 100644 index 0000000000..9d704c3a8c --- /dev/null +++ b/tests/integration-tests/src/test/kotlin/common/DidDocumentTemplate.kt @@ -0,0 +1,9 @@ +package common + +import org.hyperledger.identus.client.models.ManagedDIDKeyTemplate +import org.hyperledger.identus.client.models.Service + +data class DidDocumentTemplate ( + val publicKeys: MutableList, + val services: MutableList +) diff --git a/tests/integration-tests/src/test/kotlin/common/DidPurpose.kt b/tests/integration-tests/src/test/kotlin/common/DidPurpose.kt deleted file mode 100644 index c4c30ca83c..0000000000 --- a/tests/integration-tests/src/test/kotlin/common/DidPurpose.kt +++ /dev/null @@ -1,41 +0,0 @@ -package common - -import org.hyperledger.identus.client.models.* - -enum class DidPurpose { - CUSTOM { - override val publicKeys = mutableListOf() - override val services = mutableListOf() - }, - SD_JWT { - override val publicKeys = mutableListOf( - ManagedDIDKeyTemplate("auth-1", Purpose.AUTHENTICATION, Curve.ED25519), - ManagedDIDKeyTemplate("assertion-1", Purpose.ASSERTION_METHOD, Curve.ED25519), - ) - override val services = mutableListOf() - }, - JWT { - override val publicKeys = mutableListOf( - ManagedDIDKeyTemplate("auth-1", Purpose.AUTHENTICATION, Curve.SECP256K1), - ManagedDIDKeyTemplate("auth-2", Purpose.AUTHENTICATION, Curve.ED25519), - ManagedDIDKeyTemplate("assertion-1", Purpose.ASSERTION_METHOD, Curve.SECP256K1), - ManagedDIDKeyTemplate("assertion-2", Purpose.ASSERTION_METHOD, Curve.ED25519), - ) - override val services = mutableListOf() - }, - OIDC_JWT { - override val publicKeys = mutableListOf( - ManagedDIDKeyTemplate("auth-1", Purpose.AUTHENTICATION, Curve.SECP256K1), - ManagedDIDKeyTemplate("auth-2", Purpose.AUTHENTICATION, Curve.ED25519), - ManagedDIDKeyTemplate("assertion-1", Purpose.ASSERTION_METHOD, Curve.SECP256K1), - ) - override val services = mutableListOf() - }, - ANONCRED { - override val publicKeys = mutableListOf() - override val services = mutableListOf() - }, ; - - abstract val publicKeys: MutableList - abstract val services: MutableList -} diff --git a/tests/integration-tests/src/test/kotlin/common/DidType.kt b/tests/integration-tests/src/test/kotlin/common/DidType.kt new file mode 100644 index 0000000000..5ef6b32d33 --- /dev/null +++ b/tests/integration-tests/src/test/kotlin/common/DidType.kt @@ -0,0 +1,50 @@ +package common + +import org.hyperledger.identus.client.models.* + +enum class DidType { + CUSTOM { + override val documentTemplate get() = DidDocumentTemplate( + publicKeys = mutableListOf(), + services = mutableListOf() + ) + }, + SD_JWT { + override val documentTemplate get() = DidDocumentTemplate( + publicKeys = mutableListOf( + ManagedDIDKeyTemplate("auth-1", Purpose.AUTHENTICATION, Curve.ED25519), + ManagedDIDKeyTemplate("assertion-1", Purpose.ASSERTION_METHOD, Curve.ED25519), + ), + services = mutableListOf() + ) + }, + JWT { + override val documentTemplate get() = DidDocumentTemplate( + publicKeys = mutableListOf( + ManagedDIDKeyTemplate("auth-1", Purpose.AUTHENTICATION, Curve.SECP256K1), + ManagedDIDKeyTemplate("auth-2", Purpose.AUTHENTICATION, Curve.ED25519), + ManagedDIDKeyTemplate("assertion-1", Purpose.ASSERTION_METHOD, Curve.SECP256K1), + ManagedDIDKeyTemplate("assertion-2", Purpose.ASSERTION_METHOD, Curve.ED25519), + ), + services = mutableListOf() + ) + }, + OIDC_JWT { + override val documentTemplate get() = DidDocumentTemplate( + publicKeys = mutableListOf( + ManagedDIDKeyTemplate("auth-1", Purpose.AUTHENTICATION, Curve.SECP256K1), + ManagedDIDKeyTemplate("auth-2", Purpose.AUTHENTICATION, Curve.ED25519), + ManagedDIDKeyTemplate("assertion-1", Purpose.ASSERTION_METHOD, Curve.SECP256K1), + ), + services = mutableListOf() + ) + }, + ANONCRED { + override val documentTemplate get() = DidDocumentTemplate( + publicKeys = mutableListOf(), + services = mutableListOf() + ) + }, ; + + abstract val documentTemplate: DidDocumentTemplate +} diff --git a/tests/integration-tests/src/test/kotlin/steps/Setup.kt b/tests/integration-tests/src/test/kotlin/steps/Setup.kt index 07038f919d..569a2f385a 100644 --- a/tests/integration-tests/src/test/kotlin/steps/Setup.kt +++ b/tests/integration-tests/src/test/kotlin/steps/Setup.kt @@ -7,6 +7,7 @@ import com.sksamuel.hoplite.ConfigLoader import common.TestConstants import config.* import io.cucumber.java.AfterAll +import io.cucumber.java.Before import io.cucumber.java.BeforeAll import io.ktor.server.util.url import io.restassured.RestAssured @@ -197,6 +198,12 @@ object Setup { } } +@Before +fun clearScenario() { +// Setup.stopActors() +// Setup.initActors() +} + @BeforeAll fun init() { Security.insertProviderAt(BouncyCastleProviderSingleton.getInstance(), 2) diff --git a/tests/integration-tests/src/test/kotlin/steps/common/CommonSteps.kt b/tests/integration-tests/src/test/kotlin/steps/common/CommonSteps.kt index d5c8428b13..06aaab22bf 100644 --- a/tests/integration-tests/src/test/kotlin/steps/common/CommonSteps.kt +++ b/tests/integration-tests/src/test/kotlin/steps/common/CommonSteps.kt @@ -1,7 +1,7 @@ package steps.common import common.CredentialSchema -import common.DidPurpose +import common.DidType import interactions.Get import io.cucumber.java.en.Given import io.iohk.atala.automation.extensions.get @@ -13,7 +13,7 @@ import org.hyperledger.identus.client.models.Connection import org.hyperledger.identus.client.models.ConnectionsPage import steps.connection.ConnectionSteps import steps.credentials.* -import steps.did.PublishDidSteps +import steps.did.CreateDidSteps import steps.schemas.CredentialSchemasSteps class CommonSteps { @@ -21,21 +21,21 @@ class CommonSteps { fun holderHasIssuedJwtCredentialFromIssuer(holder: Actor, issuer: Actor) { actorsHaveExistingConnection(issuer, holder) - val publishDidSteps = PublishDidSteps() - publishDidSteps.agentHasAnUnpublishedDID(holder, DidPurpose.JWT) - publishDidSteps.agentHasAPublishedDID(issuer, DidPurpose.JWT) + val createDidSteps = CreateDidSteps() + createDidSteps.agentHasAnUnpublishedDID(holder, DidType.JWT) + createDidSteps.agentHasAPublishedDID(issuer, DidType.JWT) val jwtCredentialSteps = JwtCredentialSteps() val credentialSteps = CredentialSteps() jwtCredentialSteps.issuerOffersAJwtCredential(issuer, holder, "short") credentialSteps.holderReceivesCredentialOffer(holder) - jwtCredentialSteps.holderAcceptsJwtCredentialOfferForJwt(holder) + jwtCredentialSteps.holderAcceptsJwtCredentialOfferForJwt(holder, "auth-1") credentialSteps.issuerIssuesTheCredential(issuer) credentialSteps.holderReceivesTheIssuedCredential(holder) } - @Given("{actor} has a jwt issued credential with {} schema from {actor}") + @Given("{actor} has a jwt issued credential with '{}' schema from {actor}") fun holderHasIssuedJwtCredentialFromIssuerWithSchema( holder: Actor, schema: CredentialSchema, @@ -43,9 +43,9 @@ class CommonSteps { ) { actorsHaveExistingConnection(issuer, holder) - val publishDidSteps = PublishDidSteps() - publishDidSteps.agentHasAnUnpublishedDID(holder, DidPurpose.JWT) - publishDidSteps.agentHasAPublishedDID(issuer, DidPurpose.JWT) + val createDidSteps = CreateDidSteps() + createDidSteps.agentHasAnUnpublishedDID(holder, DidType.JWT) + createDidSteps.agentHasAPublishedDID(issuer, DidType.JWT) val schemaSteps = CredentialSchemasSteps() schemaSteps.agentHasAPublishedSchema(issuer, schema) @@ -54,7 +54,7 @@ class CommonSteps { val credentialSteps = CredentialSteps() jwtCredentialSteps.issuerOffersJwtCredentialToHolderUsingSchema(issuer, holder, "short", schema) credentialSteps.holderReceivesCredentialOffer(holder) - jwtCredentialSteps.holderAcceptsJwtCredentialOfferForJwt(holder) + jwtCredentialSteps.holderAcceptsJwtCredentialOfferForJwt(holder, "auth-1") credentialSteps.issuerIssuesTheCredential(issuer) credentialSteps.holderReceivesTheIssuedCredential(holder) } @@ -63,9 +63,9 @@ class CommonSteps { fun holderHasIssuedSdJwtCredentialFromIssuer(holder: Actor, issuer: Actor) { actorsHaveExistingConnection(issuer, holder) - val publishDidSteps = PublishDidSteps() - publishDidSteps.agentHasAnUnpublishedDID(holder, DidPurpose.SD_JWT) - publishDidSteps.agentHasAPublishedDID(issuer, DidPurpose.SD_JWT) + val createDidSteps = CreateDidSteps() + createDidSteps.agentHasAnUnpublishedDID(holder, DidType.SD_JWT) + createDidSteps.agentHasAPublishedDID(issuer, DidType.SD_JWT) val sdJwtCredentialSteps = SdJwtCredentialSteps() val credentialSteps = CredentialSteps() @@ -80,9 +80,9 @@ class CommonSteps { fun holderHasIssuedSdJwtCredentialFromIssuerWithKeyBind(holder: Actor, issuer: Actor) { actorsHaveExistingConnection(issuer, holder) - val publishDidSteps = PublishDidSteps() - publishDidSteps.agentHasAnUnpublishedDID(holder, DidPurpose.SD_JWT) - publishDidSteps.agentHasAPublishedDID(issuer, DidPurpose.SD_JWT) + val createDidSteps = CreateDidSteps() + createDidSteps.agentHasAnUnpublishedDID(holder, DidType.SD_JWT) + createDidSteps.agentHasAPublishedDID(issuer, DidType.SD_JWT) val sdJwtCredentialSteps = SdJwtCredentialSteps() val credentialSteps = CredentialSteps() @@ -97,8 +97,6 @@ class CommonSteps { fun actorsHaveExistingConnection(inviter: Actor, invitee: Actor) { inviter.attemptsTo( Get.resource("/connections"), - ) - inviter.attemptsTo( Ensure.thatTheLastResponse().statusCode().isEqualTo(HttpStatus.SC_OK), ) val inviterConnection = SerenityRest.lastResponse().get().contents!!.firstOrNull { @@ -109,8 +107,6 @@ class CommonSteps { if (inviterConnection != null) { invitee.attemptsTo( Get.resource("/connections"), - ) - invitee.attemptsTo( Ensure.thatTheLastResponse().statusCode().isEqualTo(HttpStatus.SC_OK), ) inviteeConnection = SerenityRest.lastResponse().get().contents!!.firstOrNull { diff --git a/tests/integration-tests/src/test/kotlin/steps/connection/ConnectionSteps.kt b/tests/integration-tests/src/test/kotlin/steps/connection/ConnectionSteps.kt index 17df7e4bf3..0848cb3f7b 100644 --- a/tests/integration-tests/src/test/kotlin/steps/connection/ConnectionSteps.kt +++ b/tests/integration-tests/src/test/kotlin/steps/connection/ConnectionSteps.kt @@ -15,9 +15,14 @@ import org.apache.http.HttpStatus.SC_CREATED import org.apache.http.HttpStatus.SC_OK import org.assertj.core.api.Assertions.assertThat import org.hamcrest.CoreMatchers -import org.hyperledger.identus.client.models.* +import org.hyperledger.identus.client.models.AcceptConnectionInvitationRequest +import org.hyperledger.identus.client.models.Connection +import org.hyperledger.identus.client.models.Connection.State.CONNECTION_REQUEST_RECEIVED import org.hyperledger.identus.client.models.Connection.State.CONNECTION_RESPONSE_RECEIVED import org.hyperledger.identus.client.models.Connection.State.CONNECTION_RESPONSE_SENT +import org.hyperledger.identus.client.models.Connection.State.INVITATION_GENERATED +import org.hyperledger.identus.client.models.CreateConnectionRequest +import kotlin.time.Duration.Companion.seconds class ConnectionSteps { @@ -29,12 +34,11 @@ class ConnectionSteps { inviter.attemptsTo( Post.to("/connections").body(CreateConnectionRequest(label = connectionLabel)), + Ensure.thatTheLastResponse().statusCode().isEqualTo(SC_CREATED), ) val connection = SerenityRest.lastResponse().get() - inviter.attemptsTo( - Ensure.thatTheLastResponse().statusCode().isEqualTo(SC_CREATED), Ensure.that(connection.label!!).isEqualTo(connectionLabel), Ensure.that(connection.state).isEqualTo(Connection.State.INVITATION_GENERATED), Ensure.that(connection.role).isEqualTo(Connection.Role.INVITER), @@ -48,20 +52,14 @@ class ConnectionSteps { fun inviteeSendsAConnectionRequestToInviter(invitee: Actor, inviter: Actor) { // Bob accepts connection using achieved out-of-band invitation val inviterConnection = inviter.recall("connection") + val body = AcceptConnectionInvitationRequest(inviterConnection.invitation.invitationUrl.split("=")[1]) invitee.attemptsTo( - Post.to("/connection-invitations") - .with { - it.body( - AcceptConnectionInvitationRequest( - inviterConnection.invitation.invitationUrl.split("=")[1], - ), - ) - }, + Post.to("/connection-invitations").body(body), + Ensure.thatTheLastResponse().statusCode().isEqualTo(SC_OK), ) - val inviteeConnection = SerenityRest.lastResponse().get() + val inviteeConnection = SerenityRest.lastResponse().get() invitee.attemptsTo( - Ensure.thatTheLastResponse().statusCode().isEqualTo(SC_OK), Ensure.that(inviteeConnection.invitation.from).isEqualTo(inviterConnection.invitation.from), Ensure.that(inviteeConnection.invitation.id).isEqualTo(inviterConnection.invitation.id), Ensure.that(inviteeConnection.invitation.invitationUrl) diff --git a/tests/integration-tests/src/test/kotlin/steps/connectionless/ConnectionLessSteps.kt b/tests/integration-tests/src/test/kotlin/steps/connectionless/ConnectionLessSteps.kt index ec7a49a0df..ffe3408b01 100644 --- a/tests/integration-tests/src/test/kotlin/steps/connectionless/ConnectionLessSteps.kt +++ b/tests/integration-tests/src/test/kotlin/steps/connectionless/ConnectionLessSteps.kt @@ -14,7 +14,7 @@ import org.hyperledger.identus.client.models.* class ConnectionLessSteps { - @When("{actor} creates a {string} credential offer invitation with {string} form DID") + @When("{actor} creates a '{}' credential offer invitation with '{}' form DID") fun inviterGeneratesACredentialOfferInvitation(issuer: Actor, credentialFormat: String, didForm: String) { val claims = linkedMapOf( "firstName" to "Automation", diff --git a/tests/integration-tests/src/test/kotlin/steps/credentials/CredentialSteps.kt b/tests/integration-tests/src/test/kotlin/steps/credentials/CredentialSteps.kt index 7c2251ec83..1943f25759 100644 --- a/tests/integration-tests/src/test/kotlin/steps/credentials/CredentialSteps.kt +++ b/tests/integration-tests/src/test/kotlin/steps/credentials/CredentialSteps.kt @@ -48,14 +48,12 @@ class CredentialSteps { issuer.attemptsTo( Ensure.thatTheLastResponse().statusCode().isEqualTo(SC_OK), - ) - - issuer.attemptsTo( PollingWait.until( ListenToEvents.credentialState(issuer), equalTo(CREDENTIAL_SENT), ), ) + println("new issued credential: ${ListenToEvents.with(issuer).credentialEvents.last().data}") issuer.remember("issuedCredential", ListenToEvents.with(issuer).credentialEvents.last().data) } @@ -67,6 +65,7 @@ class CredentialSteps { equalTo(CREDENTIAL_RECEIVED), ), ) + println("new received credential: ${ListenToEvents.with(holder).credentialEvents.last().data}") holder.remember("issuedCredential", ListenToEvents.with(holder).credentialEvents.last().data) } diff --git a/tests/integration-tests/src/test/kotlin/steps/credentials/JwtCredentialSteps.kt b/tests/integration-tests/src/test/kotlin/steps/credentials/JwtCredentialSteps.kt index 5ca7c1d96b..551662d448 100644 --- a/tests/integration-tests/src/test/kotlin/steps/credentials/JwtCredentialSteps.kt +++ b/tests/integration-tests/src/test/kotlin/steps/credentials/JwtCredentialSteps.kt @@ -62,7 +62,7 @@ class JwtCredentialSteps { holder.remember("thid", credentialRecord.thid) } - @When("{actor} offers a jwt credential to {actor} with {string} form DID") + @When("{actor} offers a jwt credential to {actor} with '{}' form DID") fun issuerOffersAJwtCredential(issuer: Actor, holder: Actor, format: String) { val claims = linkedMapOf( "firstName" to "FirstName", @@ -72,7 +72,7 @@ class JwtCredentialSteps { saveCredentialOffer(issuer, holder) } - @When("{actor} offers a jwt credential to {actor} with {string} form DID using issuingKid {string}") + @When("{actor} offers a jwt credential to {actor} with '{}' form DID using issuingKid '{}'") fun issuerOffersAJwtCredentialWithIssuingKeyId(issuer: Actor, holder: Actor, format: String, issuingKid: String?) { val claims = linkedMapOf( "firstName" to "FirstName", @@ -82,7 +82,7 @@ class JwtCredentialSteps { saveCredentialOffer(issuer, holder) } - @When("{actor} offers a jwt credential to {actor} with {} form using {} schema") + @When("{actor} offers a jwt credential to {actor} with '{}' form using '{}' schema") fun issuerOffersJwtCredentialToHolderUsingSchema( issuer: Actor, holder: Actor, @@ -95,7 +95,7 @@ class JwtCredentialSteps { saveCredentialOffer(issuer, holder) } - @When("{actor} offers a jwt credential to {actor} with {} form DID with wrong claims structure using {} schema") + @When("{actor} offers a jwt credential to {actor} with '{}' form DID with wrong claims structure using '{}' schema") fun issuerOffersJwtCredentialToHolderWithWrongClaimStructure( issuer: Actor, holder: Actor, @@ -110,22 +110,13 @@ class JwtCredentialSteps { sendCredentialOffer(issuer, holder, format, schemaGuid, claims, "assertion-1") } - @When("{actor} accepts jwt credential offer") - fun holderAcceptsJwtCredentialOfferForJwt(holder: Actor) { + @When("{actor} accepts jwt credential offer using '{}' key id") + fun holderAcceptsJwtCredentialOfferForJwt(holder: Actor, keyId: String) { val recordId = holder.recall("recordId") + val longFormDid = holder.recall("longFormDid") + val acceptRequest = AcceptCredentialOfferRequest(longFormDid, keyId) holder.attemptsTo( - Post.to("/issue-credentials/records/$recordId/accept-offer") - .body(AcceptCredentialOfferRequest(holder.recall("longFormDid"), holder.recall("kidSecp256K1"))), - Ensure.thatTheLastResponse().statusCode().isEqualTo(SC_OK), - ) - } - - @When("{actor} accepts jwt credential offer with keyId {string}") - fun holderAcceptsJwtCredentialOfferForJwtWithKeyId(holder: Actor, keyId: String?) { - val recordId = holder.recall("recordId") - holder.attemptsTo( - Post.to("/issue-credentials/records/$recordId/accept-offer") - .body(AcceptCredentialOfferRequest(holder.recall("longFormDid"), keyId)), + Post.to("/issue-credentials/records/$recordId/accept-offer").body(acceptRequest), Ensure.thatTheLastResponse().statusCode().isEqualTo(SC_OK), ) } diff --git a/tests/integration-tests/src/test/kotlin/steps/did/PublishDidSteps.kt b/tests/integration-tests/src/test/kotlin/steps/did/CreateDidSteps.kt similarity index 63% rename from tests/integration-tests/src/test/kotlin/steps/did/PublishDidSteps.kt rename to tests/integration-tests/src/test/kotlin/steps/did/CreateDidSteps.kt index 8bff650f21..287271a451 100644 --- a/tests/integration-tests/src/test/kotlin/steps/did/PublishDidSteps.kt +++ b/tests/integration-tests/src/test/kotlin/steps/did/CreateDidSteps.kt @@ -1,11 +1,15 @@ package steps.did import abilities.ListenToEvents -import common.DidPurpose +import common.DidDocumentTemplate +import common.DidType +import common.DidType.CUSTOM import interactions.Get import interactions.Post import interactions.body -import io.cucumber.java.en.* +import io.cucumber.java.en.Given +import io.cucumber.java.en.Then +import io.cucumber.java.en.When import io.iohk.atala.automation.extensions.get import io.iohk.atala.automation.serenity.ensure.Ensure import io.iohk.atala.automation.serenity.interactions.PollingWait @@ -15,84 +19,64 @@ import org.apache.http.HttpStatus import org.apache.http.HttpStatus.SC_CREATED import org.apache.http.HttpStatus.SC_OK import org.hamcrest.CoreMatchers.equalTo -import org.hyperledger.identus.client.models.* - -class PublishDidSteps { - - @Given("{actor} has a published DID for {}") - fun agentHasAPublishedDID(agent: Actor, didPurpose: DidPurpose) { - if (agent.recallAll().containsKey("hasPublishedDid") && actualDidHasSamePurpose(agent, didPurpose)) { +import org.hyperledger.identus.client.models.CreateManagedDidRequest +import org.hyperledger.identus.client.models.CreateManagedDidRequestDocumentTemplate +import org.hyperledger.identus.client.models.Curve +import org.hyperledger.identus.client.models.DIDOperationResponse +import org.hyperledger.identus.client.models.DIDResolutionResult +import org.hyperledger.identus.client.models.ManagedDID +import org.hyperledger.identus.client.models.ManagedDIDKeyTemplate +import org.hyperledger.identus.client.models.Purpose + +class CreateDidSteps { + + @Given("{actor} has a published DID for '{}'") + fun agentHasAPublishedDID(agent: Actor, didType: DidType) { + if (agent.recallAll().containsKey("hasPublishedDid") && actualDidHasSamePurpose(agent, didType)) { return } - agentHasAnUnpublishedDID(agent, didPurpose) + agentHasAnUnpublishedDID(agent, didType) hePublishesDidToLedger(agent) } - @Given("{actor} has an unpublished DID for {}") - fun agentHasAnUnpublishedDID(agent: Actor, didPurpose: DidPurpose) { + @Given("{actor} has an unpublished DID for '{}'") + fun agentHasAnUnpublishedDID(agent: Actor, didType: DidType) { if (agent.recallAll().containsKey("shortFormDid") || agent.recallAll().containsKey("longFormDid")) { // is not published and has the same purpose - if (!agent.recallAll().containsKey("hasPublishedDid") && actualDidHasSamePurpose(agent, didPurpose)) { + if (!agent.recallAll().containsKey("hasPublishedDid") && actualDidHasSamePurpose(agent, didType)) { return } } - agentCreatesUnpublishedDid(agent, didPurpose) - } - - private fun actualDidHasSamePurpose(agent: Actor, didPurpose: DidPurpose): Boolean { - val actualPurpose: DidPurpose = agent.recall("didPurpose") ?: return false - return actualPurpose == didPurpose + agentCreatesUnpublishedDid(agent, didType) } - @Given("{actor} creates unpublished DID") + @Given("{actor} creates empty unpublished DID") fun agentCreatesEmptyUnpublishedDid(actor: Actor) { - agentCreatesUnpublishedDid(actor, DidPurpose.CUSTOM) + agentCreatesUnpublishedDid(actor, CUSTOM) } - @Given("{actor} creates unpublished DID for {}") - fun agentCreatesUnpublishedDid(actor: Actor, didPurpose: DidPurpose) { - val createDidRequest = CreateManagedDidRequest( - CreateManagedDidRequestDocumentTemplate(didPurpose.publicKeys, services = didPurpose.services), - ) - actor.attemptsTo( - Post.to("/did-registrar/dids").body(createDidRequest), - Ensure.thatTheLastResponse().statusCode().isEqualTo(SC_CREATED), - ) - - val managedDid = SerenityRest.lastResponse().get() - - actor.attemptsTo( - Ensure.that(managedDid.longFormDid!!).isNotEmpty(), - Get.resource("/did-registrar/dids/${managedDid.longFormDid}"), - Ensure.thatTheLastResponse().statusCode().isEqualTo(SC_OK), - ) - - val did = SerenityRest.lastResponse().get() - - actor.remember("longFormDid", managedDid.longFormDid) - actor.remember("kidSecp256K1", "auth-1") - actor.remember("kidEd25519", "auth-2") - actor.remember("shortFormDid", did.did) - actor.remember("didPurpose", didPurpose) - actor.forget("hasPublishedDid") + @Given("{actor} creates unpublished DID for '{}'") + fun agentCreatesUnpublishedDid(actor: Actor, didType: DidType) { + createDid(actor, didType, didType.documentTemplate) } @When("{actor} prepares a custom PRISM DID") fun actorPreparesCustomDid(actor: Actor) { - val customDid = DidPurpose.CUSTOM + val customDid = CUSTOM.documentTemplate actor.remember("customDid", customDid) } @When("{actor} adds a '{curve}' key for '{purpose}' purpose with '{}' name to the custom PRISM DID") fun actorAddsKeyToCustomDid(actor: Actor, curve: Curve, purpose: Purpose, name: String) { - val customDid = actor.recall("customDid") - customDid.publicKeys.add(ManagedDIDKeyTemplate(name, purpose, curve)) + val documentTemplate = actor.recall("customDid") + documentTemplate.publicKeys.add(ManagedDIDKeyTemplate(name, purpose, curve)) + actor.remember("customDid", documentTemplate) } @When("{actor} creates the custom PRISM DID") fun actorCreatesTheCustomPrismDid(actor: Actor) { - val customDid = actor.recall("customDid") - agentCreatesUnpublishedDid(actor, customDid) + val documentTemplate = actor.recall("customDid") + createDid(actor, CUSTOM, documentTemplate) } @When("{actor} publishes DID to ledger") @@ -131,4 +115,38 @@ class PublishDidSteps { Ensure.that(didResolutionResult.didDocumentMetadata.deactivated!!).isFalse(), ) } + + private fun actualDidHasSamePurpose(agent: Actor, didType: DidType): Boolean { + val actualPurpose: DidType = agent.recall("didPurpose") ?: return false + return actualPurpose == didType + } + + private fun createDid(actor: Actor, didType: DidType, documentTemplate: DidDocumentTemplate) { + val createDidRequest = CreateManagedDidRequest( + CreateManagedDidRequestDocumentTemplate( + publicKeys = documentTemplate.publicKeys, + services = documentTemplate.services + ) + ) + + actor.attemptsTo( + Post.to("/did-registrar/dids").body(createDidRequest), + Ensure.thatTheLastResponse().statusCode().isEqualTo(SC_CREATED), + ) + + val managedDid = SerenityRest.lastResponse().get() + + actor.attemptsTo( + Ensure.that(managedDid.longFormDid!!).isNotEmpty(), + Get.resource("/did-registrar/dids/${managedDid.longFormDid}"), + Ensure.thatTheLastResponse().statusCode().isEqualTo(SC_OK), + ) + + val did = SerenityRest.lastResponse().get() + + actor.remember("longFormDid", managedDid.longFormDid) + actor.remember("shortFormDid", did.did) + actor.remember("didPurpose", didType) + actor.forget("hasPublishedDid") + } } diff --git a/tests/integration-tests/src/test/kotlin/steps/multitenancy/WalletsSteps.kt b/tests/integration-tests/src/test/kotlin/steps/multitenancy/WalletsSteps.kt index c2eb65cebb..9fbf303e51 100644 --- a/tests/integration-tests/src/test/kotlin/steps/multitenancy/WalletsSteps.kt +++ b/tests/integration-tests/src/test/kotlin/steps/multitenancy/WalletsSteps.kt @@ -41,7 +41,7 @@ class WalletsSteps { return SerenityRest.lastResponse().get() } - @When("{actor} creates new wallet with name {string}") + @When("{actor} creates new wallet with name '{}'") fun iCreateNewWalletWithName(acme: Actor, name: String) { val wallet = createNewWallet(acme, name) acme.attemptsTo( @@ -88,7 +88,7 @@ class WalletsSteps { ) } - @Then("{actor} should have a wallet with name {string}") + @Then("{actor} should have a wallet with name '{}'") fun iShouldHaveAWalletWithName(acme: Actor, name: String) { acme.attemptsTo( Get.resource("/wallets/${acme.recall("walletId")}") diff --git a/tests/integration-tests/src/test/kotlin/steps/oid4vci/IssueCredentialSteps.kt b/tests/integration-tests/src/test/kotlin/steps/oid4vci/IssueCredentialSteps.kt index 6a2e906361..e639fda97a 100644 --- a/tests/integration-tests/src/test/kotlin/steps/oid4vci/IssueCredentialSteps.kt +++ b/tests/integration-tests/src/test/kotlin/steps/oid4vci/IssueCredentialSteps.kt @@ -28,7 +28,7 @@ import java.net.URI import java.net.URL class IssueCredentialSteps { - @When("{actor} creates an offer using {string} configuration with {string} form DID") + @When("{actor} creates an offer using '{}' configuration with '{}' form DID") fun issuerCreateCredentialOffer(issuer: Actor, configurationId: String, didForm: String) { val credentialIssuer = issuer.recall("oid4vciCredentialIssuer") val claims = linkedMapOf( diff --git a/tests/integration-tests/src/test/kotlin/steps/oid4vci/ManageCredentialConfigSteps.kt b/tests/integration-tests/src/test/kotlin/steps/oid4vci/ManageCredentialConfigSteps.kt index 8a53c311f9..7dbc0f41f6 100644 --- a/tests/integration-tests/src/test/kotlin/steps/oid4vci/ManageCredentialConfigSteps.kt +++ b/tests/integration-tests/src/test/kotlin/steps/oid4vci/ManageCredentialConfigSteps.kt @@ -22,7 +22,7 @@ import org.hyperledger.identus.client.models.IssuerMetadata import java.util.UUID class ManageCredentialConfigSteps { - @Given("{actor} has {string} credential configuration created from {}") + @Given("{actor} has '{}' credential configuration created from '{}'") fun issuerHasExistingCredentialConfig(issuer: Actor, configurationId: String, schema: CredentialSchema) { ManageIssuerSteps().issuerHasExistingCredentialIssuer(issuer) val credentialIssuer = issuer.recall("oid4vciCredentialIssuer") @@ -34,7 +34,7 @@ class ManageCredentialConfigSteps { } } - @When("{actor} uses {} to create a credential configuration {string}") + @When("{actor} uses '{}' to create a credential configuration '{}'") fun issuerCreateCredentialConfiguration(issuer: Actor, schema: CredentialSchema, configurationId: String) { val credentialIssuer = issuer.recall("oid4vciCredentialIssuer") val schemaGuid = issuer.recall(schema.name) @@ -52,7 +52,7 @@ class ManageCredentialConfigSteps { ) } - @When("{actor} deletes {string} credential configuration") + @When("{actor} deletes '{}' credential configuration") fun issuerDeletesCredentialConfiguration(issuer: Actor, configurationId: String) { val credentialIssuer = issuer.recall("oid4vciCredentialIssuer") issuer.attemptsTo( @@ -61,7 +61,7 @@ class ManageCredentialConfigSteps { ) } - @When("{actor} deletes a non existent {} credential configuration") + @When("{actor} deletes a non existent '{}' credential configuration") fun issuerDeletesANonExistentCredentialConfiguration(issuer: Actor, configurationId: String) { val credentialIssuer = issuer.recall("oid4vciCredentialIssuer") issuer.attemptsTo( @@ -75,7 +75,7 @@ class ManageCredentialConfigSteps { issuer.remember("credentialConfiguration", credentialConfiguration) } - @When("{actor} uses {} issuer id for credential configuration") + @When("{actor} uses '{}' issuer id for credential configuration") fun issuerUsesIssuerId(issuer: Actor, issuerId: String) { if (issuerId == "existing") { val credentialIssuer = issuer.recall("oid4vciCredentialIssuer") @@ -129,7 +129,7 @@ class ManageCredentialConfigSteps { ) } - @Then("{actor} sees the {string} configuration on IssuerMetadata endpoint") + @Then("{actor} sees the '{}' configuration on IssuerMetadata endpoint") fun issuerSeesCredentialConfiguration(issuer: Actor, configurationId: String) { val credentialIssuer = issuer.recall("oid4vciCredentialIssuer") issuer.attemptsTo( @@ -143,7 +143,7 @@ class ManageCredentialConfigSteps { ) } - @Then("{actor} cannot see the {string} configuration on IssuerMetadata endpoint") + @Then("{actor} cannot see the '{}' configuration on IssuerMetadata endpoint") fun issuerCannotSeeCredentialConfiguration(issuer: Actor, configurationId: String) { val credentialIssuer = issuer.recall("oid4vciCredentialIssuer") issuer.attemptsTo( diff --git a/tests/integration-tests/src/test/kotlin/steps/schemas/CredentialSchemasSteps.kt b/tests/integration-tests/src/test/kotlin/steps/schemas/CredentialSchemasSteps.kt index ae14368831..37511cd35f 100644 --- a/tests/integration-tests/src/test/kotlin/steps/schemas/CredentialSchemasSteps.kt +++ b/tests/integration-tests/src/test/kotlin/steps/schemas/CredentialSchemasSteps.kt @@ -16,7 +16,7 @@ import java.util.UUID class CredentialSchemasSteps { - @Given("{actor} has published {} schema") + @Given("{actor} has published '{}' schema") fun agentHasAPublishedSchema(agent: Actor, schema: CredentialSchema) { if (agent.recallAll().containsKey(schema.name)) { return @@ -24,7 +24,7 @@ class CredentialSchemasSteps { agentCreatesANewCredentialSchema(agent, schema) } - @When("{actor} creates a new credential {} schema") + @When("{actor} creates a new credential '{}' schema") fun agentCreatesANewCredentialSchema(actor: Actor, schema: CredentialSchema) { actor.attemptsTo( Post.to("/schema-registry/schemas").body( diff --git a/tests/integration-tests/src/test/kotlin/steps/verification/VcVerificationSteps.kt b/tests/integration-tests/src/test/kotlin/steps/verification/VcVerificationSteps.kt index 32f285a197..174aed265d 100644 --- a/tests/integration-tests/src/test/kotlin/steps/verification/VcVerificationSteps.kt +++ b/tests/integration-tests/src/test/kotlin/steps/verification/VcVerificationSteps.kt @@ -47,7 +47,7 @@ class VcVerificationSteps { holder.remember("issuerDid", "did:prism:issuer") } - @Given("{actor} has a {} problem in the Verifiable Credential") + @Given("{actor} has a '{}' problem in the Verifiable Credential") fun holderHasProblemInTheVerifiableCredential(holder: Actor, problem: JwtCredentialProblem) { val jwt = problem.jwt() holder.remember("jwt", jwt) @@ -64,7 +64,7 @@ class VcVerificationSteps { holder.remember("checks", checks) } - @Then("{actor} should see that verification has failed with {} problem") + @Then("{actor} should see that verification has failed with '{}' problem") fun holderShouldSeeThatVerificationHasFailedWithProblem(holder: Actor, problem: JwtCredentialProblem) { } diff --git a/tests/integration-tests/src/test/resources/features/connection/connection.feature b/tests/integration-tests/src/test/resources/features/connection/connection.feature index 329f9115bd..0b742d2fb7 100644 --- a/tests/integration-tests/src/test/resources/features/connection/connection.feature +++ b/tests/integration-tests/src/test/resources/features/connection/connection.feature @@ -1,9 +1,9 @@ @connection @create Feature: Agents connection -Scenario: Establish a connection between two agents - When Issuer generates a connection invitation to Holder - And Holder sends a connection request to Issuer - And Issuer receives the connection request and sends back the response - And Holder receives the connection response - Then Issuer and Holder have a connection + Scenario: Establish a connection between two agents + When Issuer generates a connection invitation to Holder + And Holder sends a connection request to Issuer + And Issuer receives the connection request and sends back the response + And Holder receives the connection response + Then Issuer and Holder have a connection diff --git a/tests/integration-tests/src/test/resources/features/credential/anoncred/issuance.feature b/tests/integration-tests/src/test/resources/features/credential/anoncred/issuance.feature index 712d6d7db6..3011d2cb2e 100644 --- a/tests/integration-tests/src/test/resources/features/credential/anoncred/issuance.feature +++ b/tests/integration-tests/src/test/resources/features/credential/anoncred/issuance.feature @@ -3,8 +3,8 @@ Feature: Issue Anoncred credential Background: Given Issuer and Holder have an existing connection - And Issuer has a published DID for ANONCRED - And Holder has an unpublished DID for ANONCRED + And Issuer has a published DID for 'ANONCRED' + And Holder has an unpublished DID for 'ANONCRED' Scenario: Issuing anoncred with published PRISM DID Given Issuer has an anoncred schema definition diff --git a/tests/integration-tests/src/test/resources/features/credential/anoncred/present_proof.feature b/tests/integration-tests/src/test/resources/features/credential/anoncred/present_proof.feature index 8bc05395c0..539bc1f0f7 100644 --- a/tests/integration-tests/src/test/resources/features/credential/anoncred/present_proof.feature +++ b/tests/integration-tests/src/test/resources/features/credential/anoncred/present_proof.feature @@ -4,8 +4,8 @@ Feature: Present Proof Protocol Scenario: Holder presents anoncreds credential proof to verifier Given Issuer and Holder have an existing connection And Verifier and Holder have an existing connection - And Issuer has a published DID for ANONCRED - And Holder has an unpublished DID for ANONCRED + And Issuer has a published DID for 'ANONCRED' + And Holder has an unpublished DID for 'ANONCRED' And Issuer has an anoncred schema definition And Issuer offers anoncred to Holder And Holder receives the credential offer diff --git a/tests/integration-tests/src/test/resources/features/credential/jwt/issuance.feature b/tests/integration-tests/src/test/resources/features/credential/jwt/issuance.feature index 6258cf5fdb..5e15b98f8f 100644 --- a/tests/integration-tests/src/test/resources/features/credential/jwt/issuance.feature +++ b/tests/integration-tests/src/test/resources/features/credential/jwt/issuance.feature @@ -1,61 +1,73 @@ @jwt @issuance Feature: Issue JWT credential - - Scenario: Issuing jwt credential with published PRISM DID + Scenario Outline: Issuing jwt credential using assertion Given Issuer and Holder have an existing connection - And Issuer has a published DID for JWT - And Holder has an unpublished DID for JWT - When Issuer offers a jwt credential to Holder with "short" form DID + And Holder creates unpublished DID for 'JWT' + When Issuer prepares a custom PRISM DID + And Issuer adds a '' key for 'assertionMethod' purpose with '' name to the custom PRISM DID + And Issuer creates the custom PRISM DID + And Issuer publishes DID to ledger + When Issuer offers a jwt credential to Holder with 'short' form DID using issuingKid '' And Holder receives the credential offer - And Holder accepts jwt credential offer + And Holder accepts jwt credential offer using 'auth-1' key id And Issuer issues the credential Then Holder receives the issued credential + When Issuer revokes the credential issued to Holder + Then Issuer should see the credential was revoked + When Issuer sends a request for jwt proof presentation to Holder + And Holder receives the presentation proof request + And Holder makes the jwt presentation of the proof + Then Issuer sees the proof returned verification failed + Examples: + | assertionMethod | assertionName | + | secp256k1 | assert-1 | + | ed25519 | assert-1 | - Scenario: Issuing jwt credential with published PRISM DID using Ed25519 + Scenario: Issuing jwt credential with published PRISM DID Given Issuer and Holder have an existing connection - And Issuer has a published DID for JWT - And Holder has an unpublished DID for JWT - When Issuer offers a jwt credential to Holder with "short" form DID using issuingKid "assertion-2" + And Issuer has a published DID for 'JWT' + And Holder has an unpublished DID for 'JWT' + When Issuer offers a jwt credential to Holder with 'short' form DID And Holder receives the credential offer - And Holder accepts jwt credential offer with keyId "auth-2" + And Holder accepts jwt credential offer using 'auth-1' key id And Issuer issues the credential Then Holder receives the issued credential Scenario: Issuing jwt credential with a schema Given Issuer and Holder have an existing connection - And Issuer has a published DID for JWT - And Issuer has published STUDENT_SCHEMA schema - And Holder has an unpublished DID for JWT - When Issuer offers a jwt credential to Holder with "short" form using STUDENT_SCHEMA schema + And Issuer has a published DID for 'JWT' + And Issuer has published 'STUDENT_SCHEMA' schema + And Holder has an unpublished DID for 'JWT' + When Issuer offers a jwt credential to Holder with 'short' form using 'STUDENT_SCHEMA' schema And Holder receives the credential offer - And Holder accepts jwt credential offer + And Holder accepts jwt credential offer using 'auth-1' key id And Issuer issues the credential Then Holder receives the issued credential Scenario: Issuing jwt credential with wrong claim structure for schema Given Issuer and Holder have an existing connection - And Issuer has a published DID for JWT - And Issuer has published STUDENT_SCHEMA schema - And Holder has an unpublished DID for JWT - When Issuer offers a jwt credential to Holder with "short" form DID with wrong claims structure using STUDENT_SCHEMA schema + And Issuer has a published DID for 'JWT' + And Issuer has published 'STUDENT_SCHEMA' schema + And Holder has an unpublished DID for 'JWT' + When Issuer offers a jwt credential to Holder with 'short' form DID with wrong claims structure using 'STUDENT_SCHEMA' schema Then Issuer should see that credential issuance has failed Scenario: Issuing jwt credential with unpublished PRISM DID Given Issuer and Holder have an existing connection - And Issuer has an unpublished DID for JWT - And Holder has an unpublished DID for JWT - And Issuer offers a jwt credential to Holder with "long" form DID + And Issuer has an unpublished DID for 'JWT' + And Holder has an unpublished DID for 'JWT' + And Issuer offers a jwt credential to Holder with 'long' form DID And Holder receives the credential offer - And Holder accepts jwt credential offer + And Holder accepts jwt credential offer using 'auth-1' key id And Issuer issues the credential Then Holder receives the issued credential Scenario: Connectionless issuance of JWT credential using OOB invitation - Given Issuer has a published DID for JWT - And Holder has an unpublished DID for JWT - When Issuer creates a "JWT" credential offer invitation with "short" form DID + Given Issuer has a published DID for 'JWT' + And Holder has an unpublished DID for 'JWT' + When Issuer creates a 'JWT' credential offer invitation with 'short' form DID And Holder accepts the credential offer invitation from Issuer - And Holder accepts jwt credential offer + And Holder accepts jwt credential offer using 'auth-1' key id And Issuer issues the credential - Then Holder receives the issued credential \ No newline at end of file + Then Holder receives the issued credential diff --git a/tests/integration-tests/src/test/resources/features/credential/jwt/present_proof.feature b/tests/integration-tests/src/test/resources/features/credential/jwt/present_proof.feature index 43612873d6..c355f15ab9 100644 --- a/tests/integration-tests/src/test/resources/features/credential/jwt/present_proof.feature +++ b/tests/integration-tests/src/test/resources/features/credential/jwt/present_proof.feature @@ -25,10 +25,31 @@ Feature: Present Proof Protocol And Holder rejects the proof Then Holder sees the proof is rejected + Scenario Outline: Verifying jwt credential using assertion + Given Issuer and Holder have an existing connection + And Verifier and Holder have an existing connection + And Holder creates unpublished DID for 'JWT' + When Issuer prepares a custom PRISM DID + And Issuer adds a '' key for 'assertionMethod' purpose with '' name to the custom PRISM DID + And Issuer creates the custom PRISM DID + When Issuer offers a jwt credential to Holder with 'long' form DID using issuingKid '' + And Holder receives the credential offer + And Holder accepts jwt credential offer using 'auth-1' key id + And Issuer issues the credential + Then Holder receives the issued credential + When Verifier sends a request for jwt proof presentation to Holder + And Holder receives the presentation proof request + And Holder makes the jwt presentation of the proof + Then Verifier has the proof verified + Examples: + | assertionMethod | assertionName | + | secp256k1 | assert-1 | + | ed25519 | assert-1 | + Scenario: Connectionless Verification Holder presents jwt credential proof to verifier Given Holder has a jwt issued credential from Issuer When Verifier creates a OOB Invitation request for JWT proof presentation And Holder accepts the OOB invitation request for JWT proof presentation from Verifier And Holder receives the presentation proof request And Holder makes the jwt presentation of the proof - Then Verifier has the proof verified \ No newline at end of file + Then Verifier has the proof verified diff --git a/tests/integration-tests/src/test/resources/features/credential/jwt/revocation.feature b/tests/integration-tests/src/test/resources/features/credential/jwt/revocation.feature index 508380402d..284f008a60 100644 --- a/tests/integration-tests/src/test/resources/features/credential/jwt/revocation.feature +++ b/tests/integration-tests/src/test/resources/features/credential/jwt/revocation.feature @@ -1,10 +1,8 @@ @jwt @revocation Feature: JWT Credential revocation - Background: - Given Holder has a jwt issued credential from Issuer - Scenario: Revoke jwt issued credential + Given Holder has a jwt issued credential from Issuer When Issuer revokes the credential issued to Holder Then Issuer should see the credential was revoked When Issuer sends a request for jwt proof presentation to Holder @@ -13,6 +11,7 @@ Feature: JWT Credential revocation Then Issuer sees the proof returned verification failed Scenario: Holder tries to revoke jwt credential from issuer + Given Holder has a jwt issued credential from Issuer When Holder tries to revoke credential from Issuer And Issuer sends a request for jwt proof presentation to Holder And Holder receives the presentation proof request diff --git a/tests/integration-tests/src/test/resources/features/credential/sdjwt/issuance.feature b/tests/integration-tests/src/test/resources/features/credential/sdjwt/issuance.feature index a96c24f04f..2edc63f073 100644 --- a/tests/integration-tests/src/test/resources/features/credential/sdjwt/issuance.feature +++ b/tests/integration-tests/src/test/resources/features/credential/sdjwt/issuance.feature @@ -1,21 +1,28 @@ @sdjwt @issuance Feature: Issue SD-JWT credential - Scenario: Issuing sd-jwt credential + Scenario Outline: Issuing sd-jwt credential Given Issuer and Holder have an existing connection - And Issuer has a published DID for SD_JWT - And Holder has an unpublished DID for SD_JWT + And Holder has an unpublished DID for 'SD_JWT' + When Issuer prepares a custom PRISM DID + And Issuer adds a '' key for 'assertionMethod' purpose with '' name to the custom PRISM DID + And Issuer adds a '' key for 'authentication' purpose with '' name to the custom PRISM DID + And Issuer creates the custom PRISM DID + And Issuer publishes DID to ledger When Issuer offers a sd-jwt credential to Holder And Holder receives the credential offer And Holder accepts credential offer for sd-jwt And Issuer issues the credential Then Holder receives the issued credential And Holder checks the sd-jwt credential contents + Examples: + | assertionMethod | assertionName | authentication | authenticationName | + | ed25519 | assert-1 | ed25519 | auth-1 | Scenario: Issuing sd-jwt credential with holder binding Given Issuer and Holder have an existing connection - And Issuer has a published DID for SD_JWT - And Holder has an unpublished DID for SD_JWT + And Issuer has a published DID for 'SD_JWT' + And Holder has an unpublished DID for 'SD_JWT' When Issuer offers a sd-jwt credential to Holder And Holder receives the credential offer And Holder accepts credential offer for sd-jwt with 'auth-1' key binding @@ -24,25 +31,11 @@ Feature: Issue SD-JWT credential Then Holder checks the sd-jwt credential contents with holder binding Scenario: Connectionless issuance of sd-jwt credential with holder binding - And Issuer has a published DID for SD_JWT - And Holder has an unpublished DID for SD_JWT - When Issuer creates a "SDJWT" credential offer invitation with "short" form DID + And Issuer has a published DID for 'SD_JWT' + And Holder has an unpublished DID for 'SD_JWT' + When Issuer creates a 'SDJWT' credential offer invitation with 'short' form DID And Holder accepts the credential offer invitation from Issuer And Holder accepts credential offer for sd-jwt with 'auth-1' key binding And Issuer issues the credential Then Holder receives the issued credential Then Holder checks the sd-jwt credential contents with holder binding - - -# Scenario: Issuing sd-jwt with wrong algorithm -# Given Issuer and Holder have an existing connection -# When Issuer prepares a custom PRISM DID -# And Issuer adds a 'secp256k1' key for 'assertionMethod' purpose with 'assert-1' name to the custom PRISM DID -# And Issuer adds a 'secp256k1' key for 'authentication' purpose with 'auth-1' name to the custom PRISM DID -# And Issuer creates the custom PRISM DID -# And Holder has an unpublished DID for SD_JWT -# And Issuer offers a sd-jwt credential to Holder -# And Holder receives the credential offer -# And Holder accepts credential offer for sd-jwt -# And Issuer tries to issue the credential -# Then Issuer should see that credential issuance has failed diff --git a/tests/integration-tests/src/test/resources/features/credential/sdjwt/present_proof.feature b/tests/integration-tests/src/test/resources/features/credential/sdjwt/present_proof.feature index 96e8f4e961..d0d3ca9dd5 100644 --- a/tests/integration-tests/src/test/resources/features/credential/sdjwt/present_proof.feature +++ b/tests/integration-tests/src/test/resources/features/credential/sdjwt/present_proof.feature @@ -25,7 +25,7 @@ Feature: Present SD-JWT Proof Protocol | Verifier | | Issuer | - Scenario Outline: Holder presents sd-jwt proof to + Scenario Outline: Holder presents sd-jwt out-of-band proof to Given Holder has a sd-jwt issued credential from Issuer When creates a OOB Invitation request for sd-jwt proof presentation requesting [firstName] claims And Holder accepts the OOB invitation request for JWT proof presentation from diff --git a/tests/integration-tests/src/test/resources/features/did/create_did.feature b/tests/integration-tests/src/test/resources/features/did/create_did.feature index 55ebe81a21..172fc301b0 100644 --- a/tests/integration-tests/src/test/resources/features/did/create_did.feature +++ b/tests/integration-tests/src/test/resources/features/did/create_did.feature @@ -1,7 +1,7 @@ @DLT @did @create Feature: Create and publish DID - Scenario Outline: Create PRISM DID + Scenario Outline: Create PRISM DID with for When Issuer creates PRISM DID with key having purpose Then He sees PRISM DID was created successfully And He sees PRISM DID data was stored correctly with and @@ -13,7 +13,7 @@ Feature: Create and publish DID | Ed25519 | assertionMethod | | X25519 | keyAgreement | - Scenario Outline: Create PRISM DID with disallowed key purpose + Scenario Outline: Create PRISM DID with for should not work When Issuer creates PRISM DID with key having purpose Then He sees PRISM DID was not successfully created Examples: @@ -23,6 +23,6 @@ Feature: Create and publish DID | X25519 | assertionMethod | Scenario: Successfully publish DID to ledger - Given Issuer creates unpublished DID + Given Issuer creates empty unpublished DID When He publishes DID to ledger Then He resolves DID document corresponds to W3C standard diff --git a/tests/integration-tests/src/test/resources/features/did/deactivate_did.feature b/tests/integration-tests/src/test/resources/features/did/deactivate_did.feature index 13b3ea03e3..37a1c3bebb 100644 --- a/tests/integration-tests/src/test/resources/features/did/deactivate_did.feature +++ b/tests/integration-tests/src/test/resources/features/did/deactivate_did.feature @@ -2,7 +2,7 @@ Feature: Deactivate DID Scenario: Deactivate DID - Given Issuer creates unpublished DID + Given Issuer creates empty unpublished DID And Issuer publishes DID to ledger When Issuer deactivates PRISM DID Then He sees that PRISM DID is successfully deactivated diff --git a/tests/integration-tests/src/test/resources/features/did/update_did.feature b/tests/integration-tests/src/test/resources/features/did/update_did.feature index 9aeb2e122f..6e3166fd78 100644 --- a/tests/integration-tests/src/test/resources/features/did/update_did.feature +++ b/tests/integration-tests/src/test/resources/features/did/update_did.feature @@ -2,7 +2,7 @@ Feature: Update DID Background: Published DID is created - Given Issuer has a published DID for JWT + Given Issuer has a published DID for 'JWT' Scenario: Update PRISM DID services When Issuer updates PRISM DID with new services @@ -17,7 +17,7 @@ Feature: Update DID Then He sees the PRISM DID should have been updated successfully And He sees the PRISM DID should have the service removed - Scenario Outline: Update PRISM DID keys + Scenario Outline: Update PRISM DID keys using for When Issuer updates PRISM DID by adding new key with curve and purpose Then He sees PRISM DID was successfully updated with new keys of purpose diff --git a/tests/integration-tests/src/test/resources/features/multitenancy/wallets.feature b/tests/integration-tests/src/test/resources/features/multitenancy/wallets.feature index f6f0cdf0c7..83ba9f0459 100644 --- a/tests/integration-tests/src/test/resources/features/multitenancy/wallets.feature +++ b/tests/integration-tests/src/test/resources/features/multitenancy/wallets.feature @@ -2,8 +2,8 @@ Feature: Wallets management Scenario Outline: Successful creation of a new wallet - When Admin creates new wallet with name - Then Admin should have a wallet with name + When Admin creates new wallet with name '' + Then Admin should have a wallet with name '' Examples: | name | | "wallet-1" | diff --git a/tests/integration-tests/src/test/resources/features/oid4vci/issue_jwt.feature b/tests/integration-tests/src/test/resources/features/oid4vci/issue_jwt.feature index 00c7bf2f45..a48859a8e5 100644 --- a/tests/integration-tests/src/test/resources/features/oid4vci/issue_jwt.feature +++ b/tests/integration-tests/src/test/resources/features/oid4vci/issue_jwt.feature @@ -2,20 +2,20 @@ Feature: Issue JWT Credentials using OID4VCI authorization code flow Background: - Given Issuer has a published DID for OIDC_JWT - And Issuer has published STUDENT_SCHEMA schema + Given Issuer has a published DID for 'OIDC_JWT' + And Issuer has published 'STUDENT_SCHEMA' schema And Issuer has an existing oid4vci issuer - And Issuer has "StudentProfile" credential configuration created from STUDENT_SCHEMA + And Issuer has 'StudentProfile' credential configuration created from 'STUDENT_SCHEMA' Scenario: Issuing credential with published PRISM DID - When Issuer creates an offer using "StudentProfile" configuration with "short" form DID + When Issuer creates an offer using 'StudentProfile' configuration with 'short' form DID And Holder receives oid4vci offer from Issuer And Holder resolves oid4vci issuer metadata and login via front-end channel And Holder presents the access token with JWT proof on CredentialEndpoint Then Holder sees credential issued successfully from CredentialEndpoint Scenario: Issuing credential with unpublished PRISM DID - When Issuer creates an offer using "StudentProfile" configuration with "long" form DID + When Issuer creates an offer using 'StudentProfile' configuration with 'long' form DID And Holder receives oid4vci offer from Issuer And Holder resolves oid4vci issuer metadata and login via front-end channel And Holder presents the access token with JWT proof on CredentialEndpoint diff --git a/tests/integration-tests/src/test/resources/features/oid4vci/manage_credential_config.feature b/tests/integration-tests/src/test/resources/features/oid4vci/manage_credential_config.feature index 669fe6977e..991f93ea24 100644 --- a/tests/integration-tests/src/test/resources/features/oid4vci/manage_credential_config.feature +++ b/tests/integration-tests/src/test/resources/features/oid4vci/manage_credential_config.feature @@ -2,22 +2,22 @@ Feature: Manage OID4VCI credential configuration Background: - Given Issuer has a published DID for OIDC_JWT - And Issuer has published STUDENT_SCHEMA schema + Given Issuer has a published DID for 'OIDC_JWT' + And Issuer has published 'STUDENT_SCHEMA' schema And Issuer has an existing oid4vci issuer Scenario: Successfully create credential configuration - Given Issuer has "StudentProfile" credential configuration created from STUDENT_SCHEMA - Then Issuer sees the "StudentProfile" configuration on IssuerMetadata endpoint + Given Issuer has 'StudentProfile' credential configuration created from 'STUDENT_SCHEMA' + Then Issuer sees the 'StudentProfile' configuration on IssuerMetadata endpoint Scenario: Successfully delete credential configuration - Given Issuer has "StudentProfile" credential configuration created from STUDENT_SCHEMA - When Issuer deletes "StudentProfile" credential configuration - Then Issuer cannot see the "StudentProfile" configuration on IssuerMetadata endpoint + Given Issuer has 'StudentProfile' credential configuration created from 'STUDENT_SCHEMA' + When Issuer deletes 'StudentProfile' credential configuration + Then Issuer cannot see the 'StudentProfile' configuration on IssuerMetadata endpoint Scenario Outline: Create configuration with expect code When Issuer creates a new credential configuration request - And Issuer uses issuer id for credential configuration + And Issuer uses '' issuer id for credential configuration And Issuer adds '' configuration id for credential configuration request And Issuer adds '' format for credential configuration request And Issuer adds '' schemaId for credential configuration request @@ -35,5 +35,5 @@ Feature: Manage OID4VCI credential configuration | existing | StudentProfile | jwt_vc_json | STUDENT_SCHEMA | 409 | Duplicated credential | duplicated configuration id | Scenario: Delete non existent credential configuration - When Issuer deletes a non existent "NonExistentProfile" credential configuration + When Issuer deletes a non existent 'NonExistentProfile' credential configuration Then Issuer should see that create credential configuration has failed with '404' status code and 'There is no credential configuration' detail diff --git a/tests/integration-tests/src/test/resources/features/oid4vci/manage_issuer.feature b/tests/integration-tests/src/test/resources/features/oid4vci/manage_issuer.feature index 6259934824..4ba9f9bbf7 100644 --- a/tests/integration-tests/src/test/resources/features/oid4vci/manage_issuer.feature +++ b/tests/integration-tests/src/test/resources/features/oid4vci/manage_issuer.feature @@ -18,18 +18,18 @@ Feature: Manage OID4VCI credential issuer Then Issuer cannot see the oid4vci issuer on the agent And Issuer cannot see the oid4vci IssuerMetadata endpoint - Scenario Outline: Create issuer with expect response + Scenario Outline: Create issuer with [id=; url=; clientId=; clientSecret=] expect response When Issuer tries to create oid4vci issuer with '', '', '' and '' Then Issuer should see the oid4vci '' http status response with '' detail Examples: - | id | url | clientId | clientSecret | httpStatus | errorDetail | description | - | null | null | null | null | 400 | authorizationServer.url | null values | - | null | malformed | id | secret | 400 | Relative URL 'malformed' is not | malformed url | - | null | http://example.com | id | null | 400 | authorizationServer.clientSecret | null client secret | - | null | http://example.com | null | secret | 400 | authorizationServer.clientId | null client id | - | null | null | id | secret | 400 | authorizationServer.url | null url | - | 4048ef76-749d-4296-8c6c-07c8a20733a0 | http://example.com | id | secret | 201 | | right values | - | 4048ef76-749d-4296-8c6c-07c8a20733a0 | http://example.com | id | secret | 500 | | duplicated id | + | id | url | clientId | clientSecret | httpStatus | errorDetail | + | null | null | null | null | 400 | authorizationServer.url | + | null | malformed | id | secret | 400 | Relative URL 'malformed' is not | + | null | http://example.com | id | null | 400 | authorizationServer.clientSecret | + | null | http://example.com | null | secret | 400 | authorizationServer.clientId | + | null | null | id | secret | 400 | authorizationServer.url | + | 4048ef76-749d-4296-8c6c-07c8a20733a0 | http://example.com | id | secret | 201 | | + | 4048ef76-749d-4296-8c6c-07c8a20733a0 | http://example.com | id | secret | 500 | | Scenario Outline: Update issuer with expect response Given Issuer has an existing oid4vci issuer diff --git a/tests/integration-tests/src/test/resources/features/schemas/credential_schemas.feature b/tests/integration-tests/src/test/resources/features/schemas/credential_schemas.feature index fdbbbc911f..d06b5a0090 100644 --- a/tests/integration-tests/src/test/resources/features/schemas/credential_schemas.feature +++ b/tests/integration-tests/src/test/resources/features/schemas/credential_schemas.feature @@ -2,10 +2,10 @@ Feature: Credential schemas Background: - Given Issuer creates unpublished DID + Given Issuer creates empty unpublished DID Scenario: Successful schema creation - When Issuer creates a new credential STUDENT_SCHEMA schema + When Issuer creates a new credential 'STUDENT_SCHEMA' schema Then He sees new credential schema is available Scenario Outline: Multiple schema creation @@ -15,7 +15,7 @@ Feature: Credential schemas | schemas | | 4 | - Scenario Outline: Schema creation should fail for cases + Scenario Outline: Schema creation should fail for When Issuer creates a schema containing '' issue Then Issuer should see the schema creation failed Examples: diff --git a/tests/integration-tests/src/test/resources/features/verificationapi/vc_verification.feature b/tests/integration-tests/src/test/resources/features/verificationapi/vc_verification.feature index 3db147f66d..6b74dc000c 100644 --- a/tests/integration-tests/src/test/resources/features/verificationapi/vc_verification.feature +++ b/tests/integration-tests/src/test/resources/features/verificationapi/vc_verification.feature @@ -1,8 +1,8 @@ @verification @api -Feature: Vc Verification schemas +Feature: Verification API - Scenario: Receive a jwt vc from cloud-agent and verify it - Given Holder has a jwt issued credential with STUDENT_SCHEMA schema from Issuer + Scenario: Verify a jwt credential using verification api + Given Holder has a jwt issued credential with 'STUDENT_SCHEMA' schema from Issuer And Holder uses that JWT VC issued from Issuer for Verification API And Holder sends the JWT Credential to Issuer Verification API | ALGORITHM_VERIFICATION | true | @@ -14,7 +14,7 @@ Feature: Vc Verification schemas | SEMANTIC_CHECK_OF_CLAIMS | true | Then Holder should see that all checks have passed - Scenario: Expected checks for generated JWT VC + Scenario: Verify a pre-generated jwt credential using verification api Given Holder has a JWT VC for Verification API When Holder sends the JWT Credential to Issuer Verification API | ALGORITHM_VERIFICATION | true | @@ -26,11 +26,11 @@ Feature: Vc Verification schemas | SEMANTIC_CHECK_OF_CLAIMS | true | Then Holder should see that all checks have passed - Scenario Outline: Expected failures - Given Holder has a problem in the Verifiable Credential + Scenario Outline: Verify credential with problem + Given Holder has a '' problem in the Verifiable Credential When Holder sends the JWT Credential to Issuer Verification API | | false | - Then Holder should see that verification has failed with problem + Then Holder should see that verification has failed with '' problem Examples: | problem | | ALGORITHM_VERIFICATION | @@ -41,7 +41,7 @@ Feature: Vc Verification schemas | SIGNATURE_VERIFICATION | | SEMANTIC_CHECK_OF_CLAIMS | - Scenario Outline: Unsupported verification check should fail + Scenario Outline: Unsupported verification check should fail Given Holder has a JWT VC for Verification API When Holder sends the JWT Credential to Issuer Verification API | | false |