Skip to content

Commit

Permalink
Merge pull request #60 from cardano-foundation/vc_presentation
Browse files Browse the repository at this point in the history
Add revocation
  • Loading branch information
rodolfomiranda authored Jul 14, 2023
2 parents 6d18dd3 + bfda1d5 commit deeae2e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
1 change: 1 addition & 0 deletions examples/signify-react-ts/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions examples/signify-react-ts/src/test_components/Credentials.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,22 @@ export function Credentials() {
// await new Promise(resolve => setTimeout(resolve, 20000))
let creds = await client1.credentials().list('issuer',CredentialTypes.received,'')
await client1.credentials().list('issuer',CredentialTypes.issued,'')
await client2.credentials().list('recipient',CredentialTypes.received,'')

await client1.credentials().present_credential('issuer', creds[0].sad.d, 'verifier', true)
await new Promise(resolve => setTimeout(resolve, 5000))
await client3.credentials().list('verifier',CredentialTypes.received,'')

op1 = await client1.credentials().revoke_credential('issuer', creds[0], false)
// while (!op1["done"]) {
// op1 = await operations1.get(op1["name"]);
// await new Promise(resolve => setTimeout(resolve, 1000)); // sleep for 1 second
// }
await new Promise(resolve => setTimeout(resolve, 5000))
await client1.credentials().list('issuer',CredentialTypes.issued,'')
await client2.credentials().list('recipient',CredentialTypes.issued,'')
await client3.credentials().list('verifier',CredentialTypes.issued,'')

await client1.credentials().present_credential('issuer', creds[0].sad.d, 'verifier', true)
await new Promise(resolve => setTimeout(resolve, 5000))
await client3.credentials().list('verifier',CredentialTypes.received,'')
Expand Down
8 changes: 5 additions & 3 deletions src/keri/app/signify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -847,22 +847,25 @@ class Credentials {

}

async revoke_credential(name: string, registy: string, said: string, send?: string, estOnly:boolean=false) {
async revoke_credential(name: string, cred: any, estOnly:boolean=false) {

let hab = await this.client.identifiers().get_identifier(name)
let pre: string = hab["prefix"]

const vs = versify(Ident.KERI, undefined, Serials.JSON, 0)
const dt = new Date().toISOString().replace('Z', '000+00:00')

const said = cred.sad.d

// Create rev
let _rev = {
v: vs,
t: Ilks.rev,
d: "",
i: said,
s: "1",
ri: registy,
p: cred.status.d,
ri: cred.sad.ri,
dt: dt

}
Expand Down Expand Up @@ -897,7 +900,6 @@ class Credentials {
}

let body = {
said: said,
rev: rev,
ixn: ixn,
sigs: sigs
Expand Down

0 comments on commit deeae2e

Please sign in to comment.