Skip to content

Commit

Permalink
Merge pull request WebOfTrust#69 from cardano-foundation/revoke
Browse files Browse the repository at this point in the history
Fix revoke response and throwing errors from Keri
  • Loading branch information
rodolfomiranda authored Jul 24, 2023
2 parents 36692c7 + e8e1200 commit 4989c06
Show file tree
Hide file tree
Showing 11 changed files with 67 additions and 53 deletions.
3 changes: 3 additions & 0 deletions examples/integration-scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ If the script depends on witnesses, you need to have [keripy](https://github.com
Additionally, if the script also depends on schemas you need to have [vLEI server](https://github.com/WebOfTrust/vLEI) installed and running with:
`vLEI-server -s ./schema/acdc -c ./samples/acdc/ -o ./samples/oobis/`

You can also execute all script the scrip:
`run_all.sh`

12 changes: 6 additions & 6 deletions examples/integration-scripts/challenge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import('signify-ts').then(
(module) => {
signify = module
signify.ready().then(() => {
console.log("Signify client ready!");
console.log("*** Starting CHALLENGE test ***");
run().then(() => {
console.log("Test complete.")
console.log("*** Test complete ***")
});
});
}
Expand Down Expand Up @@ -48,7 +48,7 @@ async function run() {
"BIKKuvBwpmDVA4Ds-EpL5bt9OqPzWPja2LigFYZN2YfX"]
})
while (!op1["done"] ) {
op1 = await client1.operations().get(op1["name"]);
op1 = await client1.operations().get(op1.name);
await new Promise(resolve => setTimeout(resolve, 1000));
}
const aid1 = op1['response']
Expand All @@ -63,7 +63,7 @@ async function run() {
"BIKKuvBwpmDVA4Ds-EpL5bt9OqPzWPja2LigFYZN2YfX"]
})
while (!op2["done"] ) {
op2 = await client2.operations().get(op2["name"]);
op2 = await client2.operations().get(op2.name);
await new Promise(resolve => setTimeout(resolve, 1000));
}
const aid2 = op2['response']
Expand All @@ -76,13 +76,13 @@ async function run() {

op1 = await client1.oobis().resolve(oobi2.oobis[0],"bob")
while (!op1["done"]) {
op1 = await client1.operations().get(op1["name"]);
op1 = await client1.operations().get(op1.name);
await new Promise(resolve => setTimeout(resolve, 1000));
}
console.log("Client 1 resolved Bob's OOBI")
op2 = await client2.oobis().resolve(oobi1.oobis[0],"alice")
while (!op2["done"]) {
op2 = await client2.operations().get(op2["name"]);
op2 = await client2.operations().get(op2.name);
await new Promise(resolve => setTimeout(resolve, 1000));
}
console.log("Client 2 resolved Alice's OOBI")
Expand Down
45 changes: 27 additions & 18 deletions examples/integration-scripts/credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import('signify-ts').then(
(module) => {
signify = module
signify.ready().then(() => {
console.log("Signify client ready!");
console.log("*** Starting CREDENTIALS test ***");
run().then(() => {
console.log("Test complete.")
console.log("*** Test complete ***")
});
});
}
Expand Down Expand Up @@ -49,7 +49,7 @@ async function run() {
"BIKKuvBwpmDVA4Ds-EpL5bt9OqPzWPja2LigFYZN2YfX"]
})
while (!op1["done"] ) {
op1 = await client1.operations().get(op1["name"]);
op1 = await client1.operations().get(op1.name);
await new Promise(resolve => setTimeout(resolve, 1000));
}
const aid1 = await client1.identifiers().get("issuer")
Expand All @@ -64,7 +64,7 @@ async function run() {
"BIKKuvBwpmDVA4Ds-EpL5bt9OqPzWPja2LigFYZN2YfX"]
})
while (!op2["done"] ) {
op2 = await client2.operations().get(op2["name"]);
op2 = await client2.operations().get(op2.name);
await new Promise(resolve => setTimeout(resolve, 1000));
}
const aid2 = await client2.identifiers().get("recipient")
Expand All @@ -79,7 +79,7 @@ async function run() {
"BIKKuvBwpmDVA4Ds-EpL5bt9OqPzWPja2LigFYZN2YfX"]
})
while (!op3["done"] ) {
op3 = await client3.operations().get(op3["name"]);
op3 = await client3.operations().get(op3.name);
await new Promise(resolve => setTimeout(resolve, 1000));
}
const aid3 = await client3.identifiers().get("verifier")
Expand All @@ -97,59 +97,59 @@ async function run() {

op1 = await client1.oobis().resolve(oobi2.oobis[0],"recipient")
while (!op1["done"]) {
op1 = await client1.operations().get(op1["name"]);
op1 = await client1.operations().get(op1.name);
await new Promise(resolve => setTimeout(resolve, 1000));
}
op1 = await client1.oobis().resolve(oobi3.oobis[0],"verifier")
while (!op1["done"]) {
op1 = await client1.operations().get(op1["name"]);
op1 = await client1.operations().get(op1.name);
await new Promise(resolve => setTimeout(resolve, 1000));
}
op1 = await client1.oobis().resolve(schemaOobi,"schema")
while (!op1["done"]) {
op1 = await client1.operations().get(op1["name"]);
op1 = await client1.operations().get(op1.name);
await new Promise(resolve => setTimeout(resolve, 1000));
}
console.log("Issuer resolved 3 OOBIs")

op2 = await client2.oobis().resolve(oobi1.oobis[0],"issuer")
while (!op2["done"]) {
op2 = await client2.operations().get(op2["name"]);
op2 = await client2.operations().get(op2.name);
await new Promise(resolve => setTimeout(resolve, 1000));
}
op2 = await client2.oobis().resolve(oobi3.oobis[0],"verifier")
while (!op2["done"]) {
op2 = await client2.operations().get(op2["name"]);
op2 = await client2.operations().get(op2.name);
await new Promise(resolve => setTimeout(resolve, 1000));
}
op2 = await client2.oobis().resolve(schemaOobi,"schema")
while (!op2["done"]) {
op2 = await client2.operations().get(op2["name"]);
op2 = await client2.operations().get(op2.name);
await new Promise(resolve => setTimeout(resolve, 1000));
}
console.log("Recipient resolved 3 OOBIs")

op3 = await client3.oobis().resolve(oobi1.oobis[0],"issuer")
while (!op3["done"]) {
op3 = await client3.operations().get(op3["name"]);
op3 = await client3.operations().get(op3.name);
await new Promise(resolve => setTimeout(resolve, 1000));
}
op3 = await client3.oobis().resolve(oobi2.oobis[0],"recipient")
while (!op3["done"]) {
op3 = await client3.operations().get(op3["name"]);
op3 = await client3.operations().get(op3.name);
await new Promise(resolve => setTimeout(resolve, 1000));
}
op3 = await client3.oobis().resolve(schemaOobi,"schema")
while (!op3["done"]) {
op3 = await client3.operations().get(op3["name"]);
op3 = await client3.operations().get(op3.name);
await new Promise(resolve => setTimeout(resolve, 1000));
}
console.log("Verifier resolved 3 OOBIs")

// Create registry for issuer
op1 = await client1.registries().create('issuer','vLEI')
while (!op1["done"]) {
op1 = await client1.operations().get(op1["name"]);
op1 = await client1.operations().get(op1.name);
await new Promise(resolve => setTimeout(resolve, 1000));
}
let registries = await client1.registries().list('issuer')
Expand All @@ -168,10 +168,9 @@ async function run() {
}
op1 = await client1.credentials().issue('issuer',registries[0].regk, schemaSAID,aid2.prefix,vcdata)
while (!op1["done"]) {
op1 = await client1.operations().get(op1["name"]);
op1 = await client1.operations().get(op1.name);
await new Promise(resolve => setTimeout(resolve, 1000));
}
// await new Promise(resolve => setTimeout(resolve, 20000))
let creds1 = await client1.credentials().list('issuer')
assert.equal(creds1.length, 1)
assert.equal(creds1[0].sad.s, schemaSAID)
Expand Down Expand Up @@ -199,7 +198,10 @@ async function run() {

// Revoke credential
op1 = await client1.credentials().revoke('issuer', creds1[0].sad.d)
await new Promise(resolve => setTimeout(resolve, 5000))
while (!op1["done"]) {
op1 = await client1.operations().get(op1.name);
await new Promise(resolve => setTimeout(resolve, 1000));
}
creds1 = await client1.credentials().list('issuer')
assert.equal(creds1.length, 1)
assert.equal(creds1[0].sad.s, schemaSAID)
Expand All @@ -208,6 +210,13 @@ async function run() {
console.log("Credential revoked")

// Recipient check revoked credential
let revoked = false
while (!revoked) {
let cred2 = await client2.credentials().get('recipient', creds1[0].sad.d)
if (cred2.status.s == "1") {
revoked = true
}
}
creds2 = await client2.credentials().list('recipient')
assert.equal(creds2.length, 1)
assert.equal(creds2[0].sad.s, schemaSAID)
Expand Down
10 changes: 5 additions & 5 deletions examples/integration-scripts/delegation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import('signify-ts').then(
(module) => {
signify = module
signify.ready().then(() => {
console.log("Signify client ready!");
console.log("*** Starting DELEGATION test ***");
run().then(() => {
console.log("Test complete.")
console.log("*** Test complete ***")
});
});
}
Expand Down Expand Up @@ -42,7 +42,7 @@ async function run() {
"BIKKuvBwpmDVA4Ds-EpL5bt9OqPzWPja2LigFYZN2YfX"]
})
while (!op1["done"] ) {
op1 = await client1.operations().get(op1["name"]);
op1 = await client1.operations().get(op1.name);
await new Promise(resolve => setTimeout(resolve, 1000));
}
const aid1 = await client1.identifiers().get("delegator")
Expand All @@ -54,7 +54,7 @@ async function run() {
let oobi1 = await client1.oobis().get("delegator","agent")
let op2 = await client2.oobis().resolve(oobi1.oobis[0],"delegator")
while (!op2["done"]) {
op2 = await client2.operations().get(op2["name"]);
op2 = await client2.operations().get(op2.name);
await new Promise(resolve => setTimeout(resolve, 1000));
}
console.log("OOBI resolved")
Expand All @@ -76,7 +76,7 @@ async function run() {

// Client 2 check approval
while (!op2["done"] ) {
op2 = await client2.operations().get(op2["name"]);
op2 = await client2.operations().get(op2.name);
await new Promise(resolve => setTimeout(resolve, 1000));
}
const aid2 = await client2.identifiers().get("delegate")
Expand Down
28 changes: 14 additions & 14 deletions examples/integration-scripts/multisig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import('signify-ts').then(
(module) => {
signify = module
signify.ready().then(() => {
console.log("Signify client ready!");
console.log("*** Starting MULTISIG test ***");
run().then(() => {
console.log("Test complete.")
console.log("*** Test complete ***")
});
});
}
Expand Down Expand Up @@ -49,7 +49,7 @@ async function run() {
"BIKKuvBwpmDVA4Ds-EpL5bt9OqPzWPja2LigFYZN2YfX"]
})
while (!op1["done"] ) {
op1 = await client1.operations().get(op1["name"]);
op1 = await client1.operations().get(op1.name);
await new Promise(resolve => setTimeout(resolve, 1000));
}
const aid1 = await client1.identifiers().get("multisig1")
Expand All @@ -64,7 +64,7 @@ async function run() {
"BIKKuvBwpmDVA4Ds-EpL5bt9OqPzWPja2LigFYZN2YfX"]
})
while (!op2["done"] ) {
op2 = await client2.operations().get(op2["name"]);
op2 = await client2.operations().get(op2.name);
await new Promise(resolve => setTimeout(resolve, 1000));
}
const aid2 = await client2.identifiers().get("multisig2")
Expand All @@ -79,7 +79,7 @@ async function run() {
"BIKKuvBwpmDVA4Ds-EpL5bt9OqPzWPja2LigFYZN2YfX"]
})
while (!op3["done"] ) {
op3 = await client3.operations().get(op3["name"]);
op3 = await client3.operations().get(op3.name);
await new Promise(resolve => setTimeout(resolve, 1000));
}
const aid3 = await client3.identifiers().get("multisig3")
Expand All @@ -94,36 +94,36 @@ async function run() {

op1 = await client1.oobis().resolve(oobi2.oobis[0],"multisig2")
while (!op1["done"]) {
op1 = await client1.operations().get(op1["name"]);
op1 = await client1.operations().get(op1.name);
await new Promise(resolve => setTimeout(resolve, 1000));
}
op1 = await client1.oobis().resolve(oobi3.oobis[0],"multisig3")
while (!op1["done"]) {
op1 = await client1.operations().get(op1["name"]);
op1 = await client1.operations().get(op1.name);
await new Promise(resolve => setTimeout(resolve, 1000));
}
console.log("Multisig1 resolved 2 OOBIs")

op2 = await client2.oobis().resolve(oobi1.oobis[0],"multisig1")
while (!op2["done"]) {
op2 = await client2.operations().get(op2["name"]);
op2 = await client2.operations().get(op2.name);
await new Promise(resolve => setTimeout(resolve, 1000));
}
op2 = await client2.oobis().resolve(oobi3.oobis[0],"multisig3")
while (!op2["done"]) {
op2 = await client2.operations().get(op2["name"]);
op2 = await client2.operations().get(op2.name);
await new Promise(resolve => setTimeout(resolve, 1000));
}
console.log("Multisig2 resolved 2 OOBIs")

op3 = await client3.oobis().resolve(oobi1.oobis[0],"multisig1")
while (!op3["done"]) {
op3 = await client3.operations().get(op3["name"]);
op3 = await client3.operations().get(op3.name);
await new Promise(resolve => setTimeout(resolve, 1000));
}
op3 = await client3.oobis().resolve(oobi2.oobis[0],"multisig2")
while (!op3["done"]) {
op3 = await client3.operations().get(op3["name"]);
op3 = await client3.operations().get(op3.name);
await new Promise(resolve => setTimeout(resolve, 1000));
}
console.log("Multisig3 resolved 2 OOBIs")
Expand Down Expand Up @@ -177,15 +177,15 @@ async function run() {
console.log("Multisig3 joined multisig waiting for others...")

while (!op1["done"]) {
op1 = await client1.operations().get(op1["name"]);
op1 = await client1.operations().get(op1.name);
await new Promise(resolve => setTimeout(resolve, 1000));
}
while (!op2["done"]) {
op2 = await client2.operations().get(op2["name"]);
op2 = await client2.operations().get(op2.name);
await new Promise(resolve => setTimeout(resolve, 1000));
}
while (!op3["done"]) {
op3 = await client3.operations().get(op3["name"]);
op3 = await client3.operations().get(op3.name);
await new Promise(resolve => setTimeout(resolve, 1000));
}
console.log("Multisig created!")
Expand Down
4 changes: 2 additions & 2 deletions examples/integration-scripts/randy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import('signify-ts').then(
(module) => {
signify = module
signify.ready().then(() => {
console.log("Signify client ready!");
console.log("*** Starting RANDY test ***");
run().then(() => {
console.log("Test complete.")
console.log("*** Test complete ***")
});
});
}
Expand Down
1 change: 1 addition & 0 deletions examples/integration-scripts/run_all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
for f in ./*.ts; do ts-node --esm $f; done
4 changes: 2 additions & 2 deletions examples/integration-scripts/salty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import('signify-ts').then(
(module) => {
signify = module
signify.ready().then(() => {
console.log("Signify client ready!");
console.log("*** Starting SALTY test ***");
run().then(() => {
console.log("Test complete.")
console.log("*** Test complete ***")
});
});
}
Expand Down
Empty file.
8 changes: 4 additions & 4 deletions examples/integration-scripts/witness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import('signify-ts').then(
(module) => {
signify = module
signify.ready().then(() => {
console.log("Signify client ready!");
console.log("*** Starting WITNESS test ***");
run().then(() => {
console.log("Test complete.")
console.log("*** Test complete ***")
});
});
}
Expand All @@ -33,7 +33,7 @@ async function run() {
// Client 1 resolves witness OOBI
let op1 = await client1.oobis().resolve("http://127.0.0.1:5642/oobi/" + witness,"wit")
while (!op1["done"]) {
op1 = await client1.operations().get(op1["name"]);
op1 = await client1.operations().get(op1.name);
await new Promise(resolve => setTimeout(resolve, 1000));
}
console.log("Witness OOBI resolved")
Expand All @@ -44,7 +44,7 @@ async function run() {
wits: ["BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha"]
})
while (!op1["done"] ) {
op1 = await client1.operations().get(op1["name"]);
op1 = await client1.operations().get(op1.name);
await new Promise(resolve => setTimeout(resolve, 1000));
}
const aid1 = await client1.identifiers().get("aid1")
Expand Down
Loading

0 comments on commit 4989c06

Please sign in to comment.