@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,18 +1,5 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* The house policy for standing recorded zcaps -- the long-lived delegations a
|
|
6
|
-
* wallet mints once and records beside a registry entry or inside a document
|
|
7
|
-
* (the recovery `did.jsonl` bridge, an unlock Space's management zcap, the
|
|
8
|
-
* client annex generation delegation): one shared lifetime, one renewal window,
|
|
9
|
-
* and the one staleness predicate every re-mint pass and login-time health
|
|
10
|
-
* check asks. A leaf file (no internal imports), so both the `webvh` and
|
|
11
|
-
* `recovery` layers can share it without a layering inversion; `recovery`
|
|
12
|
-
* re-exports the members that were born there, so its public surface is
|
|
13
|
-
* unchanged.
|
|
14
|
-
*/
|
|
15
1
|
import type { IZcap } from '@interop/data-integrity-core';
|
|
2
|
+
import type { PublishedKeyDocument } from './listClients.js';
|
|
16
3
|
/**
|
|
17
4
|
* The standing zcap lifetime: one year, following NIST SP 800-57's
|
|
18
5
|
* one-to-two-year cryptoperiod guidance for private signature keys. A
|
|
@@ -55,4 +42,64 @@ export declare function zcapExpiring({ expires, now }: {
|
|
|
55
42
|
* @returns {string | undefined}
|
|
56
43
|
*/
|
|
57
44
|
export declare function delegationProofKeyId(delegation: IZcap): string | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* The composed staleness rule for a standing recorded zcap, over the scalars
|
|
47
|
+
* a registry entry records: the delegation's proof key id and its expiry.
|
|
48
|
+
* Three axes, any one of which makes the grant stale:
|
|
49
|
+
*
|
|
50
|
+
* - EXPIRY -- past, inside the renewal window, or unrecorded
|
|
51
|
+
* ({@link zcapExpiring}).
|
|
52
|
+
* - SIGNER DEATH -- the proof's verification method is no longer under
|
|
53
|
+
* `capabilityDelegation` in the verified account document, the
|
|
54
|
+
* current-key-set rule (`delegationKeyInDocument`). Checked only when a
|
|
55
|
+
* `doc` is supplied; a caller holding no verified document is opting out
|
|
56
|
+
* of this axis rather than asserting the grant healthy.
|
|
57
|
+
* - RETIREMENT -- the caller names the key as retiring, so the grant is read
|
|
58
|
+
* against a PROJECTED post-edit document rather than the served one. The
|
|
59
|
+
* axis every ceremony needs that acts before the entry removing a key
|
|
60
|
+
* lands (the last-client transition's stages, whose document still lists
|
|
61
|
+
* the forgotten client), and the one that covers authority a client-side
|
|
62
|
+
* predicate cannot read at all -- a delegation about to be revoked
|
|
63
|
+
* server-side.
|
|
64
|
+
*
|
|
65
|
+
* @param options {object}
|
|
66
|
+
* @param [options.doc] {PublishedKeyDocument} the locally VERIFIED account
|
|
67
|
+
* document; omitted, the signer-death axis is skipped
|
|
68
|
+
* @param [options.delegationKeyId] {string} the recorded proof key id, in
|
|
69
|
+
* either DID form
|
|
70
|
+
* @param [options.expires] {string} the recorded ISO 8601 expiry
|
|
71
|
+
* @param [options.retiringKeyMultibases] {string[]} keys whose authority is
|
|
72
|
+
* about to end, as bare multibases or verification-method ids
|
|
73
|
+
* @param [options.now] {number} epoch milliseconds, for tests
|
|
74
|
+
* @returns {boolean}
|
|
75
|
+
*/
|
|
76
|
+
export declare function recordedZcapStale({ doc, delegationKeyId, expires, retiringKeyMultibases, now }: {
|
|
77
|
+
doc?: PublishedKeyDocument;
|
|
78
|
+
delegationKeyId?: string;
|
|
79
|
+
expires?: string;
|
|
80
|
+
retiringKeyMultibases?: string[];
|
|
81
|
+
now?: number;
|
|
82
|
+
}): boolean;
|
|
83
|
+
/**
|
|
84
|
+
* {@link recordedZcapStale} over a delegation in hand: the same three axes,
|
|
85
|
+
* reading the expiry and the proof key off the zcap itself. The shape every
|
|
86
|
+
* caller holding the delegation uses (the record's bridge and its
|
|
87
|
+
* `delegatedClients` sibling, the annex's embedded generation delegation), so
|
|
88
|
+
* the two shapes can never drift onto different rules.
|
|
89
|
+
*
|
|
90
|
+
* @param options {object}
|
|
91
|
+
* @param options.zcap {IZcap} the recorded delegation
|
|
92
|
+
* @param [options.doc] {PublishedKeyDocument} the locally VERIFIED account
|
|
93
|
+
* document; omitted, the signer-death axis is skipped
|
|
94
|
+
* @param [options.retiringKeyMultibases] {string[]} keys whose authority is
|
|
95
|
+
* about to end
|
|
96
|
+
* @param [options.now] {number} epoch milliseconds, for tests
|
|
97
|
+
* @returns {boolean}
|
|
98
|
+
*/
|
|
99
|
+
export declare function standingZcapStale({ zcap, doc, retiringKeyMultibases, now }: {
|
|
100
|
+
zcap: IZcap;
|
|
101
|
+
doc?: PublishedKeyDocument;
|
|
102
|
+
retiringKeyMultibases?: string[];
|
|
103
|
+
now?: number;
|
|
104
|
+
}): boolean;
|
|
58
105
|
//# sourceMappingURL=standingZcap.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standingZcap.d.ts","sourceRoot":"","sources":["../../src/webvh/standingZcap.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"standingZcap.d.ts","sourceRoot":"","sources":["../../src/webvh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|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The house policy for standing recorded zcaps -- the long-lived delegations a
|
|
6
|
+
* wallet mints once and records beside a registry entry or inside a document
|
|
7
|
+
* (the recovery `did.jsonl` bridge, an unlock Space's management zcap, the
|
|
8
|
+
* client annex generation delegation): one shared lifetime, one renewal window,
|
|
9
|
+
* and the one staleness predicate every re-mint pass and login-time health
|
|
10
|
+
* check asks. `recovery` re-exports the members that were born there, so its
|
|
11
|
+
* public surface is unchanged.
|
|
12
|
+
*/
|
|
13
|
+
import { vmFragmentOf } from '@interop/vh-resource-log';
|
|
14
|
+
import { delegationKeyInDocument } from './listClients.js';
|
|
1
15
|
/**
|
|
2
16
|
* The standing zcap lifetime: one year, following NIST SP 800-57's
|
|
3
17
|
* one-to-two-year cryptoperiod guidance for private signature keys. A
|
|
@@ -50,4 +64,81 @@ export function delegationProofKeyId(delegation) {
|
|
|
50
64
|
const single = Array.isArray(proof) ? proof[0] : proof;
|
|
51
65
|
return single?.verificationMethod;
|
|
52
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* The composed staleness rule for a standing recorded zcap, over the scalars
|
|
69
|
+
* a registry entry records: the delegation's proof key id and its expiry.
|
|
70
|
+
* Three axes, any one of which makes the grant stale:
|
|
71
|
+
*
|
|
72
|
+
* - EXPIRY -- past, inside the renewal window, or unrecorded
|
|
73
|
+
* ({@link zcapExpiring}).
|
|
74
|
+
* - SIGNER DEATH -- the proof's verification method is no longer under
|
|
75
|
+
* `capabilityDelegation` in the verified account document, the
|
|
76
|
+
* current-key-set rule (`delegationKeyInDocument`). Checked only when a
|
|
77
|
+
* `doc` is supplied; a caller holding no verified document is opting out
|
|
78
|
+
* of this axis rather than asserting the grant healthy.
|
|
79
|
+
* - RETIREMENT -- the caller names the key as retiring, so the grant is read
|
|
80
|
+
* against a PROJECTED post-edit document rather than the served one. The
|
|
81
|
+
* axis every ceremony needs that acts before the entry removing a key
|
|
82
|
+
* lands (the last-client transition's stages, whose document still lists
|
|
83
|
+
* the forgotten client), and the one that covers authority a client-side
|
|
84
|
+
* predicate cannot read at all -- a delegation about to be revoked
|
|
85
|
+
* server-side.
|
|
86
|
+
*
|
|
87
|
+
* @param options {object}
|
|
88
|
+
* @param [options.doc] {PublishedKeyDocument} the locally VERIFIED account
|
|
89
|
+
* document; omitted, the signer-death axis is skipped
|
|
90
|
+
* @param [options.delegationKeyId] {string} the recorded proof key id, in
|
|
91
|
+
* either DID form
|
|
92
|
+
* @param [options.expires] {string} the recorded ISO 8601 expiry
|
|
93
|
+
* @param [options.retiringKeyMultibases] {string[]} keys whose authority is
|
|
94
|
+
* about to end, as bare multibases or verification-method ids
|
|
95
|
+
* @param [options.now] {number} epoch milliseconds, for tests
|
|
96
|
+
* @returns {boolean}
|
|
97
|
+
*/
|
|
98
|
+
export function recordedZcapStale({ doc, delegationKeyId, expires, retiringKeyMultibases = [], now = Date.now() }) {
|
|
99
|
+
if (zcapExpiring({ ...(expires !== undefined ? { expires } : {}), now })) {
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
const multibase = delegationKeyId === undefined
|
|
103
|
+
? undefined
|
|
104
|
+
: (vmFragmentOf(delegationKeyId) ?? delegationKeyId);
|
|
105
|
+
// Retiring keys arrive as bare multibases or as verification-method ids;
|
|
106
|
+
// either way the comparison is on the multibase.
|
|
107
|
+
const retiring = retiringKeyMultibases.some(key => multibase !== undefined && (vmFragmentOf(key) ?? key) === multibase);
|
|
108
|
+
if (retiring) {
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
return (doc !== undefined &&
|
|
112
|
+
!delegationKeyInDocument({
|
|
113
|
+
doc,
|
|
114
|
+
...(delegationKeyId !== undefined ? { delegationKeyId } : {})
|
|
115
|
+
}));
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* {@link recordedZcapStale} over a delegation in hand: the same three axes,
|
|
119
|
+
* reading the expiry and the proof key off the zcap itself. The shape every
|
|
120
|
+
* caller holding the delegation uses (the record's bridge and its
|
|
121
|
+
* `delegatedClients` sibling, the annex's embedded generation delegation), so
|
|
122
|
+
* the two shapes can never drift onto different rules.
|
|
123
|
+
*
|
|
124
|
+
* @param options {object}
|
|
125
|
+
* @param options.zcap {IZcap} the recorded delegation
|
|
126
|
+
* @param [options.doc] {PublishedKeyDocument} the locally VERIFIED account
|
|
127
|
+
* document; omitted, the signer-death axis is skipped
|
|
128
|
+
* @param [options.retiringKeyMultibases] {string[]} keys whose authority is
|
|
129
|
+
* about to end
|
|
130
|
+
* @param [options.now] {number} epoch milliseconds, for tests
|
|
131
|
+
* @returns {boolean}
|
|
132
|
+
*/
|
|
133
|
+
export function standingZcapStale({ zcap, doc, retiringKeyMultibases, now }) {
|
|
134
|
+
const { expires } = zcap;
|
|
135
|
+
const delegationKeyId = delegationProofKeyId(zcap);
|
|
136
|
+
return recordedZcapStale({
|
|
137
|
+
...(doc !== undefined ? { doc } : {}),
|
|
138
|
+
...(delegationKeyId !== undefined ? { delegationKeyId } : {}),
|
|
139
|
+
...(expires !== undefined ? { expires } : {}),
|
|
140
|
+
...(retiringKeyMultibases !== undefined ? { retiringKeyMultibases } : {}),
|
|
141
|
+
...(now !== undefined ? { now } : {})
|
|
142
|
+
});
|
|
143
|
+
}
|
|
53
144
|
//# sourceMappingURL=standingZcap.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standingZcap.js","sourceRoot":"","sources":["../../src/webvh/standingZcap.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"standingZcap.js","sourceRoot":"","sources":["../../src/webvh/standingZcap.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;GAQG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAG1D;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,o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K,SAAS,CAAC,CAAC,CAAC,EAAE,qBAAqB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACzE,GAAG,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACtC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { DIDDoc, DIDLog } from '@interop/did-method-webvh';
|
|
2
|
+
import type { PublishedWebvhLog } from './didWebvh.js';
|
|
2
3
|
import { type ResourceLogHeadPin, type ResourceLogPinStore } from '@interop/vh-resource-log';
|
|
3
4
|
/**
|
|
4
5
|
* The pin-slot key for an account's did:webvh log (`id/did.jsonl`) -- what a
|
|
@@ -45,6 +46,27 @@ export declare function checkAccountLogContinuity({ log, pin }: {
|
|
|
45
46
|
log: DIDLog;
|
|
46
47
|
pin: ResourceLogHeadPin | null;
|
|
47
48
|
}): ResourceLogHeadPin;
|
|
49
|
+
/**
|
|
50
|
+
* Checks a served account log against the pin held for it and advances the
|
|
51
|
+
* pin to the served head, which the check has just proven is genuinely ahead.
|
|
52
|
+
*
|
|
53
|
+
* The one implementation of the account log's check-and-advance step, shared
|
|
54
|
+
* by {@link verifyAccountLog} and by the ceremony-side reads in `didWebvh.ts`:
|
|
55
|
+
* a rollback, a fork, or an SCID / method switch refuses inside
|
|
56
|
+
* {@link checkAccountLogContinuity}, so nothing that is not ahead ever
|
|
57
|
+
* reaches the write.
|
|
58
|
+
*
|
|
59
|
+
* @param options {object}
|
|
60
|
+
* @param options.pinStore {ResourceLogPinStore}
|
|
61
|
+
* @param options.logId {string} this log's slot in the store
|
|
62
|
+
* @param options.log {DIDLog} the served, already-resolved log
|
|
63
|
+
* @returns {Promise<void>}
|
|
64
|
+
*/
|
|
65
|
+
export declare function checkAndAdvanceAccountLogPin({ pinStore, logId, log }: {
|
|
66
|
+
pinStore: ResourceLogPinStore;
|
|
67
|
+
logId: string;
|
|
68
|
+
log: DIDLog;
|
|
69
|
+
}): Promise<void>;
|
|
48
70
|
/**
|
|
49
71
|
* Fetches and locally verifies the account's world-readable DID log.
|
|
50
72
|
*
|
|
@@ -73,18 +95,50 @@ export declare function checkAccountLogContinuity({ log, pin }: {
|
|
|
73
95
|
* @param [options.pinStore] {ResourceLogPinStore} this client's chain-head
|
|
74
96
|
* pins; the account log's slot is keyed by {@link accountLogPinId} over the
|
|
75
97
|
* `spaceId` above
|
|
76
|
-
* @
|
|
77
|
-
*
|
|
98
|
+
* @param [options.published] {PublishedWebvhLog} a head this same run
|
|
99
|
+
* already read and resolved (an establishment handing its `accountLog`
|
|
100
|
+
* forward), reused in place of the fetch. Every check below still runs on
|
|
101
|
+
* it: the substituted-account refusal, and the chain-head check-and-advance
|
|
102
|
+
* under the same slot, so a supplied head behind the pin is refused with a
|
|
103
|
+
* {@link ResourceLogContinuityError} exactly as a served one would be.
|
|
104
|
+
* Reuse is only ever WITHIN one run or visit, never across writers: the
|
|
105
|
+
* head is evidence of what this client itself just saw or published, and a
|
|
106
|
+
* head carried in from anywhere else would defeat the freshness the fetch
|
|
107
|
+
* exists for
|
|
108
|
+
* @returns {Promise<VerifiedAccountLog>} the resolved document, the raw
|
|
109
|
+
* log, and the log's effective `updateKeys` / `nextKeyHashes`
|
|
78
110
|
*/
|
|
79
|
-
export declare function verifyAccountLog({ did, spaceId, host, pinStore }: {
|
|
111
|
+
export declare function verifyAccountLog({ did, spaceId, host, pinStore, published }: {
|
|
80
112
|
did: string;
|
|
81
113
|
spaceId: string;
|
|
82
114
|
host: string;
|
|
83
115
|
pinStore?: ResourceLogPinStore;
|
|
84
|
-
|
|
116
|
+
published?: PublishedWebvhLog;
|
|
117
|
+
}): Promise<VerifiedAccountLog>;
|
|
118
|
+
/**
|
|
119
|
+
* What {@link verifyAccountLog} returns: the account document as the log
|
|
120
|
+
* resolves it, the raw log, and the log's effective update-key parameters.
|
|
121
|
+
* Named because it is also what a caller seeds a session-scoped verified-log
|
|
122
|
+
* memo with, from a head a ceremony handed it.
|
|
123
|
+
*/
|
|
124
|
+
export interface VerifiedAccountLog {
|
|
85
125
|
doc: DIDDoc;
|
|
86
126
|
log: DIDLog;
|
|
87
127
|
updateKeys: string[];
|
|
88
128
|
nextKeyHashes: string[];
|
|
89
|
-
}
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* The {@link VerifiedAccountLog} view of a head a ceremony already read or
|
|
132
|
+
* published -- a projection, not a check. The caller that seeds a memo from
|
|
133
|
+
* an establishment's own `accountLog` uses it rather than re-fetching the log
|
|
134
|
+
* that run just wrote; a caller wanting the DID and pin checks too calls
|
|
135
|
+
* {@link verifyAccountLog} with the head instead.
|
|
136
|
+
*
|
|
137
|
+
* @param options {object}
|
|
138
|
+
* @param options.published {PublishedWebvhLog} the resolved head
|
|
139
|
+
* @returns {VerifiedAccountLog}
|
|
140
|
+
*/
|
|
141
|
+
export declare function verifiedAccountLogOf({ published }: {
|
|
142
|
+
published: PublishedWebvhLog;
|
|
143
|
+
}): VerifiedAccountLog;
|
|
90
144
|
//# sourceMappingURL=verifyLog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verifyLog.d.ts","sourceRoot":"","sources":["../../src/webvh/verifyLog.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"verifyLog.d.ts","sourceRoot":"","sources":["../../src/webvh/verifyLog.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAE/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAEtD,OAAO,EAGL,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACzB,MAAM,0BAA0B,CAAA;AAEjC;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,EAAE,OAAO,EAAE,EA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AG,kBAAkB,CAOrB"}
|
package/dist/webvh/verifyLog.js
CHANGED
|
@@ -123,6 +123,31 @@ export function checkAccountLogContinuity({ log, pin }) {
|
|
|
123
123
|
}
|
|
124
124
|
return { method, scid, head: head.versionId };
|
|
125
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* Checks a served account log against the pin held for it and advances the
|
|
128
|
+
* pin to the served head, which the check has just proven is genuinely ahead.
|
|
129
|
+
*
|
|
130
|
+
* The one implementation of the account log's check-and-advance step, shared
|
|
131
|
+
* by {@link verifyAccountLog} and by the ceremony-side reads in `didWebvh.ts`:
|
|
132
|
+
* a rollback, a fork, or an SCID / method switch refuses inside
|
|
133
|
+
* {@link checkAccountLogContinuity}, so nothing that is not ahead ever
|
|
134
|
+
* reaches the write.
|
|
135
|
+
*
|
|
136
|
+
* @param options {object}
|
|
137
|
+
* @param options.pinStore {ResourceLogPinStore}
|
|
138
|
+
* @param options.logId {string} this log's slot in the store
|
|
139
|
+
* @param options.log {DIDLog} the served, already-resolved log
|
|
140
|
+
* @returns {Promise<void>}
|
|
141
|
+
*/
|
|
142
|
+
export async function checkAndAdvanceAccountLogPin({ pinStore, logId, log }) {
|
|
143
|
+
const pin = await pinStore.read({ logId });
|
|
144
|
+
const served = checkAccountLogContinuity({ log, pin });
|
|
145
|
+
// Advanced only when the served head is genuinely ahead of the pin: the
|
|
146
|
+
// continuity check has already refused everything that is not.
|
|
147
|
+
if (!pin || pin.head !== served.head) {
|
|
148
|
+
await pinStore.write({ logId, pin: served });
|
|
149
|
+
}
|
|
150
|
+
}
|
|
126
151
|
/**
|
|
127
152
|
* Fetches and locally verifies the account's world-readable DID log.
|
|
128
153
|
*
|
|
@@ -151,10 +176,34 @@ export function checkAccountLogContinuity({ log, pin }) {
|
|
|
151
176
|
* @param [options.pinStore] {ResourceLogPinStore} this client's chain-head
|
|
152
177
|
* pins; the account log's slot is keyed by {@link accountLogPinId} over the
|
|
153
178
|
* `spaceId` above
|
|
154
|
-
* @
|
|
155
|
-
*
|
|
179
|
+
* @param [options.published] {PublishedWebvhLog} a head this same run
|
|
180
|
+
* already read and resolved (an establishment handing its `accountLog`
|
|
181
|
+
* forward), reused in place of the fetch. Every check below still runs on
|
|
182
|
+
* it: the substituted-account refusal, and the chain-head check-and-advance
|
|
183
|
+
* under the same slot, so a supplied head behind the pin is refused with a
|
|
184
|
+
* {@link ResourceLogContinuityError} exactly as a served one would be.
|
|
185
|
+
* Reuse is only ever WITHIN one run or visit, never across writers: the
|
|
186
|
+
* head is evidence of what this client itself just saw or published, and a
|
|
187
|
+
* head carried in from anywhere else would defeat the freshness the fetch
|
|
188
|
+
* exists for
|
|
189
|
+
* @returns {Promise<VerifiedAccountLog>} the resolved document, the raw
|
|
190
|
+
* log, and the log's effective `updateKeys` / `nextKeyHashes`
|
|
156
191
|
*/
|
|
157
|
-
export async function verifyAccountLog({ did, spaceId, host, pinStore }) {
|
|
192
|
+
export async function verifyAccountLog({ did, spaceId, host, pinStore, published }) {
|
|
193
|
+
if (published !== undefined) {
|
|
194
|
+
if (published.did !== did) {
|
|
195
|
+
throw new Error('The published DID log resolves to a different DID than the account ' +
|
|
196
|
+
'pointer names.');
|
|
197
|
+
}
|
|
198
|
+
if (pinStore) {
|
|
199
|
+
await checkAndAdvanceAccountLogPin({
|
|
200
|
+
pinStore,
|
|
201
|
+
logId: accountLogPinId({ spaceId }),
|
|
202
|
+
log: published.log
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
return verifiedAccountLogOf({ published });
|
|
206
|
+
}
|
|
158
207
|
const url = toUrl({
|
|
159
208
|
serverUrl: host,
|
|
160
209
|
path: resourcePath(spaceId, ID_COLLECTION.id, DID_LOG_RESOURCE)
|
|
@@ -176,14 +225,11 @@ export async function verifyAccountLog({ did, spaceId, host, pinStore }) {
|
|
|
176
225
|
'pointer names.');
|
|
177
226
|
}
|
|
178
227
|
if (pinStore) {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
if (!pin || pin.head !== served.head) {
|
|
185
|
-
await pinStore.write({ logId, pin: served });
|
|
186
|
-
}
|
|
228
|
+
await checkAndAdvanceAccountLogPin({
|
|
229
|
+
pinStore,
|
|
230
|
+
logId: accountLogPinId({ spaceId }),
|
|
231
|
+
log
|
|
232
|
+
});
|
|
187
233
|
}
|
|
188
234
|
return {
|
|
189
235
|
doc: resolved.doc,
|
|
@@ -192,4 +238,23 @@ export async function verifyAccountLog({ did, spaceId, host, pinStore }) {
|
|
|
192
238
|
nextKeyHashes: resolved.meta.nextKeyHashes ?? []
|
|
193
239
|
};
|
|
194
240
|
}
|
|
241
|
+
/**
|
|
242
|
+
* The {@link VerifiedAccountLog} view of a head a ceremony already read or
|
|
243
|
+
* published -- a projection, not a check. The caller that seeds a memo from
|
|
244
|
+
* an establishment's own `accountLog` uses it rather than re-fetching the log
|
|
245
|
+
* that run just wrote; a caller wanting the DID and pin checks too calls
|
|
246
|
+
* {@link verifyAccountLog} with the head instead.
|
|
247
|
+
*
|
|
248
|
+
* @param options {object}
|
|
249
|
+
* @param options.published {PublishedWebvhLog} the resolved head
|
|
250
|
+
* @returns {VerifiedAccountLog}
|
|
251
|
+
*/
|
|
252
|
+
export function verifiedAccountLogOf({ published }) {
|
|
253
|
+
return {
|
|
254
|
+
doc: published.doc,
|
|
255
|
+
log: published.log,
|
|
256
|
+
updateKeys: published.updateKeys,
|
|
257
|
+
nextKeyHashes: published.nextKeyHashes
|
|
258
|
+
};
|
|
259
|
+
}
|
|
195
260
|
//# sourceMappingURL=verifyLog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verifyLog.js","sourceRoot":"","sources":["../../src/webvh/verifyLog.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAEhF,OAAO,EAAE,YAAY,EAAE,KA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AAQ,CAAC,IAAI,CAAC,aAAa,IAAI,EAAE;KACjD,CAAA;AACH,CAAC;AAeD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,oBAAoB,CAAC,EACnC,SAAS,EAGV;IACC,OAAO;QACL,GAAG,EAAE,SAAS,CAAC,GAAG;QAClB,GAAG,EAAE,SAAS,CAAC,GAAG;QAClB,UAAU,EAAE,SAAS,CAAC,UAAU;QAChC,aAAa,EAAE,SAAS,CAAC,aAAa;KACvC,CAAA;AACH,CAAC"}
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
* a `gen-` collection in the auxiliary annex Space -- is served by the
|
|
11
11
|
* same implementation without touching the account-log paths.
|
|
12
12
|
*
|
|
13
|
-
* Collections here are addressed
|
|
14
|
-
* (world-readable by policy), an annex generation's
|
|
15
|
-
* its `did.jsonl` (capability-gated, but never
|
|
16
|
-
* resolves it out of its own storage), and `key-map`
|
|
17
|
-
* none of them goes through the encryption codec.
|
|
13
|
+
* Collections here are addressed through {@link plaintextCollection}: `id`
|
|
14
|
+
* holds published documents (world-readable by policy), an annex generation's
|
|
15
|
+
* collection holds only its `did.jsonl` (capability-gated, but never
|
|
16
|
+
* encrypted -- the server resolves it out of its own storage), and `key-map`
|
|
17
|
+
* holds plain JSON, so none of them goes through the encryption codec.
|
|
18
18
|
*
|
|
19
19
|
* Bodies are written as raw bytes under the content type the caller states --
|
|
20
20
|
* load-bearing, since the log is JSON Lines (`text/jsonl`), not JSON, and the
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
*
|
|
23
23
|
* Reads carry the resource's ETag and writes forward the ceremonies'
|
|
24
24
|
* conditional-write preconditions, so a did:webvh ceremony's `did.jsonl`
|
|
25
|
-
* publish
|
|
26
|
-
* `conditional-writes` serves no ETag, and the
|
|
27
|
-
* unconditional
|
|
25
|
+
* publish and the pair of `keys.json` writes are compare-and-swaps. A backend
|
|
26
|
+
* that does not advertise `conditional-writes` serves no ETag, and the writes
|
|
27
|
+
* degrade to unconditional.
|
|
28
28
|
*/
|
|
29
29
|
import type { IZcap } from '@interop/data-integrity-core';
|
|
30
30
|
import type { WasClient } from '@interop/was-client';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wasIdStore.d.ts","sourceRoot":"","sources":["../../src/webvh/wasIdStore.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"wasIdStore.d.ts","sourceRoot":"","sources":["../../src/webvh/wasIdStore.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAOpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEjD;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG,IAAI,CACtC,YAAY,EACZ,kBAAkB,GAAG,eAAe,GAAG,eAAe,CACvD,CAAA;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,GAAG,EACH,OAAO,EACP,YAAY,EACZ,UAAU,EACX,EAAE;IACD,GAAG,EAAE,SAAS,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,KAAK,CAAA;CACnB,GAAG,qBAAqB,CAiDxB;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,EAC9B,GAAG,EACH,OAAO,EACR,EAAE;IACD,GAAG,EAAE,SAAS,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;CAChB,GAAG,YAAY,CAsCf"}
|
package/dist/webvh/wasIdStore.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DID_KEYS_RESOURCE, ID_COLLECTION, KEY_MAP_COLLECTION } from '../space/collections.js';
|
|
2
|
+
import { plaintextCollection } from '../space/plaintextCollection.js';
|
|
2
3
|
/**
|
|
3
4
|
* Builds the parameterized log-resource store over one collection of one
|
|
4
5
|
* Space: the shared implementation behind {@link wasWebvhIdStore} (the
|
|
@@ -18,10 +19,7 @@ import { DID_KEYS_RESOURCE, ID_COLLECTION, KEY_MAP_COLLECTION } from '../space/c
|
|
|
18
19
|
* @returns {WebvhLogResourceStore}
|
|
19
20
|
*/
|
|
20
21
|
export function wasWebvhLogStore({ was, spaceId, collectionId, capability }) {
|
|
21
|
-
const resource = (resourceId) => was
|
|
22
|
-
.space(spaceId, capability !== undefined ? { capability } : {})
|
|
23
|
-
.collection(collectionId, { encryption: 'plaintext' })
|
|
24
|
-
.resource(resourceId);
|
|
22
|
+
const resource = (resourceId) => plaintextCollection({ was, spaceId, collectionId, capability }).resource(resourceId);
|
|
25
23
|
return {
|
|
26
24
|
getIdResourceRaw: async ({ resourceId }) => {
|
|
27
25
|
const read = await resource(resourceId).getWithEtag();
|
|
@@ -46,8 +44,11 @@ export function wasWebvhLogStore({ was, spaceId, collectionId, capability }) {
|
|
|
46
44
|
putIdResource: async ({ resourceId, content, contentType = 'application/json', ifMatch, ifNoneMatch }) => {
|
|
47
45
|
const serialized = typeof content === 'string' ? content : JSON.stringify(content);
|
|
48
46
|
// was-client's own PreconditionFailedError propagates as-is: its `name`
|
|
49
|
-
// is exactly what the seam contract names.
|
|
50
|
-
|
|
47
|
+
// is exactly what the seam contract names. The PUT's own response
|
|
48
|
+
// carries the stored resource's new validator, so it is handed back
|
|
49
|
+
// rather than dropped: a ceremony that publishes can then build its
|
|
50
|
+
// next entry on the head it just wrote.
|
|
51
|
+
return resource(resourceId).put(new TextEncoder().encode(serialized), {
|
|
51
52
|
contentType,
|
|
52
53
|
ifMatch,
|
|
53
54
|
ifNoneMatch
|
|
@@ -68,15 +69,39 @@ export function wasWebvhLogStore({ was, spaceId, collectionId, capability }) {
|
|
|
68
69
|
export function wasWebvhIdStore({ was, spaceId }) {
|
|
69
70
|
return {
|
|
70
71
|
...wasWebvhLogStore({ was, spaceId, collectionId: ID_COLLECTION.id }),
|
|
71
|
-
|
|
72
|
-
await
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
getKeyMapRaw: async () => {
|
|
73
|
+
const read = await plaintextCollection({
|
|
74
|
+
was,
|
|
75
|
+
spaceId,
|
|
76
|
+
collectionId: KEY_MAP_COLLECTION.id
|
|
77
|
+
})
|
|
75
78
|
.resource(DID_KEYS_RESOURCE)
|
|
76
|
-
.
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
.getWithEtag();
|
|
80
|
+
return read === null
|
|
81
|
+
? undefined
|
|
82
|
+
: {
|
|
83
|
+
content: read.data,
|
|
84
|
+
...(read.etag !== undefined && { etag: read.etag })
|
|
85
|
+
};
|
|
86
|
+
},
|
|
87
|
+
// The caller states the precondition per write, since the two writes of
|
|
88
|
+
// one signup carry different ones: create-if-absent for the KMS stage's
|
|
89
|
+
// own write, and an If-Match on that write's ETag for the genesis'
|
|
90
|
+
// rewrite. A precondition fixed here would refuse the rewrite on every
|
|
91
|
+
// signup and strand a map with no `webvh` block. The PUT's own response
|
|
92
|
+
// carries the stored resource's new validator, so it is handed back
|
|
93
|
+
// rather than dropped.
|
|
94
|
+
putKeyMap: async ({ content, ifMatch, ifNoneMatch }) => plaintextCollection({
|
|
95
|
+
was,
|
|
96
|
+
spaceId,
|
|
97
|
+
collectionId: KEY_MAP_COLLECTION.id
|
|
98
|
+
})
|
|
99
|
+
.resource(DID_KEYS_RESOURCE)
|
|
100
|
+
.put(new TextEncoder().encode(JSON.stringify(content)), {
|
|
101
|
+
contentType: 'application/json',
|
|
102
|
+
ifMatch,
|
|
103
|
+
ifNoneMatch
|
|
104
|
+
})
|
|
80
105
|
};
|
|
81
106
|
}
|
|
82
107
|
//# sourceMappingURL=wasIdStore.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wasIdStore.js","sourceRoot":"","sources":["../../src/webvh/wasIdStore.ts"],"names":[],"mappings":"AA8BA,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EACnB,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"wasIdStore.js","sourceRoot":"","sources":["../../src/webvh/wasIdStore.ts"],"names":[],"mappings":"AA8BA,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EACnB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAA;AAarE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAC/B,GAAG,EACH,OAAO,EACP,YAAY,EACZ,UAAU,EAMX;IACC,MAAM,QAAQ,GAAG,CAAC,UAAkB,EAAE,EAAE,CACtC,mBAAmB,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC,CAAC,QAAQ,CACtE,UAAU,CACX,CAAA;IAEH,OAAO;QACL,gBAAgB,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;YACzC,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,UAAU,CAAC,CAAC,WAAW,EAAE,CAAA;YACrD,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;gBAClB,OAAO,SAAS,CAAA;YAClB,CAAC;YACD,wEAAwE;YACxE,uEAAuE;YACvE,6DAA6D;YAC7D,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,CAAA;YAC3B,MAAM,IAAI,GACR,IAAI,YAAY,IAAI;gBAClB,CAAC,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE;gBACnB,CAAC,CAAC,OAAO,IAAI,KAAK,QAAQ;oBACxB,CAA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C;iBACC,QAAQ,CAAC,iBAAiB,CAAC;iBAC3B,WAAW,EAAE,CAAA;YAChB,OAAO,IAAI,KAAK,IAAI;gBAClB,CAAC,CAAC,SAAS;gBACX,CAAC,CAAC;oBACE,OAAO,EAAE,IAAI,CAAC,IAAI;oBAClB,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;iBACpD,CAAA;QACP,CAAC;QACD,wEAAwE;QACxE,wEAAwE;QACxE,mEAAmE;QACnE,uEAAuE;QACvE,wEAAwE;QACxE,oEAAoE;QACpE,uBAAuB;QACvB,SAAS,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,CACrD,mBAAmB,CAAC;YAClB,GAAG;YACH,OAAO;YACP,YAAY,EAAE,kBAAkB,CAAC,EAAE;SACpC,CAAC;aACC,QAAQ,CAAC,iBAAiB,CAAC;aAC3B,GAAG,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE;YACtD,WAAW,EAAE,kBAAkB;YAC/B,OAAO;YACP,WAAW;SACZ,CAAC;KACP,CAAA;AACH,CAAC"}
|
package/dist/webvh/zcap.d.ts
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* ZCap signing under the account's did:webvh identity. After controller
|
|
6
|
+
* promotion the data Space's controller is the did:webvh DID, whose document
|
|
7
|
+
* carries a verification method per enrolled client -- so invocations and
|
|
8
|
+
* delegations must be signed with a keyId of the form
|
|
9
|
+
* `<did:webvh>#<publicKeyMultibase>` (this client's Ed25519 key, published
|
|
10
|
+
* under `capabilityInvocation` / `capabilityDelegation`). The key material
|
|
11
|
+
* is unchanged -- the client's own Ed25519 pair -- only the keyId names the
|
|
12
|
+
* verification method in the did:webvh document instead of the did:key one.
|
|
13
|
+
*/
|
|
14
|
+
import type { ZcapClient } from '@interop/ezcap';
|
|
2
15
|
import type { ISigner } from '@interop/data-integrity-core';
|
|
3
16
|
/**
|
|
4
17
|
* The minimal shape of a signing key agent this module operates on -- what
|
package/dist/webvh/zcap.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zcap.d.ts","sourceRoot":"","sources":["../../src/webvh/zcap.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"zcap.d.ts","sourceRoot":"","sources":["../../src/webvh/zcap.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAG3D;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,OAAO,CAAA;IACxB,sBAAsB,EAAE,MAAM;QAC5B,IAAI,EAAE,MAAM,CAAA;QACZ,UAAU,EAAE,MAAM,CAAA;QAClB,kBAAkB,EAAE,MAAM,CAAA;QAC1B,mBAAmB,CAAC,EAAE,MAAM,CAAA;KAC7B,CAAA;CACF;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,EACxC,QAAQ,EACT,EAAE;IACD,QAAQ,EAAE,gBAAgB,CAAA;CAC3B,GAAG,MAAM,CAMT;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,GAAG,EACJ,EAAE;IACD,QAAQ,EAAE,gBAAgB,CAAA;IAC1B,GAAG,EAAE,MAAM,CAAA;CACZ;;;oBAGmB;QAAE,IAAI,EAAE,UAAU,CAAA;KAAE,KAAK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