Skip to content

Commit

Permalink
Update validation for DID.
Browse files Browse the repository at this point in the history
  • Loading branch information
abdulla-ashurov committed Sep 29, 2023
1 parent 94095c7 commit 2c01c1e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/helpers/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ export function toDefaultDkg(did: string): DkgOptions {

export function validateDidCreatePayload(didDocument: DIDDocument): SpecValidationResult {
// id is required, validated on both compile and runtime
if (!didDocument.id && !didDocument.id.startsWith('did:cheqd:')) return { valid: false, error: 'id is required' };
if (!didDocument.id || !didDocument.id.startsWith('did:cheqd:')) return { valid: false, error: 'id is required' };

if (!isValidService(didDocument)) return { valid: false, error: 'Service is Invalid' };
return { valid: true } as SpecValidationResult;
}

export function validateSpecCompliantPayload(didDocument: DIDDocument): SpecValidationResult {
// id is required, validated on both compile and runtime
if (!didDocument.id && !didDocument.id.startsWith('did:cheqd:')) return { valid: false, error: 'id is required' };
if (!didDocument.id || !didDocument.id.startsWith('did:cheqd:')) return { valid: false, error: 'id is required' };

// verificationMethod is required
if (!didDocument.verificationMethod) return { valid: false, error: 'verificationMethod is required' };
Expand Down

0 comments on commit 2c01c1e

Please sign in to comment.