-
Notifications
You must be signed in to change notification settings - Fork 1
Implement DID Document Validation Logic #6
Copy link
Copy link
Open
Description
Summary
Build a validation module that checks whether a did:trail DID Document conforms to the TRAIL DID Method specification. This is a core building block for any resolver or verifier implementation.
What needs to happen
-
Create
validation/did-document-validator.jswith functions that validate:- Required top-level fields (
id,controller,verificationMethod,authentication) idformat matchesdid:trail:<namespace>:<unique-id>patternverificationMethodentries have validtype,controller, and key material (publicKeyJwkorpublicKeyMultibase)- Service endpoints (if present) have valid
id,type, andserviceEndpoint - Capability delegation chain structure (delegator → delegate relationship)
- Required top-level fields (
-
Create test fixtures in
validation/fixtures/:valid-did-document.json— a fully conformant DID Documentinvalid-*.json— documents with specific violations (missing fields, wrong key format, malformed ID, etc.)
-
Create
validation/validate.js— a CLI runner that takes a DID Document JSON file and outputs validation results -
Add a
README.mdinvalidation/explaining usage and linking to the relevant spec sections
Acceptance criteria
- Validator catches all required-field violations
- Validator accepts a fully conformant document without false positives
- At least 5 test fixtures covering different error cases
- CLI runner works:
node validation/validate.js fixtures/valid-did-document.json - Code follows the style established in
examples/js/
Context
- DID Method Spec: see
spec/did-trail-method.mdin this repo - Builds on the JS examples from Good First Issue: Add DID Resolution Examples #4 / PR Improve JS examples and add HTTP DID resolution example #5
- This directly supports future resolver and verifier implementations
Labels
help wanted · enhancement
cc @AmeyParle — this follows up on your interest in contributing to core validation logic (see your comment on #4). Would love to have you take this on!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels