From 447878ff0b38847ce9ee1f1abb58bd09178a8664 Mon Sep 17 00:00:00 2001 From: Rein Krul Date: Mon, 7 Oct 2024 12:20:00 +0200 Subject: [PATCH] Allow deleting VCs from wallet --- api/proxy.go | 5 +++++ web/src/admin/IdentityDetails.vue | 24 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/api/proxy.go b/api/proxy.go index 8118a01..1eb0954 100644 --- a/api/proxy.go +++ b/api/proxy.go @@ -60,6 +60,11 @@ var allowedProxyRoutes = []proxyRoute{ method: http.MethodPost, path: "/internal/vcr/v2/holder/([a-z-A-Z0-9_\\-\\:\\.%]+)/vc", }, + // Delete Verifiable Credentials from wallet + { + method: http.MethodDelete, + path: "/internal/vcr/v2/holder/([a-z-A-Z0-9_\\-\\:\\.%]+)/vc/(.*)", + }, } // ConfigureProxy configures the proxy middleware for the given Nuts node address. diff --git a/web/src/admin/IdentityDetails.vue b/web/src/admin/IdentityDetails.vue index 6c91a03..add82bd 100644 --- a/web/src/admin/IdentityDetails.vue +++ b/web/src/admin/IdentityDetails.vue @@ -79,12 +79,18 @@ Type Issuer + Actions {{ credential.type.filter(t => t !== "VerifiableCredential").join(', ') }} {{ credential.issuer }} + + + @@ -169,6 +175,24 @@ export default { .finally(() => { this.fetchData() }) + }, + deleteCredential(did, credentialId) { + if (confirm("Are you sure you want to delete this credential?") !== true) { + return + } + this.fetchError = undefined + this.$api.delete(`api/proxy/internal/vcr/v2/holder/${did}/vc/${encodeURIComponent(credentialId)}`) + .then(data => { + if (data.reason) { + this.fetchError = data.reason + } + }) + .catch(response => { + this.fetchError = response + }) + .finally(() => { + this.fetchData() + }) } } }