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.js with functions that validate:
- Required top-level fields (
id, controller, verificationMethod, authentication)
id format matches did:trail:<namespace>:<unique-id> pattern
verificationMethod entries have valid type, controller, and key material (publicKeyJwk or publicKeyMultibase)
- Service endpoints (if present) have valid
id, type, and serviceEndpoint
- Capability delegation chain structure (delegator → delegate relationship)
-
Create test fixtures in validation/fixtures/:
valid-did-document.json — a fully conformant DID Document
invalid-*.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.md in validation/ explaining usage and linking to the relevant spec sections
Acceptance criteria
Context
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!
Summary
Build a validation module that checks whether a
did:trailDID 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:id,controller,verificationMethod,authentication)idformat matchesdid:trail:<namespace>:<unique-id>patternverificationMethodentries have validtype,controller, and key material (publicKeyJwkorpublicKeyMultibase)id,type, andserviceEndpointCreate 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 resultsAdd a
README.mdinvalidation/explaining usage and linking to the relevant spec sectionsAcceptance criteria
node validation/validate.js fixtures/valid-did-document.jsonexamples/js/Context
spec/did-trail-method.mdin this repoLabels
help wanted·enhancementcc @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!