Skip to content

Commit

Permalink
Allow deleting VCs from wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
reinkrul committed Oct 7, 2024
1 parent 2d08a7b commit 447878f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
5 changes: 5 additions & 0 deletions api/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
24 changes: 24 additions & 0 deletions web/src/admin/IdentityDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,18 @@
<tr>
<th class="thead">Type</th>
<th class="thead">Issuer</th>
<th class="thead">Actions</th>
</tr>
</thead>
<tbody>
<tr v-for="credential in details.wallet_credentials" :key="credential.id">
<td>{{ credential.type.filter(t => t !== "VerifiableCredential").join(', ') }}</td>
<td>{{ credential.issuer }}</td>
<td>
<button class="btn btn-secondary" @click="deleteCredential(credential.credentialSubject.id, credential.id)">
Delete
</button>
</td>
</tr>
</tbody>
</table>
Expand Down Expand Up @@ -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()
})
}
}
}
Expand Down

0 comments on commit 447878f

Please sign in to comment.