-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add sd-jwt integration test (#1260)
Signed-off-by: Allain Magyar <[email protected]> Signed-off-by: Hyperledger Bot <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Hyperledger Bot <[email protected]>
- Loading branch information
1 parent
c30e310
commit fafeee6
Showing
30 changed files
with
1,014 additions
and
628 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package models | ||
|
||
data class SdJwtClaim( | ||
val salt: String, | ||
val key: String, | ||
val value: String, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
tests/integration-tests/src/test/kotlin/steps/credentials/AnoncredSteps.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package steps.credentials | ||
|
||
import interactions.Post | ||
import interactions.body | ||
import io.cucumber.java.en.When | ||
import io.iohk.atala.automation.extensions.get | ||
import io.iohk.atala.automation.serenity.ensure.Ensure | ||
import net.serenitybdd.rest.SerenityRest | ||
import net.serenitybdd.screenplay.Actor | ||
import org.apache.http.HttpStatus.SC_CREATED | ||
import org.apache.http.HttpStatus.SC_OK | ||
import org.hyperledger.identus.client.models.* | ||
|
||
class AnoncredSteps { | ||
|
||
@When("{actor} accepts anoncred credential offer") | ||
fun holderAcceptsCredentialOfferForAnoncred(holder: Actor) { | ||
val recordId = holder.recall<String>("recordId") | ||
holder.attemptsTo( | ||
Post.to("/issue-credentials/records/$recordId/accept-offer").body("{}"), | ||
Ensure.thatTheLastResponse().statusCode().isEqualTo(SC_OK), | ||
) | ||
} | ||
|
||
@When("{actor} offers anoncred to {actor}") | ||
fun acmeOffersAnoncredToBob(issuer: Actor, holder: Actor) { | ||
val credentialOfferRequest = CreateIssueCredentialRecordRequest( | ||
credentialDefinitionId = issuer.recall<CredentialDefinitionResponse>("anoncredsCredentialDefinition").guid, | ||
claims = linkedMapOf( | ||
"name" to "Bob", | ||
"age" to "21", | ||
"sex" to "M", | ||
), | ||
issuingDID = issuer.recall("shortFormDid"), | ||
connectionId = issuer.recall<Connection>("connection-with-${holder.name}").connectionId, | ||
validityPeriod = 3600.0, | ||
credentialFormat = "AnonCreds", | ||
automaticIssuance = false, | ||
) | ||
|
||
issuer.attemptsTo( | ||
Post.to("/issue-credentials/credential-offers").body(credentialOfferRequest), | ||
Ensure.thatTheLastResponse().statusCode().isEqualTo(SC_CREATED), | ||
) | ||
|
||
val credentialRecord = SerenityRest.lastResponse().get<IssueCredentialRecord>() | ||
issuer.remember("thid", credentialRecord.thid) | ||
holder.remember("thid", credentialRecord.thid) | ||
} | ||
} |
Oops, something went wrong.