@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
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { rootCapabilityId, spacePath, toUrl } from '@interop/was-client/paths';
|
|
2
|
+
/**
|
|
3
|
+
* The single-verb Space capability's lifetime: ten minutes, long enough for
|
|
4
|
+
* the request it is minted for and twice `@interop/zcap`'s 300-second clock
|
|
5
|
+
* skew allowance. A child's `expires` is the earlier of this and its
|
|
6
|
+
* parent's, since the library refuses a child less restrictive than its
|
|
7
|
+
* parent with no skew allowance.
|
|
8
|
+
*/
|
|
9
|
+
export const DELETION_ZCAP_TTL_MS = 10 * 60 * 1000;
|
|
10
|
+
/**
|
|
11
|
+
* The typed refusal of a mint over a parent capability whose own `expires`
|
|
12
|
+
* has already passed: the child would verify nowhere, so nothing is minted
|
|
13
|
+
* and nothing is sent. Matched on `name` -- error classes do not survive
|
|
14
|
+
* crossing package copies. The parent's `expires` and `id` ride the error so
|
|
15
|
+
* a caller can name the lapsed capability in its own copy without re-reading
|
|
16
|
+
* the parent.
|
|
17
|
+
*/
|
|
18
|
+
export class ExpiredParentCapabilityError extends Error {
|
|
19
|
+
parentExpires;
|
|
20
|
+
parentId;
|
|
21
|
+
constructor({ message, parentExpires, parentId }) {
|
|
22
|
+
super(message);
|
|
23
|
+
this.name = 'ExpiredParentCapabilityError';
|
|
24
|
+
this.parentExpires = parentExpires;
|
|
25
|
+
this.parentId = parentId;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The child's expiry: `min(now + ttlMs, parent.expires)`. A parent already
|
|
30
|
+
* expired is refused rather than minted from, since the child would verify
|
|
31
|
+
* nowhere.
|
|
32
|
+
*
|
|
33
|
+
* @param options {object}
|
|
34
|
+
* @param options.ttlMs {number}
|
|
35
|
+
* @param [options.parent] {IZcap} the stored parent capability, absent on
|
|
36
|
+
* the root-parented shape (a synthesized root has no expiry)
|
|
37
|
+
* @param options.now {number} epoch milliseconds
|
|
38
|
+
* @returns {Date}
|
|
39
|
+
*/
|
|
40
|
+
function childExpires({ ttlMs, parent, now }) {
|
|
41
|
+
const requested = now + ttlMs;
|
|
42
|
+
const parentExpires = Date.parse(parent?.expires ?? '');
|
|
43
|
+
if (Number.isNaN(parentExpires)) {
|
|
44
|
+
return new Date(requested);
|
|
45
|
+
}
|
|
46
|
+
if (parentExpires <= now) {
|
|
47
|
+
const expiresIso = new Date(parentExpires).toISOString();
|
|
48
|
+
throw new ExpiredParentCapabilityError({
|
|
49
|
+
message: 'single-verb Space capability: the parent capability expired at ' +
|
|
50
|
+
`${expiresIso}; refusing to mint a child that verifies nowhere.`,
|
|
51
|
+
parentExpires: expiresIso,
|
|
52
|
+
parentId: parent?.id
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return new Date(Math.min(requested, parentExpires));
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Refuses a child the parent cannot authorize. A parent's `allowedAction` may
|
|
59
|
+
* be a single string, a list, or absent (which delegates every action), so
|
|
60
|
+
* the check normalizes before asking. Refusing locally is what keeps the
|
|
61
|
+
* failure legible: an unauthorized invocation comes back from the storage
|
|
62
|
+
* server as a 404, indistinguishable from a Space that is simply gone, so a
|
|
63
|
+
* child that verifies nowhere must never be minted and sent.
|
|
64
|
+
*
|
|
65
|
+
* @param options {object}
|
|
66
|
+
* @param options.parent {IZcap}
|
|
67
|
+
* @param options.verb {SpaceCapabilityVerb}
|
|
68
|
+
* @returns {void}
|
|
69
|
+
*/
|
|
70
|
+
function assertParentAllows({ parent, verb }) {
|
|
71
|
+
const allowed = parent
|
|
72
|
+
.allowedAction;
|
|
73
|
+
if (allowed === undefined) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const actions = Array.isArray(allowed) ? allowed : [allowed];
|
|
77
|
+
if (actions.length === 0 || actions.includes(verb)) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
throw new Error(`single-verb Space capability: the parent capability allows ` +
|
|
81
|
+
`${actions.join(', ')} and not ${verb}; refusing to mint a child that ` +
|
|
82
|
+
'verifies nowhere.');
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Mints a single-verb child of a STORED parent capability -- the three-link
|
|
86
|
+
* shape, used on an unlock Space whose management zcap the account already
|
|
87
|
+
* holds. The child's `invocationTarget` is the parent's unchanged.
|
|
88
|
+
*
|
|
89
|
+
* @param options {object}
|
|
90
|
+
* @param options.zcapClient {ZcapClient} the delegating signer (the ladder
|
|
91
|
+
* VM's client on a transient session, an enrolled client's on a remembered
|
|
92
|
+
* one)
|
|
93
|
+
* @param options.parent {IZcap} the stored parent capability
|
|
94
|
+
* @param options.verb {SpaceCapabilityVerb} the child's one allowed action
|
|
95
|
+
* @param options.controller {string} the delegatee DID
|
|
96
|
+
* @param [options.ttlMs] {number} the child's requested lifetime
|
|
97
|
+
* @param [options.now] {number} the clock the child is minted against
|
|
98
|
+
* (epoch milliseconds); a caller holding server-relative time passes it
|
|
99
|
+
* so the proof's `created` and the child's `expires` come off one clock
|
|
100
|
+
* @returns {Promise<IZcap>}
|
|
101
|
+
*/
|
|
102
|
+
export async function mintSpaceVerbCapability({ zcapClient, parent, verb, controller, ttlMs = DELETION_ZCAP_TTL_MS, now = Date.now() }) {
|
|
103
|
+
const invocationTarget = parent
|
|
104
|
+
.invocationTarget;
|
|
105
|
+
if (invocationTarget === undefined) {
|
|
106
|
+
throw new Error('single-verb Space capability: the parent capability names no ' +
|
|
107
|
+
'`invocationTarget`.');
|
|
108
|
+
}
|
|
109
|
+
assertParentAllows({ parent, verb });
|
|
110
|
+
return (await zcapClient.delegate({
|
|
111
|
+
capability: parent,
|
|
112
|
+
invocationTarget,
|
|
113
|
+
controller,
|
|
114
|
+
allowedActions: [verb],
|
|
115
|
+
expires: childExpires({ ttlMs, parent, now }),
|
|
116
|
+
now
|
|
117
|
+
}));
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Mints a single-verb child of a Space's SYNTHESIZED ROOT -- the two-link
|
|
121
|
+
* shape, used on the account Space and an auxiliary annex Space, where the
|
|
122
|
+
* session holds no stored parent. The child's `invocationTarget` is the bare
|
|
123
|
+
* Space URL, with no trailing slash, so the deletion child covers the Space
|
|
124
|
+
* itself rather than its items subtree.
|
|
125
|
+
*
|
|
126
|
+
* @param options {object}
|
|
127
|
+
* @param options.zcapClient {ZcapClient} the delegating signer
|
|
128
|
+
* @param options.storageServerUrl {string} the Space's storage server
|
|
129
|
+
* @param options.spaceId {string}
|
|
130
|
+
* @param options.verb {SpaceCapabilityVerb} the child's one allowed action
|
|
131
|
+
* @param options.controller {string} the delegatee DID
|
|
132
|
+
* @param [options.ttlMs] {number} the child's requested lifetime
|
|
133
|
+
* @param [options.now] {number} the clock the child is minted against
|
|
134
|
+
* (epoch milliseconds); a caller holding server-relative time passes it
|
|
135
|
+
* so the proof's `created` and the child's `expires` come off one clock
|
|
136
|
+
* @returns {Promise<IZcap>}
|
|
137
|
+
*/
|
|
138
|
+
export async function mintSpaceRootVerbCapability({ zcapClient, storageServerUrl, spaceId, verb, controller, ttlMs = DELETION_ZCAP_TTL_MS, now = Date.now() }) {
|
|
139
|
+
const spaceUrl = toUrl({
|
|
140
|
+
serverUrl: storageServerUrl,
|
|
141
|
+
path: spacePath(spaceId)
|
|
142
|
+
});
|
|
143
|
+
return (await zcapClient.delegate({
|
|
144
|
+
capability: rootCapabilityId(spaceUrl),
|
|
145
|
+
invocationTarget: spaceUrl,
|
|
146
|
+
controller,
|
|
147
|
+
allowedActions: [verb],
|
|
148
|
+
expires: childExpires({ ttlMs, now }),
|
|
149
|
+
now
|
|
150
|
+
}));
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=spaceCapability.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spaceCapability.js","sourceRoot":"","sources":["../../src/clientAnnex/spaceCapability.ts"],"names":[],"mappings":"AAsCA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAA;AAE9E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;AAQlD;;;;;;;GAOG;AACH,MAAM,OAAO,4BAA6B,SAAQ,KAAK;IAC5C,aAAa,CAAQ;IACrB,QAAQ,CAAoB;IAErC,YAAY,EACV,OAAO,EACP,aAAa,EACb,QAAQ,EAKT;QACC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,8BAA8B,CAAA;QAC1C,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;QAClC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC1B,CAAC;CACF;AAED;;;;;;;;;;;GAWG;AACH,SAAS,YAAY,CAAC,EACpB,KAAK,EACL,MAAM,EACN,GAAG,EAKJ;IACC,MAAM,SAAS,GAAG,GAAG,GAAG,KAAK,CAAA;IAC7B,MAAM,aAAa,GAA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CAAU,CAAA;AACd,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The stage vocabulary of the credential-anchored ceremonies: the ordered
|
|
6
|
+
* tuples their `onStage` notifiers report from, the aliases, and the union
|
|
7
|
+
* types derived from them. The ceremonies emit from these types, so a
|
|
8
|
+
* mistyped stage name fails the type check, and a consumer's progress
|
|
9
|
+
* display derives its step list from the tuples instead of re-declaring the
|
|
10
|
+
* names as bare strings.
|
|
11
|
+
*
|
|
12
|
+
* The vocabulary sits in a leaf module of its own rather than beside the
|
|
13
|
+
* code that emits it, because a progress display needs the names and none of
|
|
14
|
+
* the ceremony: an app store importing them from `establish.js` would pull
|
|
15
|
+
* that whole module graph into its bundle.
|
|
16
|
+
*/
|
|
17
|
+
import { KMS_AUTHENTICATION_STAGE } from '../stages.js';
|
|
18
|
+
export { KMS_AUTHENTICATION_STAGE };
|
|
19
|
+
/**
|
|
20
|
+
* The controller-promotion stage, emitted by the genesis ceremony when it
|
|
21
|
+
* promotes and by the establishment when the promotion is deferred to it.
|
|
22
|
+
* Declared once so the two emitters cannot drift apart.
|
|
23
|
+
*/
|
|
24
|
+
export declare const CONTROLLER_PROMOTION_STAGE = "controller-promotion";
|
|
25
|
+
/**
|
|
26
|
+
* The stages `ensureCredentialAnchoredAccountGenesis` reports, in the order
|
|
27
|
+
* they fire, up to but not including the controller promotion (which a
|
|
28
|
+
* caller may defer -- see {@link CONTROLLER_PROMOTION_STAGE}).
|
|
29
|
+
*/
|
|
30
|
+
export declare const CREDENTIAL_ANCHORED_GENESIS_STAGES: readonly ["space-provisioning", "kms-authentication", "webvh-genesis", "roster-genesis", "collection-epochs"];
|
|
31
|
+
/**
|
|
32
|
+
* A stage name the credential-anchored genesis may emit.
|
|
33
|
+
*/
|
|
34
|
+
export type CredentialAnchoredGenesisStage = (typeof CREDENTIAL_ANCHORED_GENESIS_STAGES)[number] | typeof CONTROLLER_PROMOTION_STAGE;
|
|
35
|
+
/**
|
|
36
|
+
* The establishment's stage names in the order they fire: its own marks with
|
|
37
|
+
* the genesis ceremony's spliced in where that ceremony runs (stage 2).
|
|
38
|
+
*
|
|
39
|
+
* Two kinds of name are absent by construction. The stages whose body is a
|
|
40
|
+
* caller's own closure (`beforePromotion`, `promoteKeystore`) are the
|
|
41
|
+
* caller's to name and mark, since only the caller knows what its closure
|
|
42
|
+
* does; and an alias below fires in place of a listed name rather than
|
|
43
|
+
* beside it.
|
|
44
|
+
*/
|
|
45
|
+
export declare const CREDENTIAL_ANCHORED_ESTABLISHMENT_STAGES: readonly ["interim-bind", "space-provisioning", "kms-authentication", "webvh-genesis", "roster-genesis", "collection-epochs", "account-log-read", "annex-generation", "record-rebind", "controller-promotion"];
|
|
46
|
+
/**
|
|
47
|
+
* A stage the establishment reports as a step of its own.
|
|
48
|
+
*/
|
|
49
|
+
export type CredentialAnchoredEstablishmentStage = (typeof CREDENTIAL_ANCHORED_ESTABLISHMENT_STAGES)[number];
|
|
50
|
+
/**
|
|
51
|
+
* Stage names that fire in place of a listed stage rather than beside it,
|
|
52
|
+
* and the stage each stands in for. The heal branch delivers the collection
|
|
53
|
+
* epochs off an adopted roster instead of minting them, so its mark closes
|
|
54
|
+
* the boundary `collection-epochs` closes on a fresh run.
|
|
55
|
+
*/
|
|
56
|
+
export declare const CREDENTIAL_ANCHORED_ESTABLISHMENT_STAGE_ALIASES: {
|
|
57
|
+
readonly 'roster-delivered-epochs': "collection-epochs";
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Every name the establishment may emit: the stages above plus the aliases.
|
|
61
|
+
*/
|
|
62
|
+
export type CredentialAnchoredEstablishmentStageName = CredentialAnchoredEstablishmentStage | keyof typeof CREDENTIAL_ANCHORED_ESTABLISHMENT_STAGE_ALIASES;
|
|
63
|
+
//# sourceMappingURL=stages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stages.d.ts","sourceRoot":"","sources":["../../src/clientAnnex/stages.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAA;AAEvD,OAAO,EAAE,wBAAwB,EAAE,CAAA;AAEnC;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,yBAAyB,CAAA;AAEhE;;;;GAIG;AACH,eAAO,MAAM,kCAAkC,+GAMrC,CAAA;AAEV;;GAEG;AACH,MAAM,MAAM,8BAA8B,GACtC,CAAC,OAAO,kCAAkC,CAAC,CAAC,MAAM,CAAC,GACnD,OAAO,0BAA0B,CAAA;AAErC;;;;;;;;;GASG;AACH,eAAO,MAAM,wCAAwC,gNAO3C,CAAA;AAEV;;GAEG;AACH,MAAM,MAAM,oCAAoC,GAC9C,CAAC,OAAO,wCAAwC,CAAC,CAAC,MAAM,CAAC,CAAA;AAE3D;;;;;GAKG;AACH,eAAO,MAAM,+CAA+C;;CAEa,CAAA;AAEzE;;GAEG;AACH,MAAM,MAAM,wCAAwC,GAChD,oCAAoC,GACpC,MAAM,OAAO,+CAA+C,CAAA"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The stage vocabulary of the credential-anchored ceremonies: the ordered
|
|
6
|
+
* tuples their `onStage` notifiers report from, the aliases, and the union
|
|
7
|
+
* types derived from them. The ceremonies emit from these types, so a
|
|
8
|
+
* mistyped stage name fails the type check, and a consumer's progress
|
|
9
|
+
* display derives its step list from the tuples instead of re-declaring the
|
|
10
|
+
* names as bare strings.
|
|
11
|
+
*
|
|
12
|
+
* The vocabulary sits in a leaf module of its own rather than beside the
|
|
13
|
+
* code that emits it, because a progress display needs the names and none of
|
|
14
|
+
* the ceremony: an app store importing them from `establish.js` would pull
|
|
15
|
+
* that whole module graph into its bundle.
|
|
16
|
+
*/
|
|
17
|
+
import { KMS_AUTHENTICATION_STAGE } from '../stages.js';
|
|
18
|
+
export { KMS_AUTHENTICATION_STAGE };
|
|
19
|
+
/**
|
|
20
|
+
* The controller-promotion stage, emitted by the genesis ceremony when it
|
|
21
|
+
* promotes and by the establishment when the promotion is deferred to it.
|
|
22
|
+
* Declared once so the two emitters cannot drift apart.
|
|
23
|
+
*/
|
|
24
|
+
export const CONTROLLER_PROMOTION_STAGE = 'controller-promotion';
|
|
25
|
+
/**
|
|
26
|
+
* The stages `ensureCredentialAnchoredAccountGenesis` reports, in the order
|
|
27
|
+
* they fire, up to but not including the controller promotion (which a
|
|
28
|
+
* caller may defer -- see {@link CONTROLLER_PROMOTION_STAGE}).
|
|
29
|
+
*/
|
|
30
|
+
export const CREDENTIAL_ANCHORED_GENESIS_STAGES = [
|
|
31
|
+
'space-provisioning',
|
|
32
|
+
KMS_AUTHENTICATION_STAGE,
|
|
33
|
+
'webvh-genesis',
|
|
34
|
+
'roster-genesis',
|
|
35
|
+
'collection-epochs'
|
|
36
|
+
];
|
|
37
|
+
/**
|
|
38
|
+
* The establishment's stage names in the order they fire: its own marks with
|
|
39
|
+
* the genesis ceremony's spliced in where that ceremony runs (stage 2).
|
|
40
|
+
*
|
|
41
|
+
* Two kinds of name are absent by construction. The stages whose body is a
|
|
42
|
+
* caller's own closure (`beforePromotion`, `promoteKeystore`) are the
|
|
43
|
+
* caller's to name and mark, since only the caller knows what its closure
|
|
44
|
+
* does; and an alias below fires in place of a listed name rather than
|
|
45
|
+
* beside it.
|
|
46
|
+
*/
|
|
47
|
+
export const CREDENTIAL_ANCHORED_ESTABLISHMENT_STAGES = [
|
|
48
|
+
'interim-bind',
|
|
49
|
+
...CREDENTIAL_ANCHORED_GENESIS_STAGES,
|
|
50
|
+
'account-log-read',
|
|
51
|
+
'annex-generation',
|
|
52
|
+
'record-rebind',
|
|
53
|
+
CONTROLLER_PROMOTION_STAGE
|
|
54
|
+
];
|
|
55
|
+
/**
|
|
56
|
+
* Stage names that fire in place of a listed stage rather than beside it,
|
|
57
|
+
* and the stage each stands in for. The heal branch delivers the collection
|
|
58
|
+
* epochs off an adopted roster instead of minting them, so its mark closes
|
|
59
|
+
* the boundary `collection-epochs` closes on a fresh run.
|
|
60
|
+
*/
|
|
61
|
+
export const CREDENTIAL_ANCHORED_ESTABLISHMENT_STAGE_ALIASES = {
|
|
62
|
+
'roster-delivered-epochs': 'collection-epochs'
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=stages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stages.js","sourceRoot":"","sources":["../../src/clientAnnex/stages.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAA;AAEvD,OAAO,EAAE,wBAAwB,EAAE,CAAA;AAEnC;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,sBAAsB,CAAA;AAEhE;;;;GAIG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG;IAChD,oBAAoB;IACpB,wBAAwB;IACxB,eAAe;IACf,gBAAgB;IAChB,mBAAmB;CACX,CAAA;AASV;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,wCAAwC,GAAG;IACtD,cAAc;IACd,GAAG,kCAAkC;IACrC,kBAAkB;IAClB,kBAAkB;IAClB,eAAe;IACf,0BAA0B;CAClB,CAAA;AAQV;;;;;GAKG;AACH,MAAM,CAAC,MAAM,+CAA+C,GAAG;IAC7D,yBAAyB,EAAE,mBAAmB;CACyB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zcap.d.ts","sourceRoot":"","sources":["../../src/clientAnnex/zcap.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"zcap.d.ts","sourceRoot":"","sources":["../../src/clientAnnex/zcap.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEhD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAgDxD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAsB,kBAAkB,CAAC,EACvC,UAAU,EACV,UAAU,EACX,EAAE;IACD,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,UAAU,CAAA;CACvB,GAAG,OAAO,CAAC,UAAU,CAAC,CAGtB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,aAAa,CAAC,EAClC,UAAU,EACX,EAAE;IACD,UAAU,EAAE,UAAU,CAAA;CACvB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAkB5B"}
|
package/dist/clientAnnex/zcap.js
CHANGED
|
@@ -8,10 +8,45 @@
|
|
|
8
8
|
* only the credential-anchored flows (a ladder-anchored account, a transient
|
|
9
9
|
* session holding nothing but the unlock credential) ever sign as the ladder.
|
|
10
10
|
*/
|
|
11
|
-
import { Ed25519Signature2020 } from '@interop/ed25519-signature';
|
|
12
11
|
import { Ed25519VerificationKey } from '@interop/ed25519-verification-key';
|
|
13
|
-
import {
|
|
12
|
+
import { zcapClientForSigner } from '../identity/agents.js';
|
|
14
13
|
import { ladderVmSeed } from './ladder.js';
|
|
14
|
+
/**
|
|
15
|
+
* The ladder VM's key pair as a signer under the DID it is presented as, the
|
|
16
|
+
* one derivation both entry points below share (`Ed25519VerificationKey`
|
|
17
|
+
* generated over `ladderVmSeed`), so the bare did:key bootstrap identity and
|
|
18
|
+
* the document-published ladder VM are one key. The controller is all the two
|
|
19
|
+
* differ in, and the verification-method id is `<controller>#<multibase>` in
|
|
20
|
+
* both shapes.
|
|
21
|
+
*
|
|
22
|
+
* @param options {object}
|
|
23
|
+
* @param options.ladderSeed {Uint8Array} the credential's ladder seed
|
|
24
|
+
* @param [options.accountDid] {string} the DID the key is presented under;
|
|
25
|
+
* omitted, the key stands under its own bare did:key
|
|
26
|
+
* @returns {Promise<object>} `{ publicKeyMultibase, controller, signer }`
|
|
27
|
+
*/
|
|
28
|
+
async function ladderVmSigner({ ladderSeed, accountDid }) {
|
|
29
|
+
const keyPair = await Ed25519VerificationKey.generate({
|
|
30
|
+
seed: ladderVmSeed({ ladderSeed })
|
|
31
|
+
});
|
|
32
|
+
const { publicKeyMultibase } = keyPair;
|
|
33
|
+
const controller = accountDid ?? `did:key:${publicKeyMultibase}`;
|
|
34
|
+
const id = `${controller}#${publicKeyMultibase}`;
|
|
35
|
+
// The key pair refuses to hand out a signer without an id; set the
|
|
36
|
+
// verification-method id before asking.
|
|
37
|
+
keyPair.id = id;
|
|
38
|
+
keyPair.controller = controller;
|
|
39
|
+
const keySigner = keyPair.signer();
|
|
40
|
+
return {
|
|
41
|
+
publicKeyMultibase,
|
|
42
|
+
controller,
|
|
43
|
+
signer: {
|
|
44
|
+
id,
|
|
45
|
+
type: 'Ed25519VerificationKey2020',
|
|
46
|
+
sign: keySigner.sign.bind(keySigner)
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
15
50
|
/**
|
|
16
51
|
* A ZcapClient signing with the account ladder's document-visible
|
|
17
52
|
* verification method -- the ladder VM, derived from the credential's ladder
|
|
@@ -40,24 +75,8 @@ import { ladderVmSeed } from './ladder.js';
|
|
|
40
75
|
* @returns {Promise<ZcapClient>}
|
|
41
76
|
*/
|
|
42
77
|
export async function ladderVmZcapClient({ accountDid, ladderSeed }) {
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
});
|
|
46
|
-
const { publicKeyMultibase } = keyPair;
|
|
47
|
-
// The key pair refuses to hand out a signer without an id; set the
|
|
48
|
-
// document's verification-method id before asking.
|
|
49
|
-
keyPair.id = `${accountDid}#${publicKeyMultibase}`;
|
|
50
|
-
const keySigner = keyPair.signer();
|
|
51
|
-
const signer = {
|
|
52
|
-
id: `${accountDid}#${publicKeyMultibase}`,
|
|
53
|
-
type: 'Ed25519VerificationKey2020',
|
|
54
|
-
sign: keySigner.sign.bind(keySigner)
|
|
55
|
-
};
|
|
56
|
-
return new ZcapClient({
|
|
57
|
-
SuiteClass: Ed25519Signature2020,
|
|
58
|
-
invocationSigner: signer,
|
|
59
|
-
delegationSigner: signer
|
|
60
|
-
});
|
|
78
|
+
const { signer } = await ladderVmSigner({ ladderSeed, accountDid });
|
|
79
|
+
return zcapClientForSigner({ signer });
|
|
61
80
|
}
|
|
62
81
|
/**
|
|
63
82
|
* The account ladder VM's key pair presented as a plain did:key agent -- the
|
|
@@ -78,21 +97,9 @@ export async function ladderVmZcapClient({ accountDid, ladderSeed }) {
|
|
|
78
97
|
* @returns {Promise<ICapabilityAgent>}
|
|
79
98
|
*/
|
|
80
99
|
export async function ladderVmAgent({ ladderSeed }) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
});
|
|
84
|
-
const { publicKeyMultibase } = keyPair;
|
|
85
|
-
const did = `did:key:${publicKeyMultibase}`;
|
|
86
|
-
// The key pair refuses to hand out a signer without an id; the did:key
|
|
87
|
-
// verification-method form is what the server's did:key resolver expects.
|
|
88
|
-
keyPair.id = `${did}#${publicKeyMultibase}`;
|
|
89
|
-
keyPair.controller = did;
|
|
90
|
-
const keySigner = keyPair.signer();
|
|
91
|
-
const signer = {
|
|
92
|
-
id: `${did}#${publicKeyMultibase}`,
|
|
93
|
-
type: 'Ed25519VerificationKey2020',
|
|
94
|
-
sign: keySigner.sign.bind(keySigner)
|
|
95
|
-
};
|
|
100
|
+
// No account DID: the key stands under its own bare did:key, the
|
|
101
|
+
// verification-method form the server's did:key resolver expects.
|
|
102
|
+
const { publicKeyMultibase, controller: did, signer } = await ladderVmSigner({ ladderSeed });
|
|
96
103
|
return {
|
|
97
104
|
id: did,
|
|
98
105
|
handle: 'ladder-vm',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zcap.js","sourceRoot":"","sources":["../../src/clientAnnex/zcap.ts"],"names":[],"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EAAE,UAAU,EAAE,UAAU,EAAE,CAAC,CAAA;IACnE,OAAO,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC,CAAA;AACxC,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,EAClC,UAAU,EAGX;IACC,iEAAiE;IACjE,kEAAkE;IAClE,MAAM,EACJ,kBAAkB,EAClB,UAAU,EAAE,GAAG,EACf,MAAM,EACP,GAAG,MAAM,cAAc,CAAC,EAAE,UAAU,EAAE,CAAC,CAAA;IACxC,OAAO;QACL,EAAE,EAAE,GAAG;QACP,MAAM,EAAE,WAAW;QACnB,SAAS,EAAE,GAAG,EAAE,CAAC,MAAM;QACvB,sBAAsB,EAAE,GAAG,EAAE,CAAC,CAAC;YAC7B,IAAI,EAAE,4BAA4B;YAClC,UAAU,EAAE,GAAG;YACf,kBAAkB;SACnB,CAAC;KACH,CAAA;AACH,CAAC"}
|
package/dist/clients/policy.d.ts
CHANGED
|
@@ -21,6 +21,15 @@
|
|
|
21
21
|
* different client's authority, so the row is disabled rather than guessed
|
|
22
22
|
* at.
|
|
23
23
|
*
|
|
24
|
+
* Two of the three are properties of the acting signer rather than of the
|
|
25
|
+
* account, so they lift on the ladder branch (`decisions/0017`). A standing
|
|
26
|
+
* credential's rung signs the removal entry, so it has no self to refuse, and
|
|
27
|
+
* removing the last client abandons no update authority: the account lands
|
|
28
|
+
* ladder-anchored, the shape a credential-anchored signup produces, and the
|
|
29
|
+
* credential's own ladder extends the log from there. The row's confirm copy
|
|
30
|
+
* states that transition. The unattributed-update-key refusal is a property
|
|
31
|
+
* of the log and stands on both branches.
|
|
32
|
+
*
|
|
24
33
|
* And one non-failure: a cascade whose collection fan-out left failures
|
|
25
34
|
* behind is a **resumable success**. The wallet IS disconnected -- the
|
|
26
35
|
* document edit landed first and is the pull axis everywhere -- and the
|
|
@@ -44,11 +53,16 @@ export type DisconnectRefusal = 'self' | 'last-client' | 'unattributed-update-ke
|
|
|
44
53
|
* @param options.client {AccountClientView} the row in question
|
|
45
54
|
* @param options.clients {AccountClientView[]} the whole listing (the
|
|
46
55
|
* last-client rule is a property of the account, not of the row)
|
|
56
|
+
* @param [options.signerKind] {string} who would sign the removal entry:
|
|
57
|
+
* `'client'` (the default, an enrolled client's update keys) or `'ladder'`
|
|
58
|
+
* (a standing credential's rung), which lifts the self and last-client
|
|
59
|
+
* refusals -- see the module doc
|
|
47
60
|
* @returns {{ allowed: boolean, refusal?: DisconnectRefusal }}
|
|
48
61
|
*/
|
|
49
|
-
export declare function disconnectEligibility({ client, clients }: {
|
|
62
|
+
export declare function disconnectEligibility({ client, clients, signerKind }: {
|
|
50
63
|
client: AccountClientView;
|
|
51
64
|
clients: AccountClientView[];
|
|
65
|
+
signerKind?: 'client' | 'ladder';
|
|
52
66
|
}): {
|
|
53
67
|
allowed: boolean;
|
|
54
68
|
refusal?: DisconnectRefusal;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../src/clients/policy.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../src/clients/policy.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAEvD;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAC3B,MAAM,GAAG,aAAa,GAAG,yBAAyB,CAAA;AAEpD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,MAAM,EACN,OAAO,EACP,UAAqB,EACtB,EAAE;IACD,MAAM,EAAE,iBAAiB,CAAA;IACzB,OAAO,EAAE,iBAAiB,EAAE,CAAA;IAC5B,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAA;CACjC,GAAG;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,iBAAiB,CAAA;CAAE,CAapD;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,MAAM,EACP,EAAE;IACD,MAAM,EAAE,iBAAiB,CAAA;CAC1B,GAAG,iBAAiB,CAWpB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,WAAW,EACX,UAAU,EACX,EAAE;IACD,WAAW,EAAE,oBAAoB,CAAA;IACjC,UAAU,CAAC,EAAE,gBAAgB,CAAA;CAC9B,GAAG,UAAU,GAAG,SAAS,CAIzB"}
|
package/dist/clients/policy.js
CHANGED
|
@@ -6,14 +6,20 @@
|
|
|
6
6
|
* @param options.client {AccountClientView} the row in question
|
|
7
7
|
* @param options.clients {AccountClientView[]} the whole listing (the
|
|
8
8
|
* last-client rule is a property of the account, not of the row)
|
|
9
|
+
* @param [options.signerKind] {string} who would sign the removal entry:
|
|
10
|
+
* `'client'` (the default, an enrolled client's update keys) or `'ladder'`
|
|
11
|
+
* (a standing credential's rung), which lifts the self and last-client
|
|
12
|
+
* refusals -- see the module doc
|
|
9
13
|
* @returns {{ allowed: boolean, refusal?: DisconnectRefusal }}
|
|
10
14
|
*/
|
|
11
|
-
export function disconnectEligibility({ client, clients }) {
|
|
12
|
-
if (client
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
export function disconnectEligibility({ client, clients, signerKind = 'client' }) {
|
|
16
|
+
if (signerKind === 'client') {
|
|
17
|
+
if (client.isCurrent) {
|
|
18
|
+
return { allowed: false, refusal: 'self' };
|
|
19
|
+
}
|
|
20
|
+
if (clients.length <= 1) {
|
|
21
|
+
return { allowed: false, refusal: 'last-client' };
|
|
22
|
+
}
|
|
17
23
|
}
|
|
18
24
|
if (!client.updateKeyMultibase) {
|
|
19
25
|
return { allowed: false, refusal: 'unattributed-update-key' };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policy.js","sourceRoot":"","sources":["../../src/clients/policy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"policy.js","sourceRoot":"","sources":["../../src/clients/policy.ts"],"names":[],"mappings":"AAkDA;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,qBAAqB,CAAC,EACpC,MAAM,EACN,OAAO,EACP,UAAU,GAAG,QAAQ,EAKtB;IACC,IAAI,UAAU,KAAK,QAAQ,EAAE,CAAC;QAC5B,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;YACrB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,CAAA;QAC5C,CAAC;QACD,IAAI,OAAO,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;YACxB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,CAAA;QACnD,CAAC;IACH,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,kBAAkB,EAAE,CAAC;QAC/B,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,yBAAyB,EAAE,CAAA;IAC/D,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAA;AAC1B,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,oBAAoB,CAAC,EACnC,MAAM,EAGP;IACC,IAAI,CAAC,MAAM,CAAC,kBAAkB,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CACb,oEAAoE;YAClE,8CAA8C,CACjD,CAAA;IACH,CAAC;IACD,OAAO;QACL,mBAAmB,EAAE,MAAM,CAAC,mBAAmB;QAC/C,kBAAkB,EAAE,MAAM,CAAC,kBAAkB;KAC9C,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,iBAAiB,CAAC,EAChC,WAAW,EACX,UAAU,EAIX;IACC,OAAO,WAAW,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,UAAU,EAAE,OAAO,KAAK,QAAQ;QACtE,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,UAAU,CAAA;AAChB,CAAC"}
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
* from the document the edit itself just resolved to (no re-fetch of the
|
|
21
21
|
* log this call just extended). On a log-governed roster store the
|
|
22
22
|
* orchestrator itself guarantees post-edit anchoring: the controller view
|
|
23
|
-
* built from the edit's own post-edit log is set as the store's
|
|
24
|
-
*
|
|
25
|
-
* rotation and the seal backstop anchor at or
|
|
26
|
-
* app's injected controller resolution still
|
|
27
|
-
* view. The roster delivers, never sources, so the
|
|
23
|
+
* built from the edit's own post-edit log is set as the store's minimum
|
|
24
|
+
* controller version (`setMinimumControllerVersion`) before anything
|
|
25
|
+
* roster-side runs, so the rotation and the seal backstop anchor at or
|
|
26
|
+
* past the edit even where the app's injected controller resolution still
|
|
27
|
+
* serves a cached pre-edit view. The roster delivers, never sources, so the
|
|
28
28
|
* stage names no client at all: it converges the roster onto that document
|
|
29
29
|
* (the login sweep's own path), retiring every current-epoch recipient the
|
|
30
30
|
* document no longer keys in one rotation. Nothing here has to pair a
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
import type { IKeyAgreementKey } from '@interop/data-integrity-core';
|
|
73
73
|
import type { CollectionEncryption } from '@interop/was-client';
|
|
74
74
|
import type { EncryptionDescriptorStore } from '@interop/was-client/edv';
|
|
75
|
-
import { type
|
|
75
|
+
import { type AccountLogSigner, type PublishedKeyDocument, type RevokedClientKeys, type WebvhIdStore } from '../webvh/index.js';
|
|
76
76
|
import { type CascadeCollections, type RosterSealReport, type UserKey, type UserKeyCascadeResult } from '../keys/index.js';
|
|
77
77
|
export type { CascadeCollections, RosterSealReport };
|
|
78
78
|
/**
|
|
@@ -125,11 +125,18 @@ export interface ClientRevocationResult {
|
|
|
125
125
|
*
|
|
126
126
|
* @param options {object}
|
|
127
127
|
* @param options.idStore {WebvhIdStore} the account's `id` collection store
|
|
128
|
-
* @param options.
|
|
129
|
-
* update-key seeds,
|
|
128
|
+
* @param options.signer {AccountLogSigner} who signs the document edit:
|
|
129
|
+
* THIS client's did:webvh update-key seeds, or the acting credential's
|
|
130
|
+
* ladder seed
|
|
130
131
|
* @param options.revokedClient {RevokedClientKeys} the revoked client's
|
|
131
132
|
* public halves (its two verification-method multibases and its active
|
|
132
133
|
* update key)
|
|
134
|
+
* @param [options.projectionStore] {object} an `id`-collection store the
|
|
135
|
+
* caller may write through, passed straight to the document edit: the
|
|
136
|
+
* post-removal `did:web` projection is PUT through it immediately before
|
|
137
|
+
* that entry publishes, so a ladder-signed disconnect does not leave
|
|
138
|
+
* `did.json` naming the revoked client. Best-effort, and omitted the
|
|
139
|
+
* behavior is unchanged (see `revokeWebvhClient`)
|
|
133
140
|
* @param [options.knownLatentHashes] {string[]} the standing recovery codes'
|
|
134
141
|
* update-key hashes, so the document edit can tell the revoked client's
|
|
135
142
|
* staged commitment apart from a latent recovery commitment (the one
|
|
@@ -164,9 +171,10 @@ export interface ClientRevocationResult {
|
|
|
164
171
|
* keeps operating without a re-login
|
|
165
172
|
* @returns {Promise<ClientRevocationResult>}
|
|
166
173
|
*/
|
|
167
|
-
export declare function revokeAccountClient({ idStore,
|
|
174
|
+
export declare function revokeAccountClient({ idStore, signer, projectionStore, revokedClient, knownLatentHashes, expectedDid, ownSigningKeyMultibase, rosterStore, userKey, clientKeyAgreementKey, pinnedEpochId, onUserKeyAdopted, collections, remintRecoveryDelegations, remintGenerationDelegation, onRotationAdopted }: {
|
|
168
175
|
idStore: WebvhIdStore;
|
|
169
|
-
|
|
176
|
+
signer: AccountLogSigner;
|
|
177
|
+
projectionStore?: Pick<WebvhIdStore, 'getIdResourceRaw' | 'putIdResource'>;
|
|
170
178
|
revokedClient: RevokedClientKeys;
|
|
171
179
|
knownLatentHashes?: string[];
|
|
172
180
|
expectedDid?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revocation.d.ts","sourceRoot":"","sources":["../../src/clients/revocation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAA;AACxE,OAAO,EAEL,KAAK,
|
|
1
|
+
{"version":3,"file":"revocation.d.ts","sourceRoot":"","sources":["../../src/clients/revocation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAA;AACxE,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAClB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,OAAO,EACZ,KAAK,oBAAoB,EAC1B,MAAM,kBAAkB,CAAA;AAEzB,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,CAAA;AAEpD;;;;;;;;GAQG;AACH,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,OAA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AG,IAAI,CAAA;IAC7B,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE;QAC3B,OAAO,EAAE,OAAO,CAAA;QAChB,aAAa,EAAE,MAAM,CAAA;QACrB,UAAU,EAAE,oBAAoB,CAAA;KACjC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACnB,WAAW,EAAE,kBAAkB,CAAA;IAC/B,yBAAyB,CAAC,EAAE,CAAC,OAAO,EAAE;QACpC,QAAQ,EAAE,oBAAoB,CAAA;KAC/B,KAAK,OAAO,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IACpD,0BAA0B,CAAC,EAAE,CAAC,OAAO,EAAE;QACrC,QAAQ,EAAE,oBAAoB,CAAA;KAC/B,KAAK,OAAO,CAAC,0BAA0B,CAAC,CAAA;IACzC,iBAAiB,CAAC,EAAE,CAAC,QAAQ,EAAE;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CACtE,GAAG,OAAO,CAAC,sBAAsB,CAAC,CA+ElC"}
|
|
@@ -17,11 +17,18 @@ import { rotateRosterToDocumentAndCascade } from '../keys/index.js';
|
|
|
17
17
|
*
|
|
18
18
|
* @param options {object}
|
|
19
19
|
* @param options.idStore {WebvhIdStore} the account's `id` collection store
|
|
20
|
-
* @param options.
|
|
21
|
-
* update-key seeds,
|
|
20
|
+
* @param options.signer {AccountLogSigner} who signs the document edit:
|
|
21
|
+
* THIS client's did:webvh update-key seeds, or the acting credential's
|
|
22
|
+
* ladder seed
|
|
22
23
|
* @param options.revokedClient {RevokedClientKeys} the revoked client's
|
|
23
24
|
* public halves (its two verification-method multibases and its active
|
|
24
25
|
* update key)
|
|
26
|
+
* @param [options.projectionStore] {object} an `id`-collection store the
|
|
27
|
+
* caller may write through, passed straight to the document edit: the
|
|
28
|
+
* post-removal `did:web` projection is PUT through it immediately before
|
|
29
|
+
* that entry publishes, so a ladder-signed disconnect does not leave
|
|
30
|
+
* `did.json` naming the revoked client. Best-effort, and omitted the
|
|
31
|
+
* behavior is unchanged (see `revokeWebvhClient`)
|
|
25
32
|
* @param [options.knownLatentHashes] {string[]} the standing recovery codes'
|
|
26
33
|
* update-key hashes, so the document edit can tell the revoked client's
|
|
27
34
|
* staged commitment apart from a latent recovery commitment (the one
|
|
@@ -56,7 +63,7 @@ import { rotateRosterToDocumentAndCascade } from '../keys/index.js';
|
|
|
56
63
|
* keeps operating without a re-login
|
|
57
64
|
* @returns {Promise<ClientRevocationResult>}
|
|
58
65
|
*/
|
|
59
|
-
export async function revokeAccountClient({ idStore,
|
|
66
|
+
export async function revokeAccountClient({ idStore, signer, projectionStore, revokedClient, knownLatentHashes, expectedDid, ownSigningKeyMultibase, rosterStore, userKey, clientKeyAgreementKey, pinnedEpochId, onUserKeyAdopted, collections, remintRecoveryDelegations, remintGenerationDelegation, onRotationAdopted }) {
|
|
60
67
|
if (ownSigningKeyMultibase &&
|
|
61
68
|
ownSigningKeyMultibase === revokedClient.signingKeyMultibase) {
|
|
62
69
|
throw new Error('This wallet cannot disconnect itself; use another enrolled wallet ' +
|
|
@@ -71,13 +78,14 @@ export async function revokeAccountClient({ idStore, updateKeys, revokedClient,
|
|
|
71
78
|
// recipients from.
|
|
72
79
|
const { did, doc, log } = await revokeWebvhClient({
|
|
73
80
|
idStore,
|
|
74
|
-
|
|
81
|
+
signer,
|
|
82
|
+
...(projectionStore ? { projectionStore } : {}),
|
|
75
83
|
revokedClient,
|
|
76
84
|
...(knownLatentHashes ? { knownLatentHashes } : {}),
|
|
77
85
|
...(expectedDid !== undefined ? { expectedDid } : {})
|
|
78
86
|
});
|
|
79
87
|
// 2-3. The shared roster-and-cascade tail: the roster rotation onto the
|
|
80
|
-
// post-edit document (with its post-edit controller
|
|
88
|
+
// post-edit document (with its post-edit minimum controller version and its seal
|
|
81
89
|
// backstop), then the collection fan-out onto the fresh key.
|
|
82
90
|
const tail = await rotateRosterToDocumentAndCascade({
|
|
83
91
|
rosterStore,
|