@interop/did-method-webvh 3.0.2 → 3.2.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 +38 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/interfaces.d.ts +5 -1
- package/dist/utils.js +25 -14
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,41 @@
|
|
|
1
|
+
## 3.2.0 - 2026-06-24
|
|
2
|
+
|
|
3
|
+
### Added
|
|
4
|
+
|
|
5
|
+
* export `deriveNextKeyHash` from the package entry, so callers implementing
|
|
6
|
+
key pre-rotation can compute the committed `nextKeyHashes` value
|
|
7
|
+
(`base58btc(multihash_sha2_256(sha256(utf8Bytes(publicKeyMultibase))))`)
|
|
8
|
+
without reaching into internal module paths.
|
|
9
|
+
|
|
10
|
+
## 3.1.0 - 2026-06-15
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
* support `capabilityDelegation` and `capabilityInvocation` as verification
|
|
15
|
+
relationship options on `createDID` / `updateDID` (alongside the existing
|
|
16
|
+
`authentication`, `assertionMethod`, and `keyAgreement` passthroughs), so a
|
|
17
|
+
single verification method can be referenced by id across all five
|
|
18
|
+
relationships -- matching the `did:web` shape -- instead of being limited to
|
|
19
|
+
the one relationship implied by its `purpose`.
|
|
20
|
+
* a verification method's `purpose` may now be an **array** of relationships
|
|
21
|
+
(`DataIntegrityProofPurpose[]`), not just a single value. A key declared with
|
|
22
|
+
`purpose: ['authentication', 'assertionMethod', 'capabilityDelegation',
|
|
23
|
+
'capabilityInvocation']` is added once to `verificationMethod` and referenced
|
|
24
|
+
by id from each listed relationship -- the ergonomic way to produce the
|
|
25
|
+
`did:web` shape without building relationship-id strings by hand. A single
|
|
26
|
+
string still works; absent (or empty) still defaults to `authentication`.
|
|
27
|
+
* export `DID_PLACEHOLDER` (the `{DID}` substitution token) and `createVMID`
|
|
28
|
+
from the package entry, so callers can construct verification-method id
|
|
29
|
+
references (e.g. `` `${DID_PLACEHOLDER}#${publicKeyMultibase.slice(-8)}` ``)
|
|
30
|
+
without depending on internal magic strings.
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
|
|
34
|
+
* `normalizeVMs` no longer copies the creation-time `purpose` directive onto the
|
|
35
|
+
emitted `verificationMethod` entries; `purpose` is not a DID Core
|
|
36
|
+
verification-method property and previously leaked into the published DID
|
|
37
|
+
document. The relationship arrays (`authentication`, etc.) are unaffected.
|
|
38
|
+
|
|
1
39
|
## 3.0.0-3.0.2 - 2026-06-14
|
|
2
40
|
|
|
3
41
|
### Package
|
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, deriveNextKeyHash, 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, deriveNextKeyHash, generateParallelDidWeb, parseDidKeyDid, parseDidKeyVerificationMethod, } from './utils.js';
|
|
6
6
|
export { createWitnessProof, signWitnessProofEntries, signWitnessProofEntry, } from './witness.js';
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -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
|
-
|
|
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) =>
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
.map(
|
|
575
|
-
all.
|
|
576
|
-
|
|
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.
|
|
580
|
-
.map(
|
|
590
|
+
.filter((vm) => purposesOf(vm).includes('capabilityDelegation'))
|
|
591
|
+
.map(idOf);
|
|
581
592
|
all.capabilityInvocation = verificationMethod
|
|
582
|
-
.filter((vm) => vm.
|
|
583
|
-
.map(
|
|
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
|
|
4
|
+
"version": "3.2.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"lint:fix": "biome check --write .",
|
|
25
25
|
"format": "biome format .",
|
|
26
26
|
"format:fix": "biome format --write .",
|
|
27
|
-
"test": "rm -rf ./test/logs && NODE_ENV=test vitest run",
|
|
27
|
+
"test": "npm run lint:fix && rm -rf ./test/logs && NODE_ENV=test vitest run",
|
|
28
28
|
"test:watch": "rm -rf ./test/logs && NODE_ENV=test vitest",
|
|
29
29
|
"test:bail": "rm -rf ./test/logs && NODE_ENV=test vitest --bail=1",
|
|
30
30
|
"test:coverage": "rm -rf ./test/logs && NODE_ENV=test vitest run --coverage",
|