@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
|
@@ -5,17 +5,18 @@
|
|
|
5
5
|
* The transient-recovery continuation -- the ladder-anchored variant of the
|
|
6
6
|
* recovery subpath's `recoverWebvhClient`, split out beside the rest of the
|
|
7
7
|
* annex-anchored ceremonies: a code spent on a non-remembered browser mints
|
|
8
|
-
* no enrolled client,
|
|
9
|
-
*
|
|
8
|
+
* no enrolled client, and the ladder VM the fresh credential's own bind
|
|
9
|
+
* publishes is what anchors the account, so it lands client-less and
|
|
10
|
+
* ladder-anchored. The enrolled-client
|
|
10
11
|
* continuation and the recovery-key inventory edits stay in
|
|
11
12
|
* `recovery/recoveryWebvh.ts`.
|
|
12
13
|
*/
|
|
13
14
|
import { deriveNextKeyHash, updateDID } from '@interop/did-method-webvh';
|
|
14
|
-
import { assertCarryOverCommitments, ladderVerificationMethod, MULTIKEY_VM_TYPE,
|
|
15
|
-
import { ladderVmIds } from '../
|
|
15
|
+
import { assertCarryOverCommitments, ladderVerificationMethod, MULTIKEY_VM_TYPE, publishEntryPinned, readPublishedLogOrThrow, updateKeySigner, withLogConflictRetry } from '../webvh/didWebvh.js';
|
|
16
|
+
import { credentialKeyAgreementMethods, ladderVmIds, relationIds } from '../resourceLog/document.js';
|
|
16
17
|
import { unlockKeyVerificationMethod, unlockKeyVmId } from '../unlock/standingWebvh.js';
|
|
17
|
-
import {
|
|
18
|
-
import { ladderRung, ladderVmKeyMultibase } from './ladder.js';
|
|
18
|
+
import { RecoveryKeyNotCommittedError, recoveryVmId, retiredCredentialVmIdsFromLog } from '../recovery/recoveryWebvh.js';
|
|
19
|
+
import { assertNextKeyHashesRemain, attributeRetiredCredentialRungs, ladderRung, ladderVmKeyMultibase, retiredCredentialRungsBeforeKey } from './ladder.js';
|
|
19
20
|
import { clientAnnexDidParts, servicesPointedAtClientAnnex } from './log.js';
|
|
20
21
|
/**
|
|
21
22
|
* THE TRANSIENT-RECOVERY CONTINUATION (run by the code-derived client through
|
|
@@ -35,11 +36,27 @@ import { clientAnnexDidParts, servicesPointedAtClientAnnex } from './log.js';
|
|
|
35
36
|
* (commitment or verbatim -- the entry the mandatory rotation's recipient
|
|
36
37
|
* resolver will back the credential's standing wrap with) in; the
|
|
37
38
|
* replacement code's inventory in; the spent code's VM, update key, and hash
|
|
38
|
-
* out; and EVERY standing
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
39
|
+
* out; and EVERY pre-recovery standing credential fully retired -- its
|
|
40
|
+
* ladder VM and its `keyAgreement` member both struck. The recognition is
|
|
41
|
+
* structural on both axes: `ladderVmIds` by the relation asymmetry, and
|
|
42
|
+
* `credentialKeyAgreementMethods` by the account-DID controller (an
|
|
43
|
+
* enrolled client's key-agreement method carries the client marker
|
|
44
|
+
* instead, so enrolled clients keep their pairs). Other unspent recovery
|
|
45
|
+
* codes fall under the same rule and are retired too: a code's
|
|
46
|
+
* `keyAgreement` member is unmarked and verbatim, indistinguishable from a
|
|
47
|
+
* passkey's, and a cold-browser recovery has no way to put the choice to
|
|
48
|
+
* the user. Each retired credential's whole update-key inventory goes in
|
|
49
|
+
* the same entry: the rung hashes it has standing in `nextKeyHashes`, and
|
|
50
|
+
* any rung of its own left revealed in `updateKeys`. The VM strike alone
|
|
51
|
+
* would rot only a ladder-signed bridge. A bridge minted by an enrolled
|
|
52
|
+
* client -- a passkey added, or a code issued, from a remembered session
|
|
53
|
+
* -- signs with that client's account key, and the client survives this
|
|
54
|
+
* entry, so the committed rung would stay revealable through it
|
|
55
|
+
* (`decisions/0014`). Each credential is anchored from the log alone, its
|
|
56
|
+
* bind entry naming rung 0, and an ambiguous one is reported on
|
|
57
|
+
* `unclaimedCredentialVmIds` rather than struck. Its bridge stays live but
|
|
58
|
+
* inert: nothing revokes it, and it can extend nothing. Rung 0
|
|
59
|
+
* replaces the spent code's key in `updateKeys`. This same entry
|
|
43
60
|
* also points `#DelegatedClients` at the annex generation `onCommitted`
|
|
44
61
|
* minted. That is what the atomicity buys: the entry retires the
|
|
45
62
|
* pre-recovery credential's ladder VM, so a pointer written after it would
|
|
@@ -84,8 +101,10 @@ import { clientAnnexDidParts, servicesPointedAtClientAnnex } from './log.js';
|
|
|
84
101
|
* @param options.credentialKeyAgreement {UnlockKeyAgreementPublication} the
|
|
85
102
|
* fresh credential's key-agreement publication (a commitment for a
|
|
86
103
|
* passphrase-derived key)
|
|
87
|
-
* @param options.replacement {
|
|
88
|
-
* public halves
|
|
104
|
+
* @param options.replacement {ReplacementRecoveryPublicKeys} the
|
|
105
|
+
* replacement code's public halves -- its key-agreement key, its rung-0
|
|
106
|
+
* update key, and its ladder VM key -- committed and published in the same
|
|
107
|
+
* continuation
|
|
89
108
|
* @param [options.expectedDid] {string} the account DID the log must resolve
|
|
90
109
|
* to, where the recovering flow already knows it
|
|
91
110
|
* @param options.onCommitted {function}
|
|
@@ -103,8 +122,14 @@ import { clientAnnexDidParts, servicesPointedAtClientAnnex } from './log.js';
|
|
|
103
122
|
* (`accountLogPinId({ spaceId })`); required whenever a `pinStore` is
|
|
104
123
|
* supplied
|
|
105
124
|
* @returns {Promise<object>} the account DID, the post-continuation
|
|
106
|
-
* document and log (the rotation's recipient source and anchor),
|
|
107
|
-
*
|
|
125
|
+
* document and log (the rotation's recipient source and anchor), the
|
|
126
|
+
* `keyAgreement` verification-method ids this entry struck for
|
|
127
|
+
* pre-recovery credentials OTHER than the spent code
|
|
128
|
+
* (`retiredCredentialVmIds` -- what the caller drops registry entries and
|
|
129
|
+
* deletes unlock Spaces for; on a resumed run whose add entry already
|
|
130
|
+
* landed it is derived from the log, so the resume reports the same list
|
|
131
|
+
* the first run did), and, when the add entry ran here, the final
|
|
132
|
+
* `did.json` projection
|
|
108
133
|
*/
|
|
109
134
|
export async function recoverWebvhLadderAnchored(options) {
|
|
110
135
|
// The seam is what makes the fresh credential's and replacement code's
|
|
@@ -123,33 +148,64 @@ export async function recoverWebvhLadderAnchored(options) {
|
|
|
123
148
|
* conflict retry.
|
|
124
149
|
*
|
|
125
150
|
* @param options {object} see {@link recoverWebvhLadderAnchored}
|
|
126
|
-
* @returns {Promise<{
|
|
151
|
+
* @returns {Promise<object>} see {@link recoverWebvhLadderAnchored}
|
|
127
152
|
*/
|
|
128
153
|
async function recoverWebvhLadderAnchoredOnce({ store, recovery, ladderSeed, credentialKeyAgreement, replacement, expectedDid, onCommitted, pinStore, logId }) {
|
|
129
154
|
// Each attempt's own read is what the CAS publish is built on, so the
|
|
130
155
|
// continuity check runs here -- and again on a conflict-retry re-run -- not
|
|
131
156
|
// only on the verify that follows both entries.
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
...(expectedDid !== undefined ? { expectedDid } : {}),
|
|
139
|
-
...pinned
|
|
157
|
+
let published = await readPublishedLogOrThrow({
|
|
158
|
+
idStore: store,
|
|
159
|
+
expectedDid,
|
|
160
|
+
pinStore,
|
|
161
|
+
logId,
|
|
162
|
+
missingMessage: 'did:webvh: did.jsonl is missing; nothing to recover.'
|
|
140
163
|
});
|
|
141
164
|
const rung0 = await ladderRung({ ladderSeed, index: 0 });
|
|
142
165
|
const rung1 = await ladderRung({ ladderSeed, index: 1 });
|
|
143
166
|
const ladderVmKey = await ladderVmKeyMultibase({ ladderSeed });
|
|
144
|
-
//
|
|
145
|
-
//
|
|
146
|
-
if (published.updateKeys.includes(rung0.keyMultibase)) {
|
|
147
|
-
return { did: published.did, doc: published.doc, log: published.log };
|
|
148
|
-
}
|
|
167
|
+
// Derived before the completion check, because a resume recomputes the
|
|
168
|
+
// strike with the same protected sets the first run used.
|
|
149
169
|
const recoveryHash = await deriveNextKeyHash(recovery.updateKeyMultibase);
|
|
150
170
|
const rung0Hash = await deriveNextKeyHash(rung0.keyMultibase);
|
|
151
171
|
const rung1Hash = await deriveNextKeyHash(rung1.keyMultibase);
|
|
152
172
|
const replacementHash = await deriveNextKeyHash(replacement.updateKeyMultibase);
|
|
173
|
+
// Already complete (a torn earlier run finished the add entry): the fresh
|
|
174
|
+
// ladder's rung 0 is authorized, which only the add entry writes.
|
|
175
|
+
if (published.updateKeys.includes(rung0.keyMultibase)) {
|
|
176
|
+
// The add entry already struck the pre-recovery credentials, so the
|
|
177
|
+
// document names none of them any more. The report is derived from the
|
|
178
|
+
// log instead (`retiredCredentialVmIdsFromLog`), so a resume tells the
|
|
179
|
+
// caller exactly what the first run told it.
|
|
180
|
+
const retired = retiredCredentialVmIdsFromLog({
|
|
181
|
+
log: published.log,
|
|
182
|
+
did: published.did,
|
|
183
|
+
successorKeyMultibase: rung0.keyMultibase,
|
|
184
|
+
spentVmId: recoveryVmId({
|
|
185
|
+
did: published.did,
|
|
186
|
+
keyAgreementKeyMultibase: recovery.keyAgreementKeyMultibase
|
|
187
|
+
})
|
|
188
|
+
});
|
|
189
|
+
// The strike is recomputed by re-running it over the log as it stood just
|
|
190
|
+
// before the add entry, with the same protected sets, so a resume reports
|
|
191
|
+
// exactly what the first run reported rather than a second definition of
|
|
192
|
+
// the same question.
|
|
193
|
+
const strike = await retiredCredentialRungsBeforeKey({
|
|
194
|
+
log: published.log,
|
|
195
|
+
authorizedKeyMultibase: rung0.keyMultibase,
|
|
196
|
+
credentialVmIds: retired,
|
|
197
|
+
protectedHashes: [rung0Hash, rung1Hash, replacementHash],
|
|
198
|
+
protectedKeys: [rung0.keyMultibase]
|
|
199
|
+
});
|
|
200
|
+
return {
|
|
201
|
+
did: published.did,
|
|
202
|
+
doc: published.doc,
|
|
203
|
+
log: published.log,
|
|
204
|
+
retiredCredentialVmIds: retired,
|
|
205
|
+
struckRungHashes: strike.struckHashes,
|
|
206
|
+
unclaimedCredentialVmIds: strike.unclaimedCredentialVmIds
|
|
207
|
+
};
|
|
208
|
+
}
|
|
153
209
|
// The reveal-and-commit entry, skipped when a torn earlier run already
|
|
154
210
|
// published it (the revealed key authorized AND every needed hash
|
|
155
211
|
// committed).
|
|
@@ -180,22 +236,23 @@ async function recoverWebvhLadderAnchoredOnce({ store, recovery, ladderSeed, cre
|
|
|
180
236
|
])
|
|
181
237
|
]
|
|
182
238
|
});
|
|
183
|
-
|
|
239
|
+
// The publish advances the pin to what the reveal entry just published,
|
|
240
|
+
// so the re-read below (and any read after a tear here) refuses a host
|
|
241
|
+
// that rolls the log back behind it.
|
|
242
|
+
await publishEntryPinned({
|
|
184
243
|
store,
|
|
185
244
|
log: updated.log,
|
|
186
|
-
ifMatch: published.etag
|
|
245
|
+
ifMatch: published.etag,
|
|
246
|
+
pinStore,
|
|
247
|
+
logId
|
|
187
248
|
});
|
|
188
|
-
// Advance the pin to what the reveal entry just published, so the re-read
|
|
189
|
-
// below (and any read after a tear here) refuses a host that rolls the
|
|
190
|
-
// log back behind it.
|
|
191
|
-
if (pinStore && logId !== undefined) {
|
|
192
|
-
await pinStore.write({ logId, pin: pinOfLog(updated.log) });
|
|
193
|
-
}
|
|
194
249
|
// The same account the reveal entry just extended, under the same pin.
|
|
195
|
-
published = await
|
|
196
|
-
store,
|
|
250
|
+
published = await readPublishedLogOrThrow({
|
|
251
|
+
idStore: store,
|
|
197
252
|
expectedDid: published.did,
|
|
198
|
-
|
|
253
|
+
pinStore,
|
|
254
|
+
logId,
|
|
255
|
+
missingMessage: 'did:webvh: did.jsonl is missing; nothing to recover.'
|
|
199
256
|
});
|
|
200
257
|
}
|
|
201
258
|
// The persist-before-publish seam: the replacement code's record and the
|
|
@@ -206,8 +263,9 @@ async function recoverWebvhLadderAnchoredOnce({ store, recovery, ladderSeed, cre
|
|
|
206
263
|
clientAnnexDidParts({ did: persisted.clientAnnexDid });
|
|
207
264
|
// The add-and-retire entry: the ladder VM, the fresh credential's
|
|
208
265
|
// keyAgreement inventory, and the replacement code's inventory in; the spent
|
|
209
|
-
// code's VM, update key, and hash out; every standing
|
|
210
|
-
//
|
|
266
|
+
// code's VM, update key, and hash out; every pre-recovery standing
|
|
267
|
+
// credential fully retired -- its ladder VM and its keyAgreement member
|
|
268
|
+
// both. Signed by rung 0, whose hash the commit entry just committed.
|
|
211
269
|
const { did, doc } = published;
|
|
212
270
|
const spentVmId = recoveryVmId({
|
|
213
271
|
did,
|
|
@@ -231,6 +289,41 @@ async function recoverWebvhLadderAnchoredOnce({ store, recovery, ladderSeed, cre
|
|
|
231
289
|
did,
|
|
232
290
|
keyAgreement: credentialKeyAgreement
|
|
233
291
|
});
|
|
292
|
+
// Every pre-recovery credential's keyAgreement member, by the account-DID
|
|
293
|
+
// controller (an enrolled client's carries the client marker instead), less
|
|
294
|
+
// the ids this entry itself adds. The spent code's own id is reported
|
|
295
|
+
// separately: the caller already retires that one by name.
|
|
296
|
+
// The replacement code's ladder VM, published beside its key-agreement
|
|
297
|
+
// member: a code is a standing credential with a ladder, and its own bridge
|
|
298
|
+
// delegation is signed by this VM, so a replacement without it could never
|
|
299
|
+
// spend (`decisions/0019`, `decisions/0020`). Its rung-0 hash is already
|
|
300
|
+
// committed by the reveal-and-commit entry, which this entry carries
|
|
301
|
+
// through.
|
|
302
|
+
const replacementLadderVmId = `${did}#${replacement.ladderVmKeyMultibase}`;
|
|
303
|
+
const addedVmIds = [
|
|
304
|
+
ladderVmId,
|
|
305
|
+
credentialVmId,
|
|
306
|
+
replacementVmId,
|
|
307
|
+
replacementLadderVmId
|
|
308
|
+
];
|
|
309
|
+
const struckCredentialVmIds = credentialKeyAgreementMethods({ doc, did })
|
|
310
|
+
.map(method => method.id)
|
|
311
|
+
.filter((id) => typeof id === 'string')
|
|
312
|
+
.filter(id => !addedVmIds.includes(id));
|
|
313
|
+
const retiredCredentialVmIds = struckCredentialVmIds.filter(id => id !== spentVmId);
|
|
314
|
+
// Each retired credential's committed rungs and any revealed rung of its
|
|
315
|
+
// own go in the SAME entry. Striking the VM alone rots a ladder-signed
|
|
316
|
+
// bridge, but a bridge an enrolled client minted outlives the strike, and
|
|
317
|
+
// that client survives this entry -- so a committed rung left standing is a
|
|
318
|
+
// reveal the retired credential could still perform. The anchoring is
|
|
319
|
+
// log-only (this browser holds no registry), and an unanchorable credential
|
|
320
|
+
// is reported rather than struck.
|
|
321
|
+
const strike = await attributeRetiredCredentialRungs({
|
|
322
|
+
log: published.log,
|
|
323
|
+
credentialVmIds: retiredCredentialVmIds,
|
|
324
|
+
protectedHashes: [rung0Hash, rung1Hash, replacementHash],
|
|
325
|
+
protectedKeys: [rung0.keyMultibase]
|
|
326
|
+
});
|
|
234
327
|
const addedMethods = [
|
|
235
328
|
ladderVm,
|
|
236
329
|
credentialVm,
|
|
@@ -239,16 +332,33 @@ async function recoverWebvhLadderAnchoredOnce({ store, recovery, ladderSeed, cre
|
|
|
239
332
|
type: MULTIKEY_VM_TYPE,
|
|
240
333
|
controller: did,
|
|
241
334
|
publicKeyMultibase: replacement.keyAgreementKeyMultibase
|
|
242
|
-
}
|
|
335
|
+
},
|
|
336
|
+
ladderVerificationMethod({
|
|
337
|
+
controller: did,
|
|
338
|
+
publicKeyMultibase: replacement.ladderVmKeyMultibase
|
|
339
|
+
})
|
|
243
340
|
];
|
|
244
341
|
const existingMethods = (doc.verificationMethod ?? []);
|
|
245
342
|
const verificationMethods = [
|
|
246
343
|
...existingMethods.filter(method => method.id !== spentVmId &&
|
|
247
344
|
!addedMethods.some(added => added.id === method.id) &&
|
|
248
|
-
(method.id === undefined ||
|
|
345
|
+
(method.id === undefined ||
|
|
346
|
+
(!ladderVms.includes(method.id) &&
|
|
347
|
+
!struckCredentialVmIds.includes(method.id)))),
|
|
249
348
|
...addedMethods
|
|
250
349
|
];
|
|
251
|
-
|
|
350
|
+
// The retirement filter runs over the EXISTING relation ids only, and the
|
|
351
|
+
// added ids join afterwards: a resumed run's fresh ladder VM already stands
|
|
352
|
+
// in `doc.capabilityDelegation`, so filtering the union would strike the
|
|
353
|
+
// very method this entry is publishing.
|
|
354
|
+
const withoutRemoved = (relation, added) => [
|
|
355
|
+
...new Set([
|
|
356
|
+
...relationIds(relation).filter(referencedId => referencedId !== spentVmId &&
|
|
357
|
+
!ladderVms.includes(referencedId) &&
|
|
358
|
+
!struckCredentialVmIds.includes(referencedId)),
|
|
359
|
+
...(added ?? [])
|
|
360
|
+
])
|
|
361
|
+
];
|
|
252
362
|
const signer = await updateKeySigner({ seed: rung0.seed });
|
|
253
363
|
const updated = await updateDID({
|
|
254
364
|
log: published.log,
|
|
@@ -256,25 +366,33 @@ async function recoverWebvhLadderAnchoredOnce({ store, recovery, ladderSeed, cre
|
|
|
256
366
|
alsoKnownAsWeb: true,
|
|
257
367
|
updateKeys: [
|
|
258
368
|
...new Set([
|
|
259
|
-
...published.updateKeys.filter(key => key !== recovery.updateKeyMultibase
|
|
369
|
+
...published.updateKeys.filter(key => key !== recovery.updateKeyMultibase &&
|
|
370
|
+
!strike.struckKeys.includes(key)),
|
|
260
371
|
rung0.keyMultibase
|
|
261
372
|
])
|
|
262
373
|
],
|
|
263
|
-
nextKeyHashes:
|
|
374
|
+
nextKeyHashes: assertNextKeyHashesRemain({
|
|
375
|
+
nextKeyHashes: published.nextKeyHashes.filter(hash => hash !== recoveryHash && !strike.struckHashes.includes(hash)),
|
|
376
|
+
ceremony: 'the transient-recovery add-and-retire entry'
|
|
377
|
+
}),
|
|
264
378
|
verificationMethods,
|
|
265
379
|
// The ladder VM's relation asymmetry: `assertionMethod` and
|
|
266
380
|
// `capabilityDelegation` only -- no `authentication`, no
|
|
267
381
|
// `capabilityInvocation` -- which is also what keeps it out of every
|
|
268
382
|
// client listing.
|
|
269
383
|
authentication: withoutRemoved(doc.authentication),
|
|
270
|
-
assertionMethod: withoutRemoved(doc.assertionMethod, [
|
|
384
|
+
assertionMethod: withoutRemoved(doc.assertionMethod, [
|
|
385
|
+
ladderVmId,
|
|
386
|
+
replacementLadderVmId
|
|
387
|
+
]),
|
|
271
388
|
keyAgreement: withoutRemoved(doc.keyAgreement, [
|
|
272
389
|
credentialVmId,
|
|
273
390
|
replacementVmId
|
|
274
391
|
]),
|
|
275
392
|
capabilityInvocation: withoutRemoved(doc.capabilityInvocation),
|
|
276
393
|
capabilityDelegation: withoutRemoved(doc.capabilityDelegation, [
|
|
277
|
-
ladderVmId
|
|
394
|
+
ladderVmId,
|
|
395
|
+
replacementLadderVmId
|
|
278
396
|
]),
|
|
279
397
|
// Atomic with the retirement above: the pointer and the ladder-VM set
|
|
280
398
|
// change in one entry, so no window exists in which the document points
|
|
@@ -287,16 +405,20 @@ async function recoverWebvhLadderAnchoredOnce({ store, recovery, ladderSeed, cre
|
|
|
287
405
|
});
|
|
288
406
|
// Conditional on the read this entry was built on: the re-read above when
|
|
289
407
|
// the commit entry ran here, the first read when it was skipped.
|
|
290
|
-
await
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
408
|
+
await publishEntryPinned({
|
|
409
|
+
store,
|
|
410
|
+
log: updated.log,
|
|
411
|
+
ifMatch: published.etag,
|
|
412
|
+
pinStore,
|
|
413
|
+
logId
|
|
414
|
+
});
|
|
296
415
|
return {
|
|
297
416
|
did: updated.did,
|
|
298
417
|
doc: updated.doc,
|
|
299
418
|
log: updated.log,
|
|
419
|
+
retiredCredentialVmIds,
|
|
420
|
+
struckRungHashes: strike.struckHashes,
|
|
421
|
+
unclaimedCredentialVmIds: strike.unclaimedCredentialVmIds,
|
|
300
422
|
webDoc: updated.webDoc
|
|
301
423
|
};
|
|
302
424
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recoveryLadderAnchored.js","sourceRoot":"","sources":["../../src/clientAnnex/recoveryLadderAnchored.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"recoveryLadderAnchored.js","sourceRoot":"","sources":["../../src/clientAnnex/recoveryLadderAnchored.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;GASG;AACH,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAMxE,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,EACxB,gBAAgB,EAChB,kBAAkB,EAClB,uBAAuB,EACvB,eAAe,EACf,oBAAoB,EACrB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EACL,6BAA6B,EAC7B,WAAW,EACX,WAAW,EACZ,MAAM,4BAA4B,CAAA;AACnC,OAAO,EACL,2BAA2B,EAC3B,aAAa,EAEd,MAAM,4BAA4B,CAAA;AACnC,OAAO,EACL,4BAA4B,EAC5B,YAAY,EACZ,6BAA6B,EAI9B,MAAM,8BAA8B,CAAA;AACrC,OAAO,EACL,yBAAyB,EACzB,+BAA+B,EAC/B,UAAU,EACV,oBAAoB,EACpB,+BAA+B,EAChC,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,mBAAmB,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAA;AAE5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgHG;AACH,MAAM,CAAC,KAAK,UAA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,GAAG;QAChB,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,sBAAsB;QACtB,gBAAgB,EAAE,MAAM,CAAC,YAAY;QACrC,wBAAwB,EAAE,MAAM,CAAC,wBAAwB;QACzD,MAAM,EAAE,OAAO,CAAC,MAAM;KACvB,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Single-verb Space capabilities: the short-lived children a transient
|
|
6
|
+
* session mints so it can destroy (or probe) a Space it has no root
|
|
7
|
+
* invocation over. Two shapes, one mint, both target-exact:
|
|
8
|
+
*
|
|
9
|
+
* - Three links, over a stored parent. The parent is the management zcap an
|
|
10
|
+
* unlock identity delegated to the account at bind time. The child's
|
|
11
|
+
* `invocationTarget` is the parent's own, copied verbatim from the parent's
|
|
12
|
+
* bytes rather than rebuilt, so a deployment whose stored parent carries a
|
|
13
|
+
* target this client would build differently still lands on the bytes the
|
|
14
|
+
* server checks.
|
|
15
|
+
* - Two links, over a Space's synthesized root. The child's
|
|
16
|
+
* `invocationTarget` is the bare Space URL, built with was-client's path
|
|
17
|
+
* builders so a sub-path deployment keeps its prefix.
|
|
18
|
+
*
|
|
19
|
+
* `allowedAction` is exactly one HTTP verb -- `DELETE` for the deletion
|
|
20
|
+
* child, `GET` for the probe child -- which is what a storage server's
|
|
21
|
+
* admission predicate keys on. The delegatee is the caller's: the ladder
|
|
22
|
+
* VM's bare did:key on a transient session (it re-derives from the ladder
|
|
23
|
+
* seed and resolves from its own bytes, so it outlives the account log it
|
|
24
|
+
* was minted beside), the account did:webvh on a remembered one.
|
|
25
|
+
*
|
|
26
|
+
* Nothing here is stored. A child is minted immediately before its own
|
|
27
|
+
* request and dropped; on a torn run it lapses by its short TTL, so no
|
|
28
|
+
* revocation is owed.
|
|
29
|
+
*
|
|
30
|
+
* Two checks stay with the caller rather than here: that the parent's
|
|
31
|
+
* `controller` is the delegator this client signs as, and that the parent's
|
|
32
|
+
* target names the Space the caller means on the deployment it is talking
|
|
33
|
+
* to. The caller holds the deployment URL and the delegator DID; this module
|
|
34
|
+
* holds neither, and guessing either would rebuild the very bytes the
|
|
35
|
+
* verbatim copy exists to preserve.
|
|
36
|
+
*/
|
|
37
|
+
import type { IZcap } from '@interop/data-integrity-core';
|
|
38
|
+
import type { ZcapClient } from '@interop/ezcap';
|
|
39
|
+
/**
|
|
40
|
+
* The single-verb Space capability's lifetime: ten minutes, long enough for
|
|
41
|
+
* the request it is minted for and twice `@interop/zcap`'s 300-second clock
|
|
42
|
+
* skew allowance. A child's `expires` is the earlier of this and its
|
|
43
|
+
* parent's, since the library refuses a child less restrictive than its
|
|
44
|
+
* parent with no skew allowance.
|
|
45
|
+
*/
|
|
46
|
+
export declare const DELETION_ZCAP_TTL_MS: number;
|
|
47
|
+
/**
|
|
48
|
+
* The two verbs a single-verb Space capability may carry: the deletion
|
|
49
|
+
* child's `DELETE` and the probe child's `GET`.
|
|
50
|
+
*/
|
|
51
|
+
export type SpaceCapabilityVerb = 'DELETE' | 'GET';
|
|
52
|
+
/**
|
|
53
|
+
* The typed refusal of a mint over a parent capability whose own `expires`
|
|
54
|
+
* has already passed: the child would verify nowhere, so nothing is minted
|
|
55
|
+
* and nothing is sent. Matched on `name` -- error classes do not survive
|
|
56
|
+
* crossing package copies. The parent's `expires` and `id` ride the error so
|
|
57
|
+
* a caller can name the lapsed capability in its own copy without re-reading
|
|
58
|
+
* the parent.
|
|
59
|
+
*/
|
|
60
|
+
export declare class ExpiredParentCapabilityError extends Error {
|
|
61
|
+
readonly parentExpires: string;
|
|
62
|
+
readonly parentId: string | undefined;
|
|
63
|
+
constructor({ message, parentExpires, parentId }: {
|
|
64
|
+
message: string;
|
|
65
|
+
parentExpires: string;
|
|
66
|
+
parentId: string | undefined;
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Mints a single-verb child of a STORED parent capability -- the three-link
|
|
71
|
+
* shape, used on an unlock Space whose management zcap the account already
|
|
72
|
+
* holds. The child's `invocationTarget` is the parent's unchanged.
|
|
73
|
+
*
|
|
74
|
+
* @param options {object}
|
|
75
|
+
* @param options.zcapClient {ZcapClient} the delegating signer (the ladder
|
|
76
|
+
* VM's client on a transient session, an enrolled client's on a remembered
|
|
77
|
+
* one)
|
|
78
|
+
* @param options.parent {IZcap} the stored parent capability
|
|
79
|
+
* @param options.verb {SpaceCapabilityVerb} the child's one allowed action
|
|
80
|
+
* @param options.controller {string} the delegatee DID
|
|
81
|
+
* @param [options.ttlMs] {number} the child's requested lifetime
|
|
82
|
+
* @param [options.now] {number} the clock the child is minted against
|
|
83
|
+
* (epoch milliseconds); a caller holding server-relative time passes it
|
|
84
|
+
* so the proof's `created` and the child's `expires` come off one clock
|
|
85
|
+
* @returns {Promise<IZcap>}
|
|
86
|
+
*/
|
|
87
|
+
export declare function mintSpaceVerbCapability({ zcapClient, parent, verb, controller, ttlMs, now }: {
|
|
88
|
+
zcapClient: ZcapClient;
|
|
89
|
+
parent: IZcap;
|
|
90
|
+
verb: SpaceCapabilityVerb;
|
|
91
|
+
controller: string;
|
|
92
|
+
ttlMs?: number;
|
|
93
|
+
now?: number;
|
|
94
|
+
}): Promise<IZcap>;
|
|
95
|
+
/**
|
|
96
|
+
* Mints a single-verb child of a Space's SYNTHESIZED ROOT -- the two-link
|
|
97
|
+
* shape, used on the account Space and an auxiliary annex Space, where the
|
|
98
|
+
* session holds no stored parent. The child's `invocationTarget` is the bare
|
|
99
|
+
* Space URL, with no trailing slash, so the deletion child covers the Space
|
|
100
|
+
* itself rather than its items subtree.
|
|
101
|
+
*
|
|
102
|
+
* @param options {object}
|
|
103
|
+
* @param options.zcapClient {ZcapClient} the delegating signer
|
|
104
|
+
* @param options.storageServerUrl {string} the Space's storage server
|
|
105
|
+
* @param options.spaceId {string}
|
|
106
|
+
* @param options.verb {SpaceCapabilityVerb} the child's one allowed action
|
|
107
|
+
* @param options.controller {string} the delegatee DID
|
|
108
|
+
* @param [options.ttlMs] {number} the child's requested lifetime
|
|
109
|
+
* @param [options.now] {number} the clock the child is minted against
|
|
110
|
+
* (epoch milliseconds); a caller holding server-relative time passes it
|
|
111
|
+
* so the proof's `created` and the child's `expires` come off one clock
|
|
112
|
+
* @returns {Promise<IZcap>}
|
|
113
|
+
*/
|
|
114
|
+
export declare function mintSpaceRootVerbCapability({ zcapClient, storageServerUrl, spaceId, verb, controller, ttlMs, now }: {
|
|
115
|
+
zcapClient: ZcapClient;
|
|
116
|
+
storageServerUrl: string;
|
|
117
|
+
spaceId: string;
|
|
118
|
+
verb: SpaceCapabilityVerb;
|
|
119
|
+
controller: string;
|
|
120
|
+
ttlMs?: number;
|
|
121
|
+
now?: number;
|
|
122
|
+
}): Promise<IZcap>;
|
|
123
|
+
//# sourceMappingURL=spaceCapability.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spaceCapability.d.ts","sourceRoot":"","sources":["../../src/clientAnnex/spaceCapability.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAGhD;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,QAAiB,CAAA;AAElD;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,KAAK,CAAA;AAElD;;;;;;;GAOG;AACH,qBAAa,4BAA6B,SAAQ,KAAK;IACrD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;gBAEzB,EACV,OAAO,EACP,aAAa,EACb,QAAQ,EACT,EAAE;Q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