From 39c931cde9737d4e1b512f1ecd7490f06f722b54 Mon Sep 17 00:00:00 2001 From: Matthew Aaron Raymer Date: Wed, 4 Jan 2023 17:15:11 +0800 Subject: [PATCH] A touch of documenting process --- src/views/NewEditProjectView.vue | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/views/NewEditProjectView.vue b/src/views/NewEditProjectView.vue index 2752599f..211ec0cf 100644 --- a/src/views/NewEditProjectView.vue +++ b/src/views/NewEditProjectView.vue @@ -93,6 +93,7 @@ export default class NewEditProjectView extends Vue { const accounts = await db.accounts.toArray(); const identity = JSON.parse(accounts[0].identity); const address = identity.did; + // Make a claim const vcClaim = { "@context": "https://schema.org", "@type": "PlanAction", @@ -100,6 +101,7 @@ export default class NewEditProjectView extends Vue { name: this.projectName, description: this.description, }; + // Make a payload for the claim const vcPayload = { sub: "PlanAction", vc: { @@ -108,14 +110,18 @@ export default class NewEditProjectView extends Vue { credentialSubject: vcClaim, }, }; + // create a signature using private key of identity const signer = await sign(identity.keys[0].privateKeyHex); const alg = undefined; + // create a JWT for the request const vcJwt: string = await didJwt.createJWT(vcPayload, { alg, issuer: identity, signer, }); + // Make the xhr request payload + const payload = JSON.stringify({ jwtEncoded: vcJwt }); const endorserApiServer = AppString.DEFAULT_ENDORSER_API_SERVER; const url = endorserApiServer + "/api/claim";