Browse Source

A touch of documenting process

simple-signer
Matthew Aaron Raymer 2 years ago
parent
commit
39c931cde9
  1. 6
      src/views/NewEditProjectView.vue

6
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";

Loading…
Cancel
Save