@interop/wallet-core 0.61.0 → 0.65.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/README.md +41 -16
- package/dist/clientAnnex/credentialAnchoredGenesis.d.ts +46 -26
- package/dist/clientAnnex/credentialAnchoredGenesis.d.ts.map +1 -1
- package/dist/clientAnnex/credentialAnchoredGenesis.js +91 -39
- package/dist/clientAnnex/credentialAnchoredGenesis.js.map +1 -1
- package/dist/clientAnnex/establish.d.ts +55 -34
- package/dist/clientAnnex/establish.d.ts.map +1 -1
- package/dist/clientAnnex/establish.js +102 -56
- package/dist/clientAnnex/establish.js.map +1 -1
- package/dist/clientAnnex/forget.d.ts +16 -2
- package/dist/clientAnnex/forget.d.ts.map +1 -1
- package/dist/clientAnnex/forget.js +11 -9
- package/dist/clientAnnex/forget.js.map +1 -1
- package/dist/clientAnnex/forgetLast.d.ts +126 -35
- package/dist/clientAnnex/forgetLast.d.ts.map +1 -1
- package/dist/clientAnnex/forgetLast.js +208 -60
- package/dist/clientAnnex/forgetLast.js.map +1 -1
- package/dist/clientAnnex/gc.d.ts +3 -2
- package/dist/clientAnnex/gc.d.ts.map +1 -1
- package/dist/clientAnnex/gc.js +7 -7
- package/dist/clientAnnex/gc.js.map +1 -1
- package/dist/clientAnnex/heal.d.ts +101 -33
- package/dist/clientAnnex/heal.d.ts.map +1 -1
- package/dist/clientAnnex/heal.js +559 -212
- package/dist/clientAnnex/heal.js.map +1 -1
- package/dist/clientAnnex/index.d.ts +21 -5
- package/dist/clientAnnex/index.d.ts.map +1 -1
- package/dist/clientAnnex/index.js +24 -5
- package/dist/clientAnnex/index.js.map +1 -1
- package/dist/clientAnnex/ladder.d.ts +304 -18
- package/dist/clientAnnex/ladder.d.ts.map +1 -1
- package/dist/clientAnnex/ladder.js +942 -64
- package/dist/clientAnnex/ladder.js.map +1 -1
- package/dist/clientAnnex/ladderAnchored.d.ts +261 -28
- package/dist/clientAnnex/ladderAnchored.d.ts.map +1 -1
- package/dist/clientAnnex/ladderAnchored.js +521 -295
- package/dist/clientAnnex/ladderAnchored.js.map +1 -1
- package/dist/clientAnnex/log.d.ts +193 -38
- package/dist/clientAnnex/log.d.ts.map +1 -1
- package/dist/clientAnnex/log.js +445 -190
- package/dist/clientAnnex/log.js.map +1 -1
- package/dist/clientAnnex/mend.d.ts +12 -6
- package/dist/clientAnnex/mend.d.ts.map +1 -1
- package/dist/clientAnnex/mend.js +26 -12
- package/dist/clientAnnex/mend.js.map +1 -1
- package/dist/clientAnnex/recoveryLadderAnchored.d.ts +38 -11
- package/dist/clientAnnex/recoveryLadderAnchored.d.ts.map +1 -1
- package/dist/clientAnnex/recoveryLadderAnchored.js +177 -55
- package/dist/clientAnnex/recoveryLadderAnchored.js.map +1 -1
- package/dist/clientAnnex/spaceCapability.d.ts +123 -0
- package/dist/clientAnnex/spaceCapability.d.ts.map +1 -0
- package/dist/clientAnnex/spaceCapability.js +152 -0
- package/dist/clientAnnex/spaceCapability.js.map +1 -0
- package/dist/clientAnnex/stages.d.ts +63 -0
- package/dist/clientAnnex/stages.d.ts.map +1 -0
- package/dist/clientAnnex/stages.js +64 -0
- package/dist/clientAnnex/stages.js.map +1 -0
- package/dist/clientAnnex/zcap.d.ts +1 -1
- package/dist/clientAnnex/zcap.d.ts.map +1 -1
- package/dist/clientAnnex/zcap.js +42 -35
- package/dist/clientAnnex/zcap.js.map +1 -1
- package/dist/clients/policy.d.ts +15 -1
- package/dist/clients/policy.d.ts.map +1 -1
- package/dist/clients/policy.js +12 -6
- package/dist/clients/policy.js.map +1 -1
- package/dist/clients/revocation.d.ts +18 -10
- package/dist/clients/revocation.d.ts.map +1 -1
- package/dist/clients/revocation.js +13 -5
- package/dist/clients/revocation.js.map +1 -1
- package/dist/clients/rosterPolicy.d.ts +10 -2
- package/dist/clients/rosterPolicy.d.ts.map +1 -1
- package/dist/clients/rosterPolicy.js +41 -24
- package/dist/clients/rosterPolicy.js.map +1 -1
- package/dist/descriptors/acquire.d.ts.map +1 -1
- package/dist/descriptors/acquire.js +6 -23
- package/dist/descriptors/acquire.js.map +1 -1
- package/dist/descriptors/cipher.d.ts.map +1 -1
- package/dist/descriptors/cipher.js +5 -0
- package/dist/descriptors/cipher.js.map +1 -1
- package/dist/descriptors/errors.d.ts +43 -0
- package/dist/descriptors/errors.d.ts.map +1 -0
- package/dist/descriptors/errors.js +45 -0
- package/dist/descriptors/errors.js.map +1 -0
- package/dist/descriptors/index.d.ts +5 -0
- package/dist/descriptors/index.d.ts.map +1 -1
- package/dist/descriptors/index.js +5 -0
- package/dist/descriptors/index.js.map +1 -1
- package/dist/enrollment/enrollment.d.ts +37 -10
- package/dist/enrollment/enrollment.d.ts.map +1 -1
- package/dist/enrollment/enrollment.js +52 -15
- package/dist/enrollment/enrollment.js.map +1 -1
- package/dist/genesis/accountGenesis.d.ts +42 -11
- package/dist/genesis/accountGenesis.d.ts.map +1 -1
- package/dist/genesis/accountGenesis.js +80 -22
- package/dist/genesis/accountGenesis.js.map +1 -1
- package/dist/genesis/index.d.ts +3 -1
- package/dist/genesis/index.d.ts.map +1 -1
- package/dist/genesis/index.js +3 -1
- package/dist/genesis/index.js.map +1 -1
- package/dist/identity/agents.d.ts +17 -1
- package/dist/identity/agents.d.ts.map +1 -1
- package/dist/identity/agents.js +24 -8
- package/dist/identity/agents.js.map +1 -1
- package/dist/identity/index.d.ts +3 -1
- package/dist/identity/index.d.ts.map +1 -1
- package/dist/identity/index.js +3 -1
- package/dist/identity/index.js.map +1 -1
- package/dist/index.d.ts +6 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/keyring/index.d.ts +2 -1
- package/dist/keyring/index.d.ts.map +1 -1
- package/dist/keyring/index.js +2 -1
- package/dist/keyring/index.js.map +1 -1
- package/dist/keyring/record.d.ts.map +1 -1
- package/dist/keyring/record.js +3 -6
- package/dist/keyring/record.js.map +1 -1
- package/dist/keyring/unlockSpace.d.ts +14 -5
- package/dist/keyring/unlockSpace.d.ts.map +1 -1
- package/dist/keyring/unlockSpace.js +31 -36
- package/dist/keyring/unlockSpace.js.map +1 -1
- package/dist/keys/index.d.ts +10 -6
- package/dist/keys/index.d.ts.map +1 -1
- package/dist/keys/index.js +9 -5
- package/dist/keys/index.js.map +1 -1
- package/dist/keys/rosterLogStore.d.ts +12 -11
- package/dist/keys/rosterLogStore.d.ts.map +1 -1
- package/dist/keys/rosterLogStore.js +15 -13
- package/dist/keys/rosterLogStore.js.map +1 -1
- package/dist/keys/rosterStore.d.ts +3 -6
- package/dist/keys/rosterStore.d.ts.map +1 -1
- package/dist/keys/rosterStore.js +10 -9
- package/dist/keys/rosterStore.js.map +1 -1
- package/dist/keys/spaceEpochs.d.ts.map +1 -1
- package/dist/keys/spaceEpochs.js +2 -3
- package/dist/keys/spaceEpochs.js.map +1 -1
- package/dist/keys/userKeyRoster.d.ts +89 -9
- package/dist/keys/userKeyRoster.d.ts.map +1 -1
- package/dist/keys/userKeyRoster.js +262 -19
- package/dist/keys/userKeyRoster.js.map +1 -1
- package/dist/keys/userKeyRosterCascade.d.ts +7 -6
- package/dist/keys/userKeyRosterCascade.d.ts.map +1 -1
- package/dist/keys/userKeyRosterCascade.js +7 -6
- package/dist/keys/userKeyRosterCascade.js.map +1 -1
- package/dist/keys/wasLabelsStore.d.ts +9 -2
- package/dist/keys/wasLabelsStore.d.ts.map +1 -1
- package/dist/keys/wasLabelsStore.js +14 -6
- package/dist/keys/wasLabelsStore.js.map +1 -1
- package/dist/log.d.ts +7 -2
- package/dist/log.d.ts.map +1 -1
- package/dist/log.js +6 -1
- package/dist/log.js.map +1 -1
- package/dist/recovery/index.d.ts +12 -8
- package/dist/recovery/index.d.ts.map +1 -1
- package/dist/recovery/index.js +11 -7
- package/dist/recovery/index.js.map +1 -1
- package/dist/recovery/recoveryCode.d.ts +27 -7
- package/dist/recovery/recoveryCode.d.ts.map +1 -1
- package/dist/recovery/recoveryCode.js +18 -6
- package/dist/recovery/recoveryCode.js.map +1 -1
- package/dist/recovery/recoveryDelegation.d.ts +4 -1
- package/dist/recovery/recoveryDelegation.d.ts.map +1 -1
- package/dist/recovery/recoveryDelegation.js +25 -36
- package/dist/recovery/recoveryDelegation.js.map +1 -1
- package/dist/recovery/recoveryWebvh.d.ts +117 -65
- package/dist/recovery/recoveryWebvh.d.ts.map +1 -1
- package/dist/recovery/recoveryWebvh.js +279 -126
- package/dist/recovery/recoveryWebvh.js.map +1 -1
- package/dist/request/classify.d.ts +32 -8
- package/dist/request/classify.d.ts.map +1 -1
- package/dist/request/classify.js +39 -14
- package/dist/request/classify.js.map +1 -1
- package/dist/request/ephemeralExchange.d.ts +1 -6
- package/dist/request/ephemeralExchange.d.ts.map +1 -1
- package/dist/request/ephemeralExchange.js.map +1 -1
- package/dist/request/onboarding.d.ts.map +1 -1
- package/dist/request/onboarding.js +2 -2
- package/dist/request/onboarding.js.map +1 -1
- package/dist/request/parse.d.ts.map +1 -1
- package/dist/request/parse.js +2 -3
- package/dist/request/parse.js.map +1 -1
- package/dist/resourceLog/controller.d.ts +34 -12
- package/dist/resourceLog/controller.d.ts.map +1 -1
- package/dist/resourceLog/controller.js +79 -86
- package/dist/resourceLog/controller.js.map +1 -1
- package/dist/resourceLog/document.d.ts +182 -0
- package/dist/resourceLog/document.d.ts.map +1 -0
- package/dist/resourceLog/document.js +159 -0
- package/dist/resourceLog/document.js.map +1 -0
- package/dist/resourceLog/errors.d.ts +47 -8
- package/dist/resourceLog/errors.d.ts.map +1 -1
- package/dist/resourceLog/errors.js +54 -8
- package/dist/resourceLog/errors.js.map +1 -1
- package/dist/resourceLog/index.d.ts +7 -3
- package/dist/resourceLog/index.d.ts.map +1 -1
- package/dist/resourceLog/index.js +7 -3
- package/dist/resourceLog/index.js.map +1 -1
- package/dist/resourceLog/ladderRungs.d.ts +35 -0
- package/dist/resourceLog/ladderRungs.d.ts.map +1 -0
- package/dist/resourceLog/ladderRungs.js +352 -0
- package/dist/resourceLog/ladderRungs.js.map +1 -0
- package/dist/resourceLog/license.d.ts +42 -17
- package/dist/resourceLog/license.d.ts.map +1 -1
- package/dist/resourceLog/license.js +38 -24
- package/dist/resourceLog/license.js.map +1 -1
- package/dist/space/activity.d.ts +15 -15
- package/dist/space/activity.d.ts.map +1 -1
- package/dist/space/activity.js +15 -15
- package/dist/space/activity.js.map +1 -1
- package/dist/space/collections.d.ts +11 -0
- package/dist/space/collections.d.ts.map +1 -1
- package/dist/space/collections.js +13 -0
- package/dist/space/collections.js.map +1 -1
- package/dist/space/deleteSpace.d.ts +28 -0
- package/dist/space/deleteSpace.d.ts.map +1 -0
- package/dist/space/deleteSpace.js +44 -0
- package/dist/space/deleteSpace.js.map +1 -0
- package/dist/space/errors.d.ts.map +1 -1
- package/dist/space/errors.js +0 -1
- package/dist/space/errors.js.map +1 -1
- package/dist/space/index.d.ts +6 -0
- package/dist/space/index.d.ts.map +1 -1
- package/dist/space/index.js +6 -0
- package/dist/space/index.js.map +1 -1
- package/dist/space/plaintextCollection.d.ts +43 -0
- package/dist/space/plaintextCollection.d.ts.map +1 -0
- package/dist/space/plaintextCollection.js +17 -0
- package/dist/space/plaintextCollection.js.map +1 -0
- package/dist/stages.d.ts +23 -0
- package/dist/stages.d.ts.map +1 -0
- package/dist/stages.js +23 -0
- package/dist/stages.js.map +1 -0
- package/dist/sync/index.d.ts +7 -0
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +7 -0
- package/dist/sync/index.js.map +1 -1
- package/dist/sync/push.js +4 -4
- package/dist/sync/push.js.map +1 -1
- package/dist/sync/remint.js +2 -2
- package/dist/sync/remint.js.map +1 -1
- package/dist/sync/types.d.ts +41 -1
- package/dist/sync/types.d.ts.map +1 -1
- package/dist/sync/types.js +47 -1
- package/dist/sync/types.js.map +1 -1
- package/dist/unlock/index.d.ts +6 -2
- package/dist/unlock/index.d.ts.map +1 -1
- package/dist/unlock/index.js +5 -1
- package/dist/unlock/index.js.map +1 -1
- package/dist/unlock/retire.d.ts +95 -14
- package/dist/unlock/retire.d.ts.map +1 -1
- package/dist/unlock/retire.js +102 -10
- package/dist/unlock/retire.js.map +1 -1
- package/dist/unlock/standingClient.d.ts.map +1 -1
- package/dist/unlock/standingClient.js +5 -1
- package/dist/unlock/standingClient.js.map +1 -1
- package/dist/unlock/standingWebvh.d.ts +341 -49
- package/dist/unlock/standingWebvh.d.ts.map +1 -1
- package/dist/unlock/standingWebvh.js +608 -164
- package/dist/unlock/standingWebvh.js.map +1 -1
- package/dist/webvh/accountEntry.d.ts +146 -0
- package/dist/webvh/accountEntry.d.ts.map +1 -0
- package/dist/webvh/accountEntry.js +239 -0
- package/dist/webvh/accountEntry.js.map +1 -0
- package/dist/webvh/didWeb.d.ts +12 -7
- package/dist/webvh/didWeb.d.ts.map +1 -1
- package/dist/webvh/didWeb.js +2 -2
- package/dist/webvh/didWeb.js.map +1 -1
- package/dist/webvh/didWebProjection.d.ts +164 -0
- package/dist/webvh/didWebProjection.d.ts.map +1 -0
- package/dist/webvh/didWebProjection.js +230 -0
- package/dist/webvh/didWebProjection.js.map +1 -0
- package/dist/webvh/didWebvh.d.ts +278 -138
- package/dist/webvh/didWebvh.d.ts.map +1 -1
- package/dist/webvh/didWebvh.js +314 -345
- package/dist/webvh/didWebvh.js.map +1 -1
- package/dist/webvh/enrollClient.d.ts +65 -0
- package/dist/webvh/enrollClient.d.ts.map +1 -0
- package/dist/webvh/enrollClient.js +172 -0
- package/dist/webvh/enrollClient.js.map +1 -0
- package/dist/webvh/index.d.ts +37 -12
- package/dist/webvh/index.d.ts.map +1 -1
- package/dist/webvh/index.js +33 -10
- package/dist/webvh/index.js.map +1 -1
- package/dist/webvh/listClients.d.ts +1 -33
- package/dist/webvh/listClients.d.ts.map +1 -1
- package/dist/webvh/listClients.js +2 -28
- package/dist/webvh/listClients.js.map +1 -1
- package/dist/webvh/revokeClient.d.ts +89 -11
- package/dist/webvh/revokeClient.d.ts.map +1 -1
- package/dist/webvh/revokeClient.js +182 -47
- package/dist/webvh/revokeClient.js.map +1 -1
- package/dist/webvh/standingZcap.d.ts +61 -14
- package/dist/webvh/standingZcap.d.ts.map +1 -1
- package/dist/webvh/standingZcap.js +91 -0
- package/dist/webvh/standingZcap.js.map +1 -1
- package/dist/webvh/verifyLog.d.ts +59 -5
- package/dist/webvh/verifyLog.d.ts.map +1 -1
- package/dist/webvh/verifyLog.js +76 -11
- package/dist/webvh/verifyLog.js.map +1 -1
- package/dist/webvh/wasIdStore.d.ts +8 -8
- package/dist/webvh/wasIdStore.d.ts.map +1 -1
- package/dist/webvh/wasIdStore.js +39 -14
- package/dist/webvh/wasIdStore.js.map +1 -1
- package/dist/webvh/zcap.d.ts +14 -1
- package/dist/webvh/zcap.d.ts.map +1 -1
- package/dist/webvh/zcap.js +3 -27
- package/dist/webvh/zcap.js.map +1 -1
- package/package.json +5 -5
- package/dist/webvh/keyAgreement.d.ts +0 -72
- package/dist/webvh/keyAgreement.d.ts.map +0 -1
- package/dist/webvh/keyAgreement.js +0 -47
- package/dist/webvh/keyAgreement.js.map +0 -1
|
@@ -1,55 +1,22 @@
|
|
|
1
1
|
import { ResourceLogIntegrityError } from '@interop/vh-resource-log';
|
|
2
|
+
import { credentialKeyAgreementMethods, ladderVmMethods, resolvedRelationMethods } from './document.js';
|
|
3
|
+
import { attributeLadderRungsPerVersion, entrySignerKeysOf } from './ladderRungs.js';
|
|
2
4
|
import { assertLadderAppendLicensed } from './license.js';
|
|
3
5
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
+
* Collects a document's `assertionMethod` key multibases, over the shared
|
|
7
|
+
* relation reader (embedded verification methods verbatim, string references
|
|
8
|
+
* resolved against `verificationMethod`).
|
|
6
9
|
*
|
|
7
|
-
* @param
|
|
8
|
-
* @param byId {Map<string, ControllerVerificationMethod>}
|
|
9
|
-
* @returns {ControllerVerificationMethod | undefined}
|
|
10
|
-
*/
|
|
11
|
-
function resolveMethod(entry, byId) {
|
|
12
|
-
return typeof entry === 'string' ? byId.get(entry) : entry;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Indexes a document's `verificationMethod` array by id.
|
|
16
|
-
*
|
|
17
|
-
* @param doc {ControllerDocument}
|
|
18
|
-
* @returns {Map<string, ControllerVerificationMethod>}
|
|
19
|
-
*/
|
|
20
|
-
function methodsById(doc) {
|
|
21
|
-
const byId = new Map();
|
|
22
|
-
for (const method of doc.verificationMethod ?? []) {
|
|
23
|
-
if (typeof method?.id === 'string') {
|
|
24
|
-
byId.set(method.id, method);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return byId;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* A relation entry's verification-method id: the string reference itself, or
|
|
31
|
-
* an embedded method's `id`.
|
|
32
|
-
*
|
|
33
|
-
* @param entry {string | ControllerVerificationMethod}
|
|
34
|
-
* @returns {string | undefined}
|
|
35
|
-
*/
|
|
36
|
-
function relationIdOf(entry) {
|
|
37
|
-
return typeof entry === 'string' ? entry : entry?.id;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Collects a document's `assertionMethod` key multibases: embedded
|
|
41
|
-
* verification methods verbatim, string references resolved against
|
|
42
|
-
* `verificationMethod`.
|
|
43
|
-
*
|
|
44
|
-
* @param doc {ControllerDocument}
|
|
10
|
+
* @param doc {AccountDocument}
|
|
45
11
|
* @returns {Set<string>}
|
|
46
12
|
*/
|
|
47
13
|
function assertionKeysOf(doc) {
|
|
48
|
-
const byId = methodsById(doc);
|
|
49
14
|
const keys = new Set();
|
|
50
|
-
for (const
|
|
51
|
-
|
|
52
|
-
|
|
15
|
+
for (const method of resolvedRelationMethods({
|
|
16
|
+
doc,
|
|
17
|
+
relation: 'assertionMethod'
|
|
18
|
+
})) {
|
|
19
|
+
if (typeof method.publicKeyMultibase === 'string') {
|
|
53
20
|
keys.add(method.publicKeyMultibase);
|
|
54
21
|
}
|
|
55
22
|
}
|
|
@@ -57,45 +24,41 @@ function assertionKeysOf(doc) {
|
|
|
57
24
|
}
|
|
58
25
|
/**
|
|
59
26
|
* Collects a document's credential-inventory view (see
|
|
60
|
-
* {@link ControllerInventory})
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
27
|
+
* {@link ControllerInventory}) over the shared account-document readers, so
|
|
28
|
+
* ladder recognition and the credential class have one definition here and in
|
|
29
|
+
* every other reader: `ladderVmMethods` names the ladder VMs by relation
|
|
30
|
+
* asymmetry, and `credentialKeyAgreementMethods` names the account-controlled
|
|
31
|
+
* `keyAgreement` methods. S(V) is those methods' key material --
|
|
32
|
+
* `publicKeyCommitment` where the entry is a commitment,
|
|
33
|
+
* `publicKeyMultibase` where it is verbatim (the two value spaces are
|
|
34
|
+
* disjoint) -- union the ladder keys. A `keyAgreement` method carrying
|
|
35
|
+
* neither is skipped: an unidentifiable entry must not make two distinct
|
|
36
|
+
* inventories compare equal.
|
|
68
37
|
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
38
|
+
* The enrolled-client set the license's third shape compares across versions
|
|
39
|
+
* is read from the same document in the same pass: the `capabilityInvocation`
|
|
40
|
+
* methods' key multibases. That relation is the client census by definition --
|
|
41
|
+
* a ladder VM is absent from it by the recognition asymmetry, and a
|
|
42
|
+
* credential's `keyAgreement` entry was never in it -- so the two sets this
|
|
43
|
+
* function returns cannot overlap by construction.
|
|
44
|
+
*
|
|
45
|
+
* @param options {object}
|
|
46
|
+
* @param options.doc {AccountDocument}
|
|
47
|
+
* @param options.did {string} the account DID inventory entries are
|
|
48
|
+
* controlled by
|
|
49
|
+
* @param options.entry {DIDLogEntry} the version's own log entry, read for
|
|
50
|
+
* the update keys that signed it
|
|
51
|
+
* @returns {Omit<ControllerInventory, 'ladderRungKeys'>}
|
|
72
52
|
*/
|
|
73
|
-
function inventoryOf(doc, did) {
|
|
74
|
-
const byId = methodsById(doc);
|
|
75
|
-
const invocable = new Set();
|
|
76
|
-
for (const entry of doc.capabilityInvocation ?? []) {
|
|
77
|
-
const id = relationIdOf(entry);
|
|
78
|
-
if (id !== undefined) {
|
|
79
|
-
invocable.add(id);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
53
|
+
function inventoryOf({ doc, did, entry }) {
|
|
82
54
|
const ladderKeys = new Set();
|
|
83
|
-
for (const
|
|
84
|
-
|
|
85
|
-
if (id !== undefined && invocable.has(id)) {
|
|
86
|
-
continue;
|
|
87
|
-
}
|
|
88
|
-
const method = resolveMethod(entry, byId);
|
|
89
|
-
if (method && typeof method.publicKeyMultibase === 'string') {
|
|
55
|
+
for (const method of ladderVmMethods({ doc })) {
|
|
56
|
+
if (typeof method.publicKeyMultibase === 'string') {
|
|
90
57
|
ladderKeys.add(method.publicKeyMultibase);
|
|
91
58
|
}
|
|
92
59
|
}
|
|
93
60
|
const inventoryKeys = new Set(ladderKeys);
|
|
94
|
-
for (const
|
|
95
|
-
const method = resolveMethod(entry, byId);
|
|
96
|
-
if (!method || method.controller !== did) {
|
|
97
|
-
continue;
|
|
98
|
-
}
|
|
61
|
+
for (const method of credentialKeyAgreementMethods({ doc, did })) {
|
|
99
62
|
if (typeof method.publicKeyCommitment === 'string') {
|
|
100
63
|
inventoryKeys.add(method.publicKeyCommitment);
|
|
101
64
|
}
|
|
@@ -103,7 +66,21 @@ function inventoryOf(doc, did) {
|
|
|
103
66
|
inventoryKeys.add(method.publicKeyMultibase);
|
|
104
67
|
}
|
|
105
68
|
}
|
|
106
|
-
|
|
69
|
+
const enrolledClientKeys = new Set();
|
|
70
|
+
for (const method of resolvedRelationMethods({
|
|
71
|
+
doc,
|
|
72
|
+
relation: 'capabilityInvocation'
|
|
73
|
+
})) {
|
|
74
|
+
if (typeof method.publicKeyMultibase === 'string') {
|
|
75
|
+
enrolledClientKeys.add(method.publicKeyMultibase);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
ladderKeys,
|
|
80
|
+
inventoryKeys,
|
|
81
|
+
enrolledClientKeys,
|
|
82
|
+
entrySignerKeys: entrySignerKeysOf(entry)
|
|
83
|
+
};
|
|
107
84
|
}
|
|
108
85
|
/**
|
|
109
86
|
* Builds the controller view over an already-verified did:webvh account log
|
|
@@ -132,11 +109,18 @@ export function webvhResourceLogController({ did, log }) {
|
|
|
132
109
|
const versionIds = log.map(entry => entry.versionId);
|
|
133
110
|
const keysByVersion = new Map();
|
|
134
111
|
const inventoryByVersion = new Map();
|
|
135
|
-
|
|
112
|
+
const positionByVersion = new Map();
|
|
113
|
+
for (const [position, entry] of log.entries()) {
|
|
136
114
|
const doc = entry.state;
|
|
137
115
|
keysByVersion.set(entry.versionId, assertionKeysOf(doc));
|
|
138
|
-
inventoryByVersion.set(entry.versionId, inventoryOf(doc, did));
|
|
116
|
+
inventoryByVersion.set(entry.versionId, inventoryOf({ doc, did, entry }));
|
|
117
|
+
positionByVersion.set(entry.versionId, position);
|
|
139
118
|
}
|
|
119
|
+
// The rung attribution hashes committed keys, so it cannot run in the sync
|
|
120
|
+
// pass above. It is computed once on the first inventory read and shared by
|
|
121
|
+
// every later one: the walk is a pure function of the log, and a log is read
|
|
122
|
+
// fresh and never mutated in place.
|
|
123
|
+
let rungSnapshots;
|
|
140
124
|
const head = log.length === 0 ? undefined : log[log.length - 1];
|
|
141
125
|
function versionRefusal(versionId) {
|
|
142
126
|
return new ResourceLogIntegrityError(`The controller document did not resolve at version ` +
|
|
@@ -154,14 +138,23 @@ export function webvhResourceLogController({ did, log }) {
|
|
|
154
138
|
}
|
|
155
139
|
return Promise.resolve(resolved);
|
|
156
140
|
},
|
|
157
|
-
inventoryAt(versionId) {
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
141
|
+
async inventoryAt(versionId) {
|
|
142
|
+
const resolvedVersionId = versionId === undefined ? head?.versionId : versionId;
|
|
143
|
+
const resolved = resolvedVersionId === undefined
|
|
144
|
+
? undefined
|
|
145
|
+
: inventoryByVersion.get(resolvedVersionId);
|
|
146
|
+
const position = resolvedVersionId === undefined
|
|
147
|
+
? undefined
|
|
148
|
+
: positionByVersion.get(resolvedVersionId);
|
|
149
|
+
if (!resolved || position === undefined) {
|
|
150
|
+
throw versionRefusal(versionId);
|
|
163
151
|
}
|
|
164
|
-
|
|
152
|
+
rungSnapshots ??= attributeLadderRungsPerVersion(log);
|
|
153
|
+
const snapshots = await rungSnapshots;
|
|
154
|
+
return {
|
|
155
|
+
...resolved,
|
|
156
|
+
ladderRungKeys: snapshots[position] ?? new Map()
|
|
157
|
+
};
|
|
165
158
|
},
|
|
166
159
|
async admitAppend({ keyMultibase, controllerVersionId, controllerVersionIndex, headControllerVersionIndex, proofKeys }) {
|
|
167
160
|
const inventory = await view.inventoryAt(controllerVersionId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.js","sourceRoot":"","sources":["../../src/resourceLog/controller.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"controller.js","sourceRoot":"","sources":["../../src/resourceLog/controller.ts"],"names":[],"mappings":"AAwBA,OAAO,EACL,yBAAyB,EAE1B,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACL,6BAA6B,EAC7B,eAAe,EACf,uBAAuB,EAExB,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,8BAA8B,EAC9B,iBAAiB,EAElB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAA;AAkEzD;;;;;;;GAOG;AACH,SAAS,eAAe,CAAC,GAAoB;IAC3C,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAA;IAC9B,KAAK,MAAM,MAAM,IAAI,uBAAuB,CAAC;QAC3C,GAAG;QACH,QAAQ,EAAE,iBAAiB;KAC5B,CAAC,EAAE,CAAC;QACH,IAAI,OAAO,MAAM,CAAC,kBAAkB,KAAK,QAAQ,EAAE,CAAC;YAClD,IAAI,C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EAAE;aACjD,CAAA;QACH,CAAC;QACD,KAAK,CAAC,WAAW,CAAC,EAChB,YAAY,EACZ,mBAAmB,EACnB,sBAAsB,EACtB,0BAA0B,EAC1B,SAAS,EACV;YACC,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAA;YAC7D,IAAI,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;gBAC3C,MAAM,0BAA0B,CAAC;oBAC/B,UAAU,EAAE,IAAI;oBAChB,sBAAsB;oBACtB,0BAA0B;oBAC1B,SAAS;iBACV,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;KACF,CAAA;IACD,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The account-document reading conventions every reader shares, in one place:
|
|
6
|
+
* how a verification relation resolves (string references into
|
|
7
|
+
* `verificationMethod`, embedded methods verbatim), which
|
|
8
|
+
* `capabilityDelegation` members are ladder VMs, and which `keyAgreement`
|
|
9
|
+
* methods are the account's credential inventory.
|
|
10
|
+
*
|
|
11
|
+
* Each of those rules is a wire-level convention of the account document, so
|
|
12
|
+
* a second implementation of one is a place the readers can disagree: the
|
|
13
|
+
* ceremony-tail license's inventory comparison and the client listing's
|
|
14
|
+
* ladder-VM recognition must answer identically over the same document, and
|
|
15
|
+
* so must the roster's recipient resolver and the client listing's marker
|
|
16
|
+
* filter. They are consumers of the readers here rather than re-readings of
|
|
17
|
+
* the document.
|
|
18
|
+
*
|
|
19
|
+
* Deliberately dependency-light -- it imports nothing at all -- so both the
|
|
20
|
+
* layer-0 controller adapter beside it and the `webvh` and `keys` layers
|
|
21
|
+
* above can share the readers without pulling the ceremony or signing graph.
|
|
22
|
+
* Its public home is `@interop/wallet-core/webvh`, which re-exports the
|
|
23
|
+
* `keyAgreement` readers and the ladder recognition; this subpath exports
|
|
24
|
+
* none of them, so each name has one owner.
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* The materialized shape the relation readers return: a verification method
|
|
28
|
+
* carrying either the key itself (`publicKeyMultibase`) or, for a
|
|
29
|
+
* low-entropy-derived standing unlock credential, its hash commitment
|
|
30
|
+
* (`publicKeyCommitment`). The `type` rides along so a consumer can tell the
|
|
31
|
+
* two published flavors apart (`Multikey` vs `MultikeyCommitment`) instead of
|
|
32
|
+
* inferring the flavor from which property happens to be present.
|
|
33
|
+
*/
|
|
34
|
+
export interface ResolvedKeyAgreementMethod {
|
|
35
|
+
id?: string;
|
|
36
|
+
type?: string;
|
|
37
|
+
controller?: string;
|
|
38
|
+
publicKeyMultibase?: string;
|
|
39
|
+
publicKeyCommitment?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* A locally verified did:webvh document, read for the verification relations
|
|
43
|
+
* it publishes and the methods they resolve to. Structural on purpose: a
|
|
44
|
+
* resolved `DIDDoc` satisfies it, and so does any narrower document shape a
|
|
45
|
+
* wallet already holds.
|
|
46
|
+
*/
|
|
47
|
+
export interface AccountDocument {
|
|
48
|
+
verificationMethod?: ResolvedKeyAgreementMethod[];
|
|
49
|
+
assertionMethod?: Array<string | ResolvedKeyAgreementMethod>;
|
|
50
|
+
keyAgreement?: Array<string | ResolvedKeyAgreementMethod>;
|
|
51
|
+
capabilityInvocation?: Array<string | ResolvedKeyAgreementMethod>;
|
|
52
|
+
capabilityDelegation?: Array<string | ResolvedKeyAgreementMethod>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The document shape the `keyAgreement` readers take, kept as the published
|
|
56
|
+
* name the `webvh` and `keys` subpaths surface. It is {@link AccountDocument}
|
|
57
|
+
* itself: every member is optional, so a caller holding only the
|
|
58
|
+
* `keyAgreement` half satisfies it unchanged.
|
|
59
|
+
*/
|
|
60
|
+
export type KeyAgreementDocument = AccountDocument;
|
|
61
|
+
/**
|
|
62
|
+
* The verification relations a document reader may resolve.
|
|
63
|
+
*/
|
|
64
|
+
export type DocumentRelation = Exclude<keyof AccountDocument, 'verificationMethod'>;
|
|
65
|
+
/**
|
|
66
|
+
* The relationship references of a resolved document as verification-method
|
|
67
|
+
* ids, tolerating embedded objects beside string references.
|
|
68
|
+
*
|
|
69
|
+
* @param relation {Array} the relationship array, when present
|
|
70
|
+
* @returns {string[]}
|
|
71
|
+
*/
|
|
72
|
+
export declare function relationIds(relation: Array<string | {
|
|
73
|
+
id?: string;
|
|
74
|
+
}> | undefined): string[];
|
|
75
|
+
/**
|
|
76
|
+
* The verification methods one relation publishes, materialized: string
|
|
77
|
+
* references resolved against `verificationMethod` (a reference nothing backs
|
|
78
|
+
* is dropped), embedded methods taken verbatim. Document order is preserved,
|
|
79
|
+
* and nothing is filtered -- deciding which of these methods belongs to whom
|
|
80
|
+
* is each caller's own rule.
|
|
81
|
+
*
|
|
82
|
+
* @param options {object}
|
|
83
|
+
* @param options.doc {AccountDocument} a locally verified document
|
|
84
|
+
* @param options.relation {DocumentRelation} the relation to resolve
|
|
85
|
+
* @returns {ResolvedKeyAgreementMethod[]}
|
|
86
|
+
*/
|
|
87
|
+
export declare function resolvedRelationMethods({ doc, relation }: {
|
|
88
|
+
doc: AccountDocument;
|
|
89
|
+
relation: DocumentRelation;
|
|
90
|
+
}): ResolvedKeyAgreementMethod[];
|
|
91
|
+
/**
|
|
92
|
+
* The `keyAgreement` verification methods a document publishes, materialized:
|
|
93
|
+
* string references resolved against `verificationMethod` (a reference nothing
|
|
94
|
+
* backs is dropped), embedded methods taken verbatim. Document order is
|
|
95
|
+
* preserved, and nothing is filtered -- deciding which of these methods belongs
|
|
96
|
+
* to whom is each caller's own rule.
|
|
97
|
+
*
|
|
98
|
+
* @param options {object}
|
|
99
|
+
* @param options.doc {KeyAgreementDocument} a locally verified document
|
|
100
|
+
* @returns {ResolvedKeyAgreementMethod[]}
|
|
101
|
+
*/
|
|
102
|
+
export declare function resolvedKeyAgreementMethods({ doc }: {
|
|
103
|
+
doc: KeyAgreementDocument;
|
|
104
|
+
}): ResolvedKeyAgreementMethod[];
|
|
105
|
+
/**
|
|
106
|
+
* The CREDENTIAL-CLASS `keyAgreement` methods a document publishes: those the
|
|
107
|
+
* account DID itself controls. The rule is structural, and it is the exact
|
|
108
|
+
* complement of the client marker: an enrolled client's key-agreement method
|
|
109
|
+
* carries `controller: did:key:<its signing multibase>`
|
|
110
|
+
* (`clientKeyAgreementController`), while a standing unlock credential's
|
|
111
|
+
* carries the account DID. Both published flavors match -- a passphrase's
|
|
112
|
+
* `MultikeyCommitment` and the verbatim `Multikey` a passkey or a recovery
|
|
113
|
+
* code publishes -- because the class is decided by the controller alone.
|
|
114
|
+
*
|
|
115
|
+
* Nothing here tells one credential from another. A recovery code's entry is
|
|
116
|
+
* indistinguishable from a passkey's by construction (both are unmarked and
|
|
117
|
+
* verbatim), so a caller retiring this class retires every credential the
|
|
118
|
+
* account stands on, which is what the transient and remembered recovery
|
|
119
|
+
* continuations want.
|
|
120
|
+
*
|
|
121
|
+
* @param options {object}
|
|
122
|
+
* @param options.doc {KeyAgreementDocument} a locally verified document
|
|
123
|
+
* @param options.did {string} the account DID the document resolves to
|
|
124
|
+
* @returns {ResolvedKeyAgreementMethod[]} in document order
|
|
125
|
+
*/
|
|
126
|
+
export declare function credentialKeyAgreementMethods({ doc, did }: {
|
|
127
|
+
doc: KeyAgreementDocument;
|
|
128
|
+
did: string;
|
|
129
|
+
}): ResolvedKeyAgreementMethod[];
|
|
130
|
+
/**
|
|
131
|
+
* The ladder-VM recognition convention: a `capabilityDelegation` member
|
|
132
|
+
* absent from `capabilityInvocation` is a ladder VM -- the stable sibling key
|
|
133
|
+
* a standing credential publishes for as long as it stands
|
|
134
|
+
* (`ladderVerificationMethod` is the one write-side builder). The
|
|
135
|
+
* asymmetry is the convention rather than a marker property because it is
|
|
136
|
+
* what actually carries the authority: zcap's `delegator.id` cannot identify
|
|
137
|
+
* the signer, so a verifier classifies the VM from the resolved document it
|
|
138
|
+
* already holds -- a zero-I/O read -- and the same asymmetry is what keeps
|
|
139
|
+
* the VM structurally out of every client listing (those key on
|
|
140
|
+
* `capabilityInvocation`). An enrolled client publishes its signing key under
|
|
141
|
+
* both relations, so it can never match.
|
|
142
|
+
*
|
|
143
|
+
* Returns every matching verification-method id, in document order. A ladder
|
|
144
|
+
* VM's life is keyed to its credential rather than to the account's client
|
|
145
|
+
* census: the standing establishment installs it, the credential's retirement
|
|
146
|
+
* strikes it, and enrollment leaves it alone. So the count is one per
|
|
147
|
+
* standing credential, co-resident with however many clients the account has
|
|
148
|
+
* enrolled, and a stale third-party VM can stand beside them.
|
|
149
|
+
*
|
|
150
|
+
* @param options {object}
|
|
151
|
+
* @param options.doc {object} a locally verified document
|
|
152
|
+
* @returns {string[]} the ladder VMs' verification-method ids
|
|
153
|
+
*/
|
|
154
|
+
export declare function ladderVmIds({ doc }: {
|
|
155
|
+
doc: {
|
|
156
|
+
capabilityInvocation?: Array<string | {
|
|
157
|
+
id?: string;
|
|
158
|
+
}>;
|
|
159
|
+
capabilityDelegation?: Array<string | {
|
|
160
|
+
id?: string;
|
|
161
|
+
}>;
|
|
162
|
+
};
|
|
163
|
+
}): string[];
|
|
164
|
+
/**
|
|
165
|
+
* The ladder VMs' verification methods, materialized: the
|
|
166
|
+
* `capabilityDelegation` methods {@link ladderVmIds} names, resolved the way
|
|
167
|
+
* every other relation read resolves. Recognition therefore has exactly one
|
|
168
|
+
* definition -- a reader needing the ladder keys themselves (their
|
|
169
|
+
* `publicKeyMultibase`) asks here rather than re-deriving the asymmetry.
|
|
170
|
+
*
|
|
171
|
+
* A method the recognition cannot name -- an embedded `capabilityDelegation`
|
|
172
|
+
* entry carrying no `id`, or a reference nothing backs -- is not a ladder VM
|
|
173
|
+
* here, the same refuse-not-guess answer the id-keyed recognition gives.
|
|
174
|
+
*
|
|
175
|
+
* @param options {object}
|
|
176
|
+
* @param options.doc {AccountDocument} a locally verified document
|
|
177
|
+
* @returns {ResolvedKeyAgreementMethod[]} in document order
|
|
178
|
+
*/
|
|
179
|
+
export declare function ladderVmMethods({ doc }: {
|
|
180
|
+
doc: AccountDocument;
|
|
181
|
+
}): ResolvedKeyAgreementMethod[];
|
|
182
|
+
//# sourceMappingURL=document.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../src/resourceLog/document.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH;;;;;;;GAOG;AACH,MAAM,WAAW,0BAA0B;IACzC,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAA;CAC7B;AAED;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,kBAAkB,CAAC,EAAE,0BAA0B,EAAE,CAAA;IACjD,eAAe,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,0BAA0B,CAAC,CAAA;IAC5D,YAAY,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,0BAA0B,CAAC,CAAA;IACzD,oBAAoB,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,0BAA0B,CAAC,CAAA;IACjE,oBAAoB,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,0BAA0B,CAAC,CAAA;CAClE;AAED;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG,eAAe,CAAA;AAElD;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,CACpC,MAAM,eAAe,EACrB,oBAAoB,CACrB,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,KAAK,CAAC,MAAM,GAAG;IAAE,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,SAAS,GACpD,MAAM,EAAE,CASV;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,GAAG,EACH,QAAQ,EACT,EAAE;IACD,GAAG,EAAE,eAAe,CAAA;IACpB,QAAQ,EAAE,gBAAgB,CAAA;CAC3B,GAAG,0BAA0B,EAAE,CAe/B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CAAC,EAC1C,GAAG,EACJ,EAAE;IACD,GAAG,EAAE,oBAAoB,CAAA;CAC1B,GAAG,0BAA0B,EAAE,CAE/B;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,6BAA6B,CAAC,EAC5C,GAAG,EACH,GAAG,EACJ,EAAE;IACD,GAAG,EAAE,oBAAoB,CAAA;IACzB,GAAG,EAAE,MAAM,CAAA;CACZ,GAAG,0BAA0B,EAAE,CAI/B;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,WAAW,CAAC,EAC1B,GAAG,EACJ,EAAE;IACD,GAAG,EAAE;QACH,oBAAoB,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG;YAAE,EAAE,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;QACtD,oBAAoB,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG;YAAE,EAAE,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KACvD,CAAA;CACF,GAAG,MAAM,EAAE,CAGX;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAAC,EAC9B,GAAG,EACJ,EAAE;IACD,GAAG,EAAE,eAAe,CAAA;CACrB,GAAG,0BAA0B,EAAE,CAM/B"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The account-document reading conventions every reader shares, in one place:
|
|
6
|
+
* how a verification relation resolves (string references into
|
|
7
|
+
* `verificationMethod`, embedded methods verbatim), which
|
|
8
|
+
* `capabilityDelegation` members are ladder VMs, and which `keyAgreement`
|
|
9
|
+
* methods are the account's credential inventory.
|
|
10
|
+
*
|
|
11
|
+
* Each of those rules is a wire-level convention of the account document, so
|
|
12
|
+
* a second implementation of one is a place the readers can disagree: the
|
|
13
|
+
* ceremony-tail license's inventory comparison and the client listing's
|
|
14
|
+
* ladder-VM recognition must answer identically over the same document, and
|
|
15
|
+
* so must the roster's recipient resolver and the client listing's marker
|
|
16
|
+
* filter. They are consumers of the readers here rather than re-readings of
|
|
17
|
+
* the document.
|
|
18
|
+
*
|
|
19
|
+
* Deliberately dependency-light -- it imports nothing at all -- so both the
|
|
20
|
+
* layer-0 controller adapter beside it and the `webvh` and `keys` layers
|
|
21
|
+
* above can share the readers without pulling the ceremony or signing graph.
|
|
22
|
+
* Its public home is `@interop/wallet-core/webvh`, which re-exports the
|
|
23
|
+
* `keyAgreement` readers and the ladder recognition; this subpath exports
|
|
24
|
+
* none of them, so each name has one owner.
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* The relationship references of a resolved document as verification-method
|
|
28
|
+
* ids, tolerating embedded objects beside string references.
|
|
29
|
+
*
|
|
30
|
+
* @param relation {Array} the relationship array, when present
|
|
31
|
+
* @returns {string[]}
|
|
32
|
+
*/
|
|
33
|
+
export function relationIds(relation) {
|
|
34
|
+
const ids = [];
|
|
35
|
+
for (const entry of relation ?? []) {
|
|
36
|
+
const id = typeof entry === 'string' ? entry : entry?.id;
|
|
37
|
+
if (id) {
|
|
38
|
+
ids.push(id);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return ids;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The verification methods one relation publishes, materialized: string
|
|
45
|
+
* references resolved against `verificationMethod` (a reference nothing backs
|
|
46
|
+
* is dropped), embedded methods taken verbatim. Document order is preserved,
|
|
47
|
+
* and nothing is filtered -- deciding which of these methods belongs to whom
|
|
48
|
+
* is each caller's own rule.
|
|
49
|
+
*
|
|
50
|
+
* @param options {object}
|
|
51
|
+
* @param options.doc {AccountDocument} a locally verified document
|
|
52
|
+
* @param options.relation {DocumentRelation} the relation to resolve
|
|
53
|
+
* @returns {ResolvedKeyAgreementMethod[]}
|
|
54
|
+
*/
|
|
55
|
+
export function resolvedRelationMethods({ doc, relation }) {
|
|
56
|
+
const byId = new Map();
|
|
57
|
+
for (const method of doc.verificationMethod ?? []) {
|
|
58
|
+
if (typeof method?.id === 'string') {
|
|
59
|
+
byId.set(method.id, method);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const methods = [];
|
|
63
|
+
for (const entry of doc[relation] ?? []) {
|
|
64
|
+
const method = typeof entry === 'string' ? byId.get(entry) : entry;
|
|
65
|
+
if (method) {
|
|
66
|
+
methods.push(method);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return methods;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The `keyAgreement` verification methods a document publishes, materialized:
|
|
73
|
+
* string references resolved against `verificationMethod` (a reference nothing
|
|
74
|
+
* backs is dropped), embedded methods taken verbatim. Document order is
|
|
75
|
+
* preserved, and nothing is filtered -- deciding which of these methods belongs
|
|
76
|
+
* to whom is each caller's own rule.
|
|
77
|
+
*
|
|
78
|
+
* @param options {object}
|
|
79
|
+
* @param options.doc {KeyAgreementDocument} a locally verified document
|
|
80
|
+
* @returns {ResolvedKeyAgreementMethod[]}
|
|
81
|
+
*/
|
|
82
|
+
export function resolvedKeyAgreementMethods({ doc }) {
|
|
83
|
+
return resolvedRelationMethods({ doc, relation: 'keyAgreement' });
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The CREDENTIAL-CLASS `keyAgreement` methods a document publishes: those the
|
|
87
|
+
* account DID itself controls. The rule is structural, and it is the exact
|
|
88
|
+
* complement of the client marker: an enrolled client's key-agreement method
|
|
89
|
+
* carries `controller: did:key:<its signing multibase>`
|
|
90
|
+
* (`clientKeyAgreementController`), while a standing unlock credential's
|
|
91
|
+
* carries the account DID. Both published flavors match -- a passphrase's
|
|
92
|
+
* `MultikeyCommitment` and the verbatim `Multikey` a passkey or a recovery
|
|
93
|
+
* code publishes -- because the class is decided by the controller alone.
|
|
94
|
+
*
|
|
95
|
+
* Nothing here tells one credential from another. A recovery code's entry is
|
|
96
|
+
* indistinguishable from a passkey's by construction (both are unmarked and
|
|
97
|
+
* verbatim), so a caller retiring this class retires every credential the
|
|
98
|
+
* account stands on, which is what the transient and remembered recovery
|
|
99
|
+
* continuations want.
|
|
100
|
+
*
|
|
101
|
+
* @param options {object}
|
|
102
|
+
* @param options.doc {KeyAgreementDocument} a locally verified document
|
|
103
|
+
* @param options.did {string} the account DID the document resolves to
|
|
104
|
+
* @returns {ResolvedKeyAgreementMethod[]} in document order
|
|
105
|
+
*/
|
|
106
|
+
export function credentialKeyAgreementMethods({ doc, did }) {
|
|
107
|
+
return resolvedKeyAgreementMethods({ doc }).filter(method => method.controller === did);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* The ladder-VM recognition convention: a `capabilityDelegation` member
|
|
111
|
+
* absent from `capabilityInvocation` is a ladder VM -- the stable sibling key
|
|
112
|
+
* a standing credential publishes for as long as it stands
|
|
113
|
+
* (`ladderVerificationMethod` is the one write-side builder). The
|
|
114
|
+
* asymmetry is the convention rather than a marker property because it is
|
|
115
|
+
* what actually carries the authority: zcap's `delegator.id` cannot identify
|
|
116
|
+
* the signer, so a verifier classifies the VM from the resolved document it
|
|
117
|
+
* already holds -- a zero-I/O read -- and the same asymmetry is what keeps
|
|
118
|
+
* the VM structurally out of every client listing (those key on
|
|
119
|
+
* `capabilityInvocation`). An enrolled client publishes its signing key under
|
|
120
|
+
* both relations, so it can never match.
|
|
121
|
+
*
|
|
122
|
+
* Returns every matching verification-method id, in document order. A ladder
|
|
123
|
+
* VM's life is keyed to its credential rather than to the account's client
|
|
124
|
+
* census: the standing establishment installs it, the credential's retirement
|
|
125
|
+
* strikes it, and enrollment leaves it alone. So the count is one per
|
|
126
|
+
* standing credential, co-resident with however many clients the account has
|
|
127
|
+
* enrolled, and a stale third-party VM can stand beside them.
|
|
128
|
+
*
|
|
129
|
+
* @param options {object}
|
|
130
|
+
* @param options.doc {object} a locally verified document
|
|
131
|
+
* @returns {string[]} the ladder VMs' verification-method ids
|
|
132
|
+
*/
|
|
133
|
+
export function ladderVmIds({ doc }) {
|
|
134
|
+
const invocable = new Set(relationIds(doc.capabilityInvocation));
|
|
135
|
+
return relationIds(doc.capabilityDelegation).filter(id => !invocable.has(id));
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* The ladder VMs' verification methods, materialized: the
|
|
139
|
+
* `capabilityDelegation` methods {@link ladderVmIds} names, resolved the way
|
|
140
|
+
* every other relation read resolves. Recognition therefore has exactly one
|
|
141
|
+
* definition -- a reader needing the ladder keys themselves (their
|
|
142
|
+
* `publicKeyMultibase`) asks here rather than re-deriving the asymmetry.
|
|
143
|
+
*
|
|
144
|
+
* A method the recognition cannot name -- an embedded `capabilityDelegation`
|
|
145
|
+
* entry carrying no `id`, or a reference nothing backs -- is not a ladder VM
|
|
146
|
+
* here, the same refuse-not-guess answer the id-keyed recognition gives.
|
|
147
|
+
*
|
|
148
|
+
* @param options {object}
|
|
149
|
+
* @param options.doc {AccountDocument} a locally verified document
|
|
150
|
+
* @returns {ResolvedKeyAgreementMethod[]} in document order
|
|
151
|
+
*/
|
|
152
|
+
export function ladderVmMethods({ doc }) {
|
|
153
|
+
const ids = new Set(ladderVmIds({ doc }));
|
|
154
|
+
return resolvedRelationMethods({
|
|
155
|
+
doc,
|
|
156
|
+
relation: 'capabilityDelegation'
|
|
157
|
+
}).filter(method => typeof method.id === 'string' && ids.has(method.id));
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=document.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document.js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