Skip to content

Commit 447878f

Browse files
committed
Allow deleting VCs from wallet
1 parent 2d08a7b commit 447878f

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

api/proxy.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ var allowedProxyRoutes = []proxyRoute{
6060
method: http.MethodPost,
6161
path: "/internal/vcr/v2/holder/([a-z-A-Z0-9_\\-\\:\\.%]+)/vc",
6262
},
63+
// Delete Verifiable Credentials from wallet
64+
{
65+
method: http.MethodDelete,
66+
path: "/internal/vcr/v2/holder/([a-z-A-Z0-9_\\-\\:\\.%]+)/vc/(.*)",
67+
},
6368
}
6469

6570
// ConfigureProxy configures the proxy middleware for the given Nuts node address.

web/src/admin/IdentityDetails.vue

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,18 @@
7979
<tr>
8080
<th class="thead">Type</th>
8181
<th class="thead">Issuer</th>
82+
<th class="thead">Actions</th>
8283
</tr>
8384
</thead>
8485
<tbody>
8586
<tr v-for="credential in details.wallet_credentials" :key="credential.id">
8687
<td>{{ credential.type.filter(t => t !== "VerifiableCredential").join(', ') }}</td>
8788
<td>{{ credential.issuer }}</td>
89+
<td>
90+
<button class="btn btn-secondary" @click="deleteCredential(credential.credentialSubject.id, credential.id)">
91+
Delete
92+
</button>
93+
</td>
8894
</tr>
8995
</tbody>
9096
</table>
@@ -169,6 +175,24 @@ export default {
169175
.finally(() => {
170176
this.fetchData()
171177
})
178+
},
179+
deleteCredential(did, credentialId) {
180+
if (confirm("Are you sure you want to delete this credential?") !== true) {
181+
return
182+
}
183+
this.fetchError = undefined
184+
this.$api.delete(`api/proxy/internal/vcr/v2/holder/${did}/vc/${encodeURIComponent(credentialId)}`)
185+
.then(data => {
186+
if (data.reason) {
187+
this.fetchError = data.reason
188+
}
189+
})
190+
.catch(response => {
191+
this.fetchError = response
192+
})
193+
.finally(() => {
194+
this.fetchData()
195+
})
172196
}
173197
}
174198
}

0 commit comments

Comments
 (0)