remove remaining getIdentity calls & fix QR code for did:peer

This commit is contained in:
2024-07-15 20:47:10 -06:00
parent f7f38789d2
commit cd0a31e6f5
9 changed files with 86 additions and 71 deletions

View File

@@ -175,7 +175,6 @@
import "leaflet/dist/leaflet.css";
import { AxiosError } from "axios";
import { DateTime } from "luxon";
import { IIdentifier } from "@veramo/core";
import { Component, Vue } from "vue-facing-decorator";
import { LMap, LMarker, LTileLayer } from "@vue-leaflet/vue-leaflet";
@@ -189,7 +188,6 @@ import {
createEndorserJwtVcFromClaim,
PlanVerifiableCredential,
} from "@/libs/endorserServer";
import * as libsUtil from "@/libs/util";
import { useAppStore } from "@/store/app";
@Component({
@@ -229,8 +227,6 @@ export default class NewEditProjectView extends Vue {
zoneName = DateTime.local().zoneName;
zoom = 2;
libsUtil = libsUtil;
async mounted() {
await accountsDB.open();
this.numAccounts = await accountsDB.accounts.count();
@@ -365,7 +361,7 @@ export default class NewEditProjectView extends Vue {
}
}
private async saveProject(identity: IIdentifier) {
private async saveProject(issuerDid: string) {
// Make a claim
const vcClaim: PlanVerifiableCredential = this.fullClaim;
if (this.projectId) {
@@ -416,13 +412,13 @@ export default class NewEditProjectView extends Vue {
} else {
delete vcClaim.startTime;
}
const vcJwt = await createEndorserJwtVcFromClaim(identity.did, vcClaim);
const vcJwt = await createEndorserJwtVcFromClaim(issuerDid, vcClaim);
// Make the xhr request payload
const payload = JSON.stringify({ jwtEncoded: vcJwt });
const url = this.apiServer + "/api/v2/claim";
const token = await accessToken(identity.did);
const token = await accessToken(issuerDid);
const headers = {
"Content-Type": "application/json",
Authorization: "Bearer " + token,
@@ -508,8 +504,7 @@ export default class NewEditProjectView extends Vue {
if (this.numAccounts === 0) {
console.error("Error: there is no account.");
} else {
const identity = await libsUtil.getIdentity(this.activeDid);
this.saveProject(identity);
this.saveProject(this.activeDid);
}
}