@interop/did-method-webvh 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,4 +1,33 @@
1
- ## 3.0.0 - 2026-06-14
1
+ ## 3.1.0 - 2026-06-15
2
+
3
+ ### Added
4
+
5
+ * support `capabilityDelegation` and `capabilityInvocation` as verification
6
+ relationship options on `createDID` / `updateDID` (alongside the existing
7
+ `authentication`, `assertionMethod`, and `keyAgreement` passthroughs), so a
8
+ single verification method can be referenced by id across all five
9
+ relationships -- matching the `did:web` shape -- instead of being limited to
10
+ the one relationship implied by its `purpose`.
11
+ * a verification method's `purpose` may now be an **array** of relationships
12
+ (`DataIntegrityProofPurpose[]`), not just a single value. A key declared with
13
+ `purpose: ['authentication', 'assertionMethod', 'capabilityDelegation',
14
+ 'capabilityInvocation']` is added once to `verificationMethod` and referenced
15
+ by id from each listed relationship -- the ergonomic way to produce the
16
+ `did:web` shape without building relationship-id strings by hand. A single
17
+ string still works; absent (or empty) still defaults to `authentication`.
18
+ * export `DID_PLACEHOLDER` (the `{DID}` substitution token) and `createVMID`
19
+ from the package entry, so callers can construct verification-method id
20
+ references (e.g. `` `${DID_PLACEHOLDER}#${publicKeyMultibase.slice(-8)}` ``)
21
+ without depending on internal magic strings.
22
+
23
+ ### Changed
24
+
25
+ * `normalizeVMs` no longer copies the creation-time `purpose` directive onto the
26
+ emitted `verificationMethod` entries; `purpose` is not a DID Core
27
+ verification-method property and previously leaked into the published DID
28
+ document. The relationship arrays (`authentication`, etc.) are unaffected.
29
+
30
+ ## 3.0.0-3.0.2 - 2026-06-14
2
31
 
3
32
  ### Package
4
33
 
package/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # `@interop/did-method-webvh`
2
2
 
3
3
  [![CI](https://github.com/interop-alliance/did-method-webvh/actions/workflows/ci.yml/badge.svg)](https://github.com/interop-alliance/did-method-webvh/actions/workflows/ci.yml)
4
+ [![NPM Version](https://img.shields.io/npm/v/@interop/did-method-webvh.svg)](https://npm.im/@interop/did-method-webvh)
4
5
 
5
6
  `@interop/did-method-webvh` provides developers with a comprehensive library for working with
6
7
  Decentralized Identifiers (DIDs) following the `did:webvh` method specification.
package/dist/index.d.ts CHANGED
@@ -2,5 +2,5 @@ export { AbstractCrypto, createDocumentSigner, createProof, createSigner, prepar
2
2
  export * from './interfaces.js';
3
3
  export { createDID, deactivateDID, resolveDID, resolveDIDFromLog, updateDID } from './method.js';
4
4
  export { MultibaseEncoding, multibaseDecode, multibaseEncode } from './utils/multiformats.js';
5
- export { generateParallelDidWeb, parseDidKeyDid, parseDidKeyVerificationMethod } from './utils.js';
5
+ export { createVMID, DID_PLACEHOLDER, generateParallelDidWeb, parseDidKeyDid, parseDidKeyVerificationMethod, } from './utils.js';
6
6
  export { createWitnessProof, signWitnessProofEntries, signWitnessProofEntry, } from './witness.js';
package/dist/index.js CHANGED
@@ -2,5 +2,5 @@ export { AbstractCrypto, createDocumentSigner, createProof, createSigner, prepar
2
2
  export * from './interfaces.js';
3
3
  export { createDID, deactivateDID, resolveDID, resolveDIDFromLog, updateDID } from './method.js';
4
4
  export { MultibaseEncoding, multibaseDecode, multibaseEncode } from './utils/multiformats.js';
5
- export { generateParallelDidWeb, parseDidKeyDid, parseDidKeyVerificationMethod } from './utils.js';
5
+ export { createVMID, DID_PLACEHOLDER, generateParallelDidWeb, parseDidKeyDid, parseDidKeyVerificationMethod, } from './utils.js';
6
6
  export { createWitnessProof, signWitnessProofEntries, signWitnessProofEntry, } from './witness.js';
@@ -89,7 +89,7 @@ export interface VerificationMethod {
89
89
  controller?: string;
90
90
  publicKeyMultibase?: string;
91
91
  secretKeyMultibase?: string;
92
- purpose?: DataIntegrityProofPurpose;
92
+ purpose?: DataIntegrityProofPurpose | DataIntegrityProofPurpose[];
93
93
  publicKeyJwk?: any;
94
94
  use?: string;
95
95
  }
@@ -187,6 +187,8 @@ export interface CreateDIDInterface {
187
187
  authentication?: string[];
188
188
  assertionMethod?: string[];
189
189
  keyAgreement?: string[];
190
+ capabilityDelegation?: string[];
191
+ capabilityInvocation?: string[];
190
192
  }
191
193
  export interface SignDIDDocInterface {
192
194
  document: unknown;
@@ -209,6 +211,8 @@ export interface UpdateDIDInterface {
209
211
  authentication?: string[];
210
212
  assertionMethod?: string[];
211
213
  keyAgreement?: string[];
214
+ capabilityDelegation?: string[];
215
+ capabilityInvocation?: string[];
212
216
  witnessProofs?: WitnessProofFileEntry[];
213
217
  }
214
218
  export interface DeactivateDIDInterface {
package/dist/utils.js CHANGED
@@ -524,6 +524,12 @@ export const createDIDDoc = async (options) => {
524
524
  if (options.keyAgreement) {
525
525
  doc.keyAgreement = options.keyAgreement;
526
526
  }
527
+ if (options.capabilityDelegation) {
528
+ doc.capabilityDelegation = options.capabilityDelegation;
529
+ }
530
+ if (options.capabilityInvocation) {
531
+ doc.capabilityInvocation = options.capabilityInvocation;
532
+ }
527
533
  if (options.alsoKnownAs) {
528
534
  doc.alsoKnownAs = options.alsoKnownAs;
529
535
  }
@@ -557,30 +563,35 @@ export const normalizeVMs = (verificationMethod, did = null) => {
557
563
  if (!verificationMethod || verificationMethod.length === 0) {
558
564
  return all;
559
565
  }
560
- // First collect all VMs
561
- const vms = verificationMethod.map((vm) => ({
566
+ // First collect all VMs. `purpose` is a creation-time directive for the
567
+ // relationship wiring below, not a DID Core verification-method property, so
568
+ // it is dropped from the emitted entries.
569
+ const vms = verificationMethod.map(({ purpose, ...vm }) => ({
562
570
  ...vm,
563
571
  id: vm.id ?? createVMID(vm, did),
564
572
  // Default controller to the DID — required by W3C DID Core §5.2
565
573
  controller: vm.controller ?? did,
566
574
  }));
567
575
  all.verificationMethod = vms;
576
+ // A VM's `purpose` may name a single relationship or several; an absent (or
577
+ // empty) purpose defaults the key into authentication.
578
+ const purposesOf = (vm) => vm.purpose == null ? [] : Array.isArray(vm.purpose) ? vm.purpose : [vm.purpose];
579
+ const idOf = (vm) => vm.id ?? createVMID(vm, did);
568
580
  // Then handle relationships - default to authentication if no purpose is specified
569
581
  all.authentication = verificationMethod
570
- .filter((vm) => !vm.purpose || vm.purpose === 'authentication')
571
- .map((vm) => vm.id ?? createVMID(vm, did));
572
- all.assertionMethod = verificationMethod
573
- .filter((vm) => vm.purpose === 'assertionMethod')
574
- .map((vm) => vm.id ?? createVMID(vm, did));
575
- all.keyAgreement = verificationMethod
576
- .filter((vm) => vm.purpose === 'keyAgreement')
577
- .map((vm) => vm.id ?? createVMID(vm, did));
582
+ .filter((vm) => {
583
+ const purposes = purposesOf(vm);
584
+ return purposes.length === 0 || purposes.includes('authentication');
585
+ })
586
+ .map(idOf);
587
+ all.assertionMethod = verificationMethod.filter((vm) => purposesOf(vm).includes('assertionMethod')).map(idOf);
588
+ all.keyAgreement = verificationMethod.filter((vm) => purposesOf(vm).includes('keyAgreement')).map(idOf);
578
589
  all.capabilityDelegation = verificationMethod
579
- .filter((vm) => vm.purpose === 'capabilityDelegation')
580
- .map((vm) => vm.id ?? createVMID(vm, did));
590
+ .filter((vm) => purposesOf(vm).includes('capabilityDelegation'))
591
+ .map(idOf);
581
592
  all.capabilityInvocation = verificationMethod
582
- .filter((vm) => vm.purpose === 'capabilityInvocation')
583
- .map((vm) => vm.id ?? createVMID(vm, did));
593
+ .filter((vm) => purposesOf(vm).includes('capabilityInvocation'))
594
+ .map(idOf);
584
595
  return all;
585
596
  };
586
597
  export const resolveVM = async (vm) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@interop/did-method-webvh",
3
3
  "type": "module",
4
- "version": "3.0.0",
4
+ "version": "3.1.0",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
@@ -53,7 +53,8 @@
53
53
  "didwebvh": "./dist/cli.js"
54
54
  },
55
55
  "publishConfig": {
56
- "access": "public"
56
+ "access": "public",
57
+ "provenance": true
57
58
  },
58
59
  "exports": {
59
60
  ".": {