From 331c4f64d68b43397e5c97a49a7547f44d45235a Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Wed, 7 Feb 2024 18:23:13 -0700 Subject: [PATCH] add check for valid "did:" DIDs --- src/libs/endorserServer.ts | 4 ++++ src/views/ContactsView.vue | 17 +++++++++++++++-- src/views/StartView.vue | 2 +- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/libs/endorserServer.ts b/src/libs/endorserServer.ts index 345dd9706..b55981dd7 100644 --- a/src/libs/endorserServer.ts +++ b/src/libs/endorserServer.ts @@ -241,6 +241,10 @@ export type CreateAndSubmitClaimResult = SuccessResult | ErrorResult; // See https://github.com/trentlarson/endorser-ch/blob/0cb626f803028e7d9c67f095858a9fc8542e3dbd/server/api/services/util.js#L6 const HIDDEN_DID = "did:none:HIDDEN"; +export function isDid(did: string) { + return did.startsWith("did:"); +} + export function isHiddenDid(did: string) { return did === HIDDEN_DID; } diff --git a/src/views/ContactsView.vue b/src/views/ContactsView.vue index b10781f7f..a70124c3b 100644 --- a/src/views/ContactsView.vue +++ b/src/views/ContactsView.vue @@ -44,14 +44,14 @@
Hours to Add:
- Yes + Yes, generate one