forked from jsnbuchanan/crowd-funder-for-time-pwa
switch the encryption secret from localStorage to IndexedDB (because localStorage gets lost so often)
This commit is contained in:
@@ -489,14 +489,11 @@ import QuickNav from "@/components/QuickNav.vue";
|
||||
import EntityIcon from "@/components/EntityIcon.vue";
|
||||
import ProjectIcon from "@/components/ProjectIcon.vue";
|
||||
import { NotificationIface } from "@/constants/app";
|
||||
import { accountsDB, db, retrieveSettingsForActiveAccount } from "@/db/index";
|
||||
import { Account } from "@/db/tables/accounts";
|
||||
import { db, retrieveSettingsForActiveAccount } from "@/db/index";
|
||||
import { Contact } from "@/db/tables/contacts";
|
||||
import * as libsUtil from "@/libs/util";
|
||||
import {
|
||||
BLANK_GENERIC_SERVER_RECORD,
|
||||
GenericCredWrapper,
|
||||
getHeaders,
|
||||
GiveSummaryRecord,
|
||||
GiveVerifiableCredential,
|
||||
OfferSummaryRecord,
|
||||
@@ -504,6 +501,7 @@ import {
|
||||
PlanSummaryRecord,
|
||||
} from "@/libs/endorserServer";
|
||||
import * as serverUtil from "@/libs/endorserServer";
|
||||
import { retrieveAccountDids } from "@/libs/util";
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
@@ -559,10 +557,7 @@ export default class ProjectViewView extends Vue {
|
||||
this.allContacts = await db.contacts.toArray();
|
||||
this.isRegistered = !!settings.isRegistered;
|
||||
|
||||
await accountsDB.open();
|
||||
const accounts = accountsDB.accounts;
|
||||
const accountsArr: Account[] = await accounts?.toArray();
|
||||
this.allMyDids = accountsArr.map((acc) => acc.did);
|
||||
this.allMyDids = await retrieveAccountDids();
|
||||
|
||||
const pathParam = window.location.pathname.substring("/project/".length);
|
||||
if (pathParam) {
|
||||
@@ -593,7 +588,7 @@ export default class ProjectViewView extends Vue {
|
||||
|
||||
const url =
|
||||
this.apiServer + "/api/claim/byHandle/" + encodeURIComponent(projectId);
|
||||
const headers = await getHeaders(userDid);
|
||||
const headers = await serverUtil.getHeaders(userDid);
|
||||
|
||||
try {
|
||||
const resp = await this.axios.get(url, { headers });
|
||||
@@ -698,7 +693,7 @@ export default class ProjectViewView extends Vue {
|
||||
}
|
||||
const givesInUrl = givesUrl + postfix;
|
||||
|
||||
const headers = await getHeaders(this.activeDid);
|
||||
const headers = await serverUtil.getHeaders(this.activeDid);
|
||||
try {
|
||||
const resp = await this.axios.get(givesInUrl, { headers });
|
||||
if (resp.status === 200 && resp.data.data) {
|
||||
@@ -745,7 +740,7 @@ export default class ProjectViewView extends Vue {
|
||||
}
|
||||
const offersInUrl = offersUrl + postfix;
|
||||
|
||||
const headers = await getHeaders(this.activeDid);
|
||||
const headers = await serverUtil.getHeaders(this.activeDid);
|
||||
try {
|
||||
const resp = await this.axios.get(offersInUrl, { headers });
|
||||
if (resp.status === 200 && resp.data.data) {
|
||||
@@ -793,7 +788,7 @@ export default class ProjectViewView extends Vue {
|
||||
}
|
||||
const fulfillsInUrl = fulfillsUrl + postfix;
|
||||
|
||||
const headers = await getHeaders(this.activeDid);
|
||||
const headers = await serverUtil.getHeaders(this.activeDid);
|
||||
try {
|
||||
const resp = await this.axios.get(fulfillsInUrl, { headers });
|
||||
if (resp.status === 200) {
|
||||
@@ -841,7 +836,7 @@ export default class ProjectViewView extends Vue {
|
||||
}
|
||||
const providedByFullUrl = providedByUrl + postfix;
|
||||
|
||||
const headers = await getHeaders(this.activeDid);
|
||||
const headers = await serverUtil.getHeaders(this.activeDid);
|
||||
try {
|
||||
const resp = await this.axios.get(providedByFullUrl, { headers });
|
||||
if (resp.status === 200) {
|
||||
@@ -945,7 +940,7 @@ export default class ProjectViewView extends Vue {
|
||||
|
||||
checkIsFulfillable(offer: OfferSummaryRecord) {
|
||||
const offerRecord: GenericCredWrapper<OfferVerifiableCredential> = {
|
||||
...BLANK_GENERIC_SERVER_RECORD,
|
||||
...serverUtil.BLANK_GENERIC_SERVER_RECORD,
|
||||
claim: offer.fullClaim,
|
||||
claimType: "Offer",
|
||||
issuer: offer.offeredByDid,
|
||||
@@ -955,7 +950,7 @@ export default class ProjectViewView extends Vue {
|
||||
|
||||
onClickFulfillGiveToOffer(offer: OfferSummaryRecord) {
|
||||
const offerRecord: GenericCredWrapper<OfferVerifiableCredential> = {
|
||||
...BLANK_GENERIC_SERVER_RECORD,
|
||||
...serverUtil.BLANK_GENERIC_SERVER_RECORD,
|
||||
claim: offer.fullClaim,
|
||||
issuer: offer.offeredByDid,
|
||||
};
|
||||
@@ -1003,7 +998,7 @@ export default class ProjectViewView extends Vue {
|
||||
*/
|
||||
checkIsConfirmable(give: GiveSummaryRecord, confirmerIdList?: string[]) {
|
||||
const giveDetails: GenericCredWrapper<GiveVerifiableCredential> = {
|
||||
...BLANK_GENERIC_SERVER_RECORD,
|
||||
...serverUtil.BLANK_GENERIC_SERVER_RECORD,
|
||||
claim: give.fullClaim,
|
||||
claimType: "GiveAction",
|
||||
issuer: give.issuerDid,
|
||||
|
||||
Reference in New Issue
Block a user