Skip to content

Commit

Permalink
test: zkp verification
Browse files Browse the repository at this point in the history
  • Loading branch information
amagyar-iohk committed Mar 28, 2024
1 parent cad2898 commit e7c7431
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 39 deletions.
@@ -1,4 +1,4 @@
@connectionx
@anoncred @proof
Feature: Provide proof
The Edge Agent should provide proof to Cloud Agent

Expand Down
2 changes: 1 addition & 1 deletion integration-tests/e2e-tests/package.json
Expand Up @@ -4,7 +4,7 @@
"main": "index.ts",
"scripts": {
"clean": "rimraf target",
"test:sdk": "yarn clean && cucumber-js -b --tags '@connectionx'"
"test:sdk": "yarn clean && cucumber-js -b"
},
"repository": {
"type": "git",
Expand Down
Expand Up @@ -202,7 +202,7 @@ export class CloudAgentConfiguration {
version: "1.0.0",
tag: "automation-test",
author: this.publishedDid,
schemaId: `${this.agentUrl}schema-registry/schemas/${newSchemaGuid}/schema`,
schemaId: `${this.agentUrl}/schema-registry/schemas/${newSchemaGuid}/schema`,
signatureType: "CL",
supportRevocation: false,
description: "Test Automation Auto-Generated TS"
Expand Down
68 changes: 32 additions & 36 deletions integration-tests/e2e-tests/src/workflow/CloudAgentWorkflow.ts
Expand Up @@ -22,7 +22,7 @@ export class CloudAgentWorkflow {
createConnection.goal = goal

await cloudAgent.attemptsTo(
Send.a(PostRequest.to("connections").with(createConnection)),
Send.a(PostRequest.to("/connections").with(createConnection)),
Ensure.that(LastResponse.status(), equals(HttpStatusCode.Created)),
Notepad.notes().set(
"invitation",
Expand All @@ -45,7 +45,7 @@ export class CloudAgentWorkflow {
)
await cloudAgent.attemptsTo(
Wait.upTo(Duration.ofMinutes(2)).until(
Questions.httpGet(`connections/${connectionId}`),
Questions.httpGet(`/connections/${connectionId}`),
Expectations.propertyValueToBe("state", state)
)
)
Expand All @@ -54,7 +54,7 @@ export class CloudAgentWorkflow {
static async verifyCredentialState(cloudAgent: Actor, recordId: string, state: string) {
await cloudAgent.attemptsTo(
Wait.upTo(Duration.ofMinutes(2)).until(
Questions.httpGet(`issue-credentials/records/${recordId}`),
Questions.httpGet(`/issue-credentials/records/${recordId}`),
Expectations.propertyValueToBe("protocolState", state)
)
)
Expand All @@ -66,7 +66,7 @@ export class CloudAgentWorkflow {
)
await cloudAgent.attemptsTo(
Wait.upTo(Duration.ofMinutes(2)).until(
Questions.httpGet(`present-proof/presentations/${presentationId}`),
Questions.httpGet(`/present-proof/presentations/${presentationId}`),
Expectations.propertyValueToBe("status", state)
)
)
Expand All @@ -86,7 +86,7 @@ export class CloudAgentWorkflow {

await cloudAgent.attemptsTo(
Send.a(
PostRequest.to("issue-credentials/credential-offers").with(credential)
PostRequest.to("/issue-credentials/credential-offers").with(credential)
)
)
await cloudAgent.attemptsTo(
Expand All @@ -112,7 +112,7 @@ export class CloudAgentWorkflow {

await cloudAgent.attemptsTo(
Send.a(
PostRequest.to("issue-credentials/credential-offers").with(credential)
PostRequest.to("/issue-credentials/credential-offers").with(credential)
)
)
await cloudAgent.attemptsTo(
Expand All @@ -137,52 +137,48 @@ export class CloudAgentWorkflow {

await cloudAgent.attemptsTo(
Send.a(
PostRequest.to("present-proof/presentations").with(presentProofRequest)
PostRequest.to("/present-proof/presentations").with(presentProofRequest)
),
Notepad.notes().set("presentationId", LastResponse.body().presentationId)
)
}

static async askForPresentProofAnonCreds(cloudAgent: Actor) {
const anoncredGuid = CloudAgentConfiguration.anoncredDefinitionGuid
const definitionUrl = `${CloudAgentConfiguration.agentUrl}/credential-definition-registry/definitions/${anoncredGuid}/definition`
const connectionId = await cloudAgent.answer(Notepad.notes().get("connectionId"))

const cred_def_id = CloudAgentConfiguration.agentUrl +
"credential-definition-registry/definitions/" +
CloudAgentConfiguration.anoncredDefinitionGuid +
"/definition";
const connectionId = await cloudAgent.answer(Notepad.notes().get("connectionId"));
const presentationRequest = {
"connectionId": connectionId,
"credentialFormat": "AnonCreds",
"anoncredPresentationRequest": {
"requested_attributes": {
"gender": {
"name": "gender",
"restrictions": [
{
"attr::gender::value": "M",
"cred_def_id": cred_def_id
}
]
connectionId: connectionId,
credentialFormat: "AnonCreds",
anoncredPresentationRequest: {
requested_attributes: {
gender: {
name: "gender",
restrictions: [{
"attr::gender::value": "M",
cred_def_id: definitionUrl
}]
}
},
"requested_predicates": {
"age": {
"name": "age",
"p_type": ">=",
"p_value": 18,
"restrictions": []
requested_predicates: {
age: {
name: "age",
p_type: ">=",
p_value: 18,
restrictions: []
}
},
"name": "proof_req_1",
"nonce": randomUUID(),
"version": "0.1"
name: "proof_req_1",
nonce: "1103253414365527824079144",
version: "0.1"
},
"proofs": []
proofs: [],
options: null
}

// Dispatch:
await cloudAgent.attemptsTo(
Send.a(PostRequest.to("present-proof/presentations").with(presentationRequest)),
Send.a(PostRequest.to("/present-proof/presentations").with(presentationRequest)),
Notepad.notes().set("presentationId", LastResponse.body().presentationId)
)
}
Expand Down

0 comments on commit e7c7431

Please sign in to comment.