add check for valid "did:" DIDs

This commit is contained in:
2024-02-07 18:23:13 -07:00
parent 28ae317958
commit 331c4f64d6
3 changed files with 20 additions and 3 deletions

View File

@@ -44,14 +44,14 @@
<div class="w-full text-right">
Hours to Add:
<input
class="border border rounded border-slate-400 w-24 text-right"
class="border rounded border-slate-400 w-24 text-right"
type="text"
placeholder="1"
v-model="hourInput"
/>
<br />
<input
class="border border rounded border-slate-400 w-48"
class="border rounded border-slate-400 w-48"
type="text"
placeholder="Description"
v-model="hourDescriptionInput"
@@ -303,6 +303,7 @@ import {
CONTACT_URL_PREFIX,
GiveServerRecord,
GiveVerifiableCredential,
isDid,
RegisterVerifiableCredential,
SERVICE_ID,
} from "@/libs/endorserServer";
@@ -697,6 +698,18 @@ export default class ContactsView extends Vue {
);
return;
}
if (!isDid(newContact.did)) {
this.$notify(
{
group: "alert",
type: "danger",
title: "Invalid DID",
text: "The DID is not valid. It must begin with 'did:'",
},
-1,
);
return;
}
newContact.seesMe = true; // since we will immediately set that on the server
return db.contacts
.add(newContact)