-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(CAHN Demo): ♻️ util function, fix ordering of parameters in prol…
…og rule
- Loading branch information
Showing
16 changed files
with
417 additions
and
368 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
25 changes: 25 additions & 0 deletions
25
packages/cahn_demo/client/src/app/utils/createUnsignedRetractionVC.js
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,25 @@ | ||
import { retraction } from "@/schemas"; | ||
import { v4 as uuidv4 } from "uuid"; | ||
|
||
const createUnsignedRetractionVC = (idToRevoke) => { | ||
const retractionClaim = { | ||
type: "retraction", | ||
id: `urn:uuid:${uuidv4()}`, | ||
timestamp: Date.now(), | ||
claim_id: idToRevoke, | ||
}; | ||
|
||
const vc_data = JSON.parse(JSON.stringify(retraction)); | ||
vc_data.credentialSubject = retractionClaim; | ||
vc_data.credentialSchema.id = | ||
"https://github.com/nqminds/CAHN/blob/main/packages/schemas/src/retraction.v.1.0.0.schema.yaml"; | ||
|
||
const vc = new window.VerifiableCredential( | ||
vc_data, | ||
JSON.stringify(retraction) | ||
); | ||
|
||
return vc; | ||
}; | ||
|
||
export default createUnsignedRetractionVC; |
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,44 @@ | ||
{ | ||
"@context": ["https://www.w3.org/ns/credentials/v2"], | ||
"id": "urn:uuid:1cb63635-d3d1-47c1-b653-11e9948ea223", | ||
"type": ["VerifiableCredential", "UserCredential"], | ||
"issuer": "urn:uuid:4e3c2a77-beb1-4ad9-aa8a-c93be6004a7b", | ||
"validFrom": "2024-08-28T14:15:50.312133Z", | ||
"credentialSchema": { | ||
"id": "6924ca71-3c53-4e44-ae03-efb15889f3b5", | ||
"type": "JsonSchema" | ||
}, | ||
"credentialSubject": { | ||
"type": "schema", | ||
"id": "f29ba91e-509f-4c87-a239-b1e81afa941c", | ||
"timestamp": 1716131759000, | ||
"schemaName": "retraction", | ||
"schema": { | ||
"$schema": "https://json-schema.org/draft/2020-12/schema", | ||
"$id": "https://github.com/nqminds/CAHN/blob/main/packages/schemas/src/device.v.1.0.0.schema.yaml", | ||
"title": "retraction", | ||
"description": "retraction", | ||
"type": "object", | ||
"properties": { | ||
"id": { | ||
"description": "id of the device", | ||
"type": "string" | ||
}, | ||
"claim_id": { | ||
"description": "id of the claim that is being retracted", | ||
"type": "string" | ||
}, | ||
"timestamp": { | ||
"description": "timestamp at which the retraction was made in milliseconds", | ||
"type": "string" | ||
}, | ||
"type": { | ||
"description": "which type of claim is being made", | ||
"type": "string", | ||
"const": "retraction" | ||
} | ||
}, | ||
"required": ["id", "claim_id", "timestamp", "type"] | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"henry@nquiringminds.com": [ | ||
"9TgqqUgXTTNBuD7qz9vNouf/26IhCucYpivXoUqSvI8=" | ||
"0xcwX2RHPNQo1+vzqZJ7dsq8DhYbuLc2hviAjBqTGjw=" | ||
] | ||
} |
Oops, something went wrong.