Skip to content

Commit

Permalink
Merge pull request #246 from bcgov/remove-verification
Browse files Browse the repository at this point in the history
Remove use of verification from credential details
  • Loading branch information
esune authored Dec 12, 2024
2 parents 0c6b0f2 + 0fbfa14 commit 023b3ae
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 105 deletions.
72 changes: 3 additions & 69 deletions src/components/entity/credentialDetail/CredentialDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,11 @@
<v-card rounded="sm" class="mb-5 card">
<v-card-title class="pa-5 pb-0">
<p class="text-h6 font-weight-bold wrap">
<v-icon class="validated pb-1" v-if="!revoked">{{
mdiShieldCheckOutline
}}</v-icon>
<span>{{ `${credentialTypeDescription} credential` }}</span
><span v-if="!revoked"> verified</span><span v-else> claims</span>
><span> claims</span>
</p>
</v-card-title>
<v-card-text class="pa-5 pt-0">
<p v-if="!revoked" class="text-body-1 verification-time">
{{ `Cryptographically verified ${now}` }}
</p>
<p>
Issued: {{ issuedDate | formatDate }} • Effective:
{{ effectiveDate | formatDate }}
Expand Down Expand Up @@ -87,8 +81,7 @@
</ul>
</v-card-text>
</v-card>

<v-card rounded="sm" class="card mb-5" v-if="proofValues || rawData">
<v-card rounded="sm" class="card mb-5" v-if="rawData">
<v-expansion-panels flat>
<v-expansion-panel>
<v-expansion-panel-header class="text-h6 font-weight-bold pa-5">
Expand All @@ -101,7 +94,6 @@
<v-data-table
dense
:headers="headers"
:items="proofValues"
hide-default-header
hide-default-footer
disable-pagination
Expand All @@ -122,25 +114,6 @@
</v-expansion-panel>
</v-expansion-panels>
</v-card>

<v-card
rounded="sm"
class="card mb-5"
v-if="credentialType?.format !== 'vc_di'"
>
<v-expansion-panels flat>
<v-expansion-panel>
<v-expansion-panel-header class="text-h6 font-weight-bold pa-5">
<p>Proof Details</p>
</v-expansion-panel-header>
<v-expansion-panel-content class="pa-5 pt-0">
<div class="raw">
<pre>{{ proofRaw }}</pre>
</div>
</v-expansion-panel-content>
</v-expansion-panel>
</v-expansion-panels>
</v-card>
</div>
</div>
</template>
Expand Down Expand Up @@ -175,17 +148,13 @@ interface Data {
"selectedTopic",
"selectedTopicFullCredentialSet",
"getSelectedCredential",
"getPresentationId",
"getPresentationEX",
"loading",
]),
},
methods: {
...mapActions([
"fetchSelectedCredential",
"setLoading",
"fetchPresId",
"fetchPresEx",
"fetchFormattedIdentifiedTopic",
]),
},
Expand All @@ -195,13 +164,9 @@ export default class CredentialDetail extends Vue {
selectedTopicFullCredentialSet!: Array<ICredentialSet>;
getSelectedCredential!: ICredentialFormatted | undefined;
loading!: boolean;
getPresentationId!: string;
getPresentationEX!: ICredentialProof;
sourceId!: string;
isExpired = isExpired;
fetchSelectedCredential!: (id: string) => Promise<void>;
fetchPresId!: (id: string) => Promise<void>;
fetchPresEx!: (params: { id: string; presId: string }) => Promise<void>;
fetchFormattedIdentifiedTopic!: ({
sourceId,
type,
Expand Down Expand Up @@ -302,27 +267,7 @@ export default class CredentialDetail extends Vue {
if (replaced) {
base += "has been replaced.";
}
return base + " It can no longer be verified";
}
get proofRaw(): string | undefined {
const rawVals = this.getPresentationEX;
if (rawVals === undefined) {
return rawVals;
}
return JSON.stringify(rawVals?.result, null, 2);
}
get proofValues(): Record<string, string>[] | undefined {
const rawVals =
this.getPresentationEX?.result?.presentation?.requested_proof
?.revealed_attr_groups?.["self-verify-proof"]?.values;
if (rawVals === undefined) {
return rawVals;
}
return Object.keys(rawVals).map((key) => {
return { attr_name: key, attr_val: rawVals[key].raw };
});
return base
}
get rawData(): unknown {
Expand All @@ -340,22 +285,11 @@ export default class CredentialDetail extends Vue {
if (sourceId && credentialId) {
await Promise.all([
this.fetchSelectedCredential(credentialId),
this.fetchPresId(credentialId),
this.fetchFormattedIdentifiedTopic({
sourceId,
type,
}),
]);
// DEPRECATED: need a small timeout because the credential isn't always verified after fetchPresId returns
await new Promise((r) => setTimeout(r, 1000));
if (this.getPresentationId) {
await this.fetchPresEx({
id: credentialId,
presId: this.getPresentationId,
});
}
} else {
router.push("/search");
}
Expand Down
8 changes: 0 additions & 8 deletions src/services/api/v3/credential-verify.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ export default class CredentialVerifier extends ApiResource {
baseVersion = "v3";
basePath = "credential";

async credentialVerify(
id: string
): Promise<HttpResponse<ICredentialPresExchange>> {
return await Http.get<ICredentialPresExchange>(
this.formatEndpointUrl(`${id}/verify`)
);
}

async credentialVerifyPresEx(
id: string,
exId: string
Expand Down
28 changes: 0 additions & 28 deletions src/store/modules/credential-detail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ const state: State = {
const getters = {
getSelectedCredential: (state: State): ICredentialFormatted | undefined =>
state.selectedCredential,
getPresentationId: (state: State): string => state.presentationId,
getPresentationEX: (state: State): ICredentialProof | undefined =>
state.presentationEX,
};

const actions = {
Expand All @@ -42,31 +39,6 @@ const actions = {
console.error(e);
}
},
async fetchPresId(
{ commit }: ActionContext<State, RootState>,
id: string
): Promise<void> {
try {
const res = await credVerificationService.credentialVerify(id);
commit("setPresId", res.data.presentation_exchange_id);
} catch (e) {
console.error(e);
}
},
async fetchPresEx(
{ commit }: ActionContext<State, RootState>,
params: { id: string; presId: string }
): Promise<void> {
try {
const res = await credVerificationService.credentialVerifyPresEx(
params.id,
params.presId
);
commit("setPresEX", res.data);
} catch (e) {
console.error(e);
}
},
};

const mutations = {
Expand Down

0 comments on commit 023b3ae

Please sign in to comment.