@interop/wallet-core 0.66.0 → 0.68.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 +12 -8
- package/dist/clientAnnex/credentialAnchoredGenesis.d.ts +6 -10
- package/dist/clientAnnex/credentialAnchoredGenesis.d.ts.map +1 -1
- package/dist/clientAnnex/credentialAnchoredGenesis.js +34 -56
- package/dist/clientAnnex/credentialAnchoredGenesis.js.map +1 -1
- package/dist/clientAnnex/establish.d.ts +46 -29
- package/dist/clientAnnex/establish.d.ts.map +1 -1
- package/dist/clientAnnex/establish.js +111 -86
- package/dist/clientAnnex/establish.js.map +1 -1
- package/dist/clientAnnex/forget.d.ts +7 -16
- package/dist/clientAnnex/forget.d.ts.map +1 -1
- package/dist/clientAnnex/forget.js +13 -24
- package/dist/clientAnnex/forget.js.map +1 -1
- package/dist/clientAnnex/forgetLast.d.ts +33 -129
- package/dist/clientAnnex/forgetLast.d.ts.map +1 -1
- package/dist/clientAnnex/forgetLast.js +43 -182
- package/dist/clientAnnex/forgetLast.js.map +1 -1
- package/dist/clientAnnex/gc.d.ts +26 -12
- package/dist/clientAnnex/gc.d.ts.map +1 -1
- package/dist/clientAnnex/gc.js +60 -57
- package/dist/clientAnnex/gc.js.map +1 -1
- package/dist/clientAnnex/heal.d.ts +75 -18
- package/dist/clientAnnex/heal.d.ts.map +1 -1
- package/dist/clientAnnex/heal.js +79 -147
- package/dist/clientAnnex/heal.js.map +1 -1
- package/dist/clientAnnex/index.d.ts +8 -8
- package/dist/clientAnnex/index.d.ts.map +1 -1
- package/dist/clientAnnex/index.js +5 -5
- package/dist/clientAnnex/index.js.map +1 -1
- package/dist/clientAnnex/ladder.d.ts +51 -4
- package/dist/clientAnnex/ladder.d.ts.map +1 -1
- package/dist/clientAnnex/ladder.js +283 -47
- package/dist/clientAnnex/ladder.js.map +1 -1
- package/dist/clientAnnex/ladderAnchored.d.ts +62 -73
- package/dist/clientAnnex/ladderAnchored.d.ts.map +1 -1
- package/dist/clientAnnex/ladderAnchored.js +103 -117
- package/dist/clientAnnex/ladderAnchored.js.map +1 -1
- package/dist/clientAnnex/log.d.ts +123 -125
- package/dist/clientAnnex/log.d.ts.map +1 -1
- package/dist/clientAnnex/log.js +174 -233
- package/dist/clientAnnex/log.js.map +1 -1
- package/dist/clientAnnex/mend.d.ts +0 -4
- package/dist/clientAnnex/mend.d.ts.map +1 -1
- package/dist/clientAnnex/mend.js +50 -51
- package/dist/clientAnnex/mend.js.map +1 -1
- package/dist/clientAnnex/recoveryLadderAnchored.d.ts +25 -13
- package/dist/clientAnnex/recoveryLadderAnchored.d.ts.map +1 -1
- package/dist/clientAnnex/recoveryLadderAnchored.js +80 -303
- package/dist/clientAnnex/recoveryLadderAnchored.js.map +1 -1
- package/dist/clientAnnex/rosterDeliveredEpochs.d.ts +13 -5
- package/dist/clientAnnex/rosterDeliveredEpochs.d.ts.map +1 -1
- package/dist/clientAnnex/rosterDeliveredEpochs.js +18 -9
- package/dist/clientAnnex/rosterDeliveredEpochs.js.map +1 -1
- package/dist/clientAnnex/selfEnroll.d.ts +6 -10
- package/dist/clientAnnex/selfEnroll.d.ts.map +1 -1
- package/dist/clientAnnex/selfEnroll.js +13 -18
- package/dist/clientAnnex/selfEnroll.js.map +1 -1
- package/dist/clientAnnex/zcap.d.ts +19 -0
- package/dist/clientAnnex/zcap.d.ts.map +1 -1
- package/dist/clientAnnex/zcap.js +80 -12
- package/dist/clientAnnex/zcap.js.map +1 -1
- package/dist/clients/index.d.ts +3 -2
- package/dist/clients/index.d.ts.map +1 -1
- package/dist/clients/index.js +3 -2
- package/dist/clients/index.js.map +1 -1
- package/dist/clients/listing.d.ts.map +1 -1
- package/dist/clients/listing.js +33 -15
- package/dist/clients/listing.js.map +1 -1
- package/dist/clients/policy.d.ts +18 -0
- package/dist/clients/policy.d.ts.map +1 -1
- package/dist/clients/policy.js +22 -8
- package/dist/clients/policy.js.map +1 -1
- package/dist/clients/revocation.d.ts +18 -30
- package/dist/clients/revocation.d.ts.map +1 -1
- package/dist/clients/revocation.js +12 -27
- package/dist/clients/revocation.js.map +1 -1
- package/dist/clients/rosterPolicy.d.ts +6 -1
- package/dist/clients/rosterPolicy.d.ts.map +1 -1
- package/dist/clients/rosterPolicy.js +27 -30
- package/dist/clients/rosterPolicy.js.map +1 -1
- package/dist/descriptors/errors.d.ts +6 -5
- package/dist/descriptors/errors.d.ts.map +1 -1
- package/dist/descriptors/errors.js +6 -5
- package/dist/descriptors/errors.js.map +1 -1
- package/dist/descriptors/index.d.ts +7 -3
- package/dist/descriptors/index.d.ts.map +1 -1
- package/dist/descriptors/index.js +7 -3
- package/dist/descriptors/index.js.map +1 -1
- package/dist/descriptors/logSource.d.ts +28 -6
- package/dist/descriptors/logSource.d.ts.map +1 -1
- package/dist/descriptors/logSource.js +33 -7
- package/dist/descriptors/logSource.js.map +1 -1
- package/dist/enrollment/enrollment.d.ts.map +1 -1
- package/dist/enrollment/enrollment.js +3 -7
- package/dist/enrollment/enrollment.js.map +1 -1
- package/dist/genesis/accountGenesis.d.ts +11 -16
- package/dist/genesis/accountGenesis.d.ts.map +1 -1
- package/dist/genesis/accountGenesis.js +43 -47
- package/dist/genesis/accountGenesis.js.map +1 -1
- package/dist/genesis/kmsAuthentication.d.ts +50 -0
- package/dist/genesis/kmsAuthentication.d.ts.map +1 -0
- package/dist/genesis/kmsAuthentication.js +49 -0
- package/dist/genesis/kmsAuthentication.js.map +1 -0
- package/dist/keyring/kdf.d.ts +16 -20
- package/dist/keyring/kdf.d.ts.map +1 -1
- package/dist/keyring/kdf.js +2 -2
- package/dist/keyring/kdf.js.map +1 -1
- package/dist/keyring/unlockSpace.d.ts +8 -30
- package/dist/keyring/unlockSpace.d.ts.map +1 -1
- package/dist/keyring/unlockSpace.js +8 -31
- package/dist/keyring/unlockSpace.js.map +1 -1
- package/dist/keys/clientKeyRecord.d.ts +2 -1
- package/dist/keys/clientKeyRecord.d.ts.map +1 -1
- package/dist/keys/clientKeyRecord.js +28 -11
- package/dist/keys/clientKeyRecord.js.map +1 -1
- package/dist/keys/index.d.ts +6 -2
- package/dist/keys/index.d.ts.map +1 -1
- package/dist/keys/index.js +5 -1
- package/dist/keys/index.js.map +1 -1
- package/dist/keys/rosterLogStore.d.ts.map +1 -1
- package/dist/keys/rosterLogStore.js +14 -5
- package/dist/keys/rosterLogStore.js.map +1 -1
- package/dist/keys/spaceEpochs.d.ts +92 -3
- package/dist/keys/spaceEpochs.d.ts.map +1 -1
- package/dist/keys/spaceEpochs.js +110 -4
- package/dist/keys/spaceEpochs.js.map +1 -1
- package/dist/keys/userKeyRoster.d.ts +30 -3
- package/dist/keys/userKeyRoster.d.ts.map +1 -1
- package/dist/keys/userKeyRoster.js +90 -15
- package/dist/keys/userKeyRoster.js.map +1 -1
- package/dist/keys/userKeyRosterCascade.d.ts.map +1 -1
- package/dist/keys/userKeyRosterCascade.js +5 -1
- package/dist/keys/userKeyRosterCascade.js.map +1 -1
- package/dist/recovery/continuation.d.ts +250 -0
- package/dist/recovery/continuation.d.ts.map +1 -0
- package/dist/recovery/continuation.js +467 -0
- package/dist/recovery/continuation.js.map +1 -0
- 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/recoveryDelegation.d.ts +23 -126
- package/dist/recovery/recoveryDelegation.d.ts.map +1 -1
- package/dist/recovery/recoveryDelegation.js +1 -266
- package/dist/recovery/recoveryDelegation.js.map +1 -1
- package/dist/recovery/recoveryWebvh.d.ts +52 -107
- package/dist/recovery/recoveryWebvh.d.ts.map +1 -1
- package/dist/recovery/recoveryWebvh.js +54 -403
- package/dist/recovery/recoveryWebvh.js.map +1 -1
- package/dist/request/classify.d.ts +3 -14
- package/dist/request/classify.d.ts.map +1 -1
- package/dist/request/classify.js +19 -40
- package/dist/request/classify.js.map +1 -1
- package/dist/request/index.d.ts +1 -0
- package/dist/request/index.d.ts.map +1 -1
- package/dist/request/index.js +1 -0
- package/dist/request/index.js.map +1 -1
- package/dist/request/onboarding.d.ts.map +1 -1
- package/dist/request/onboarding.js +19 -27
- package/dist/request/onboarding.js.map +1 -1
- package/dist/request/parse.d.ts +5 -3
- package/dist/request/parse.d.ts.map +1 -1
- package/dist/request/parse.js +7 -6
- package/dist/request/parse.js.map +1 -1
- package/dist/request/processRequest.d.ts.map +1 -1
- package/dist/request/processRequest.js +2 -1
- package/dist/request/processRequest.js.map +1 -1
- package/dist/request/queryPredicates.d.ts +98 -0
- package/dist/request/queryPredicates.d.ts.map +1 -0
- package/dist/request/queryPredicates.js +107 -0
- package/dist/request/queryPredicates.js.map +1 -0
- package/dist/resourceLog/document.d.ts +39 -0
- package/dist/resourceLog/document.d.ts.map +1 -1
- package/dist/resourceLog/document.js +41 -0
- package/dist/resourceLog/document.js.map +1 -1
- package/dist/resourceLog/index.d.ts +2 -2
- package/dist/resourceLog/index.js +2 -2
- package/dist/resourceLog/ladderRungs.d.ts.map +1 -1
- package/dist/resourceLog/ladderRungs.js +3 -2
- package/dist/resourceLog/ladderRungs.js.map +1 -1
- package/dist/sync/contactsConflict.d.ts.map +1 -1
- package/dist/sync/contactsConflict.js +8 -2
- package/dist/sync/contactsConflict.js.map +1 -1
- package/dist/sync/engine.d.ts +38 -23
- package/dist/sync/engine.d.ts.map +1 -1
- package/dist/sync/engine.js +36 -5
- package/dist/sync/engine.js.map +1 -1
- package/dist/sync/index.d.ts +9 -12
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +8 -11
- package/dist/sync/index.js.map +1 -1
- package/dist/sync/push.d.ts.map +1 -1
- package/dist/sync/push.js +1 -2
- package/dist/sync/push.js.map +1 -1
- package/dist/sync/remint.d.ts +0 -31
- package/dist/sync/remint.d.ts.map +1 -1
- package/dist/sync/remint.js +32 -1
- package/dist/sync/remint.js.map +1 -1
- package/dist/sync/types.d.ts +4 -41
- package/dist/sync/types.d.ts.map +1 -1
- package/dist/sync/types.js +4 -47
- package/dist/sync/types.js.map +1 -1
- package/dist/unlock/index.d.ts +1 -1
- package/dist/unlock/index.d.ts.map +1 -1
- package/dist/unlock/index.js +1 -1
- package/dist/unlock/index.js.map +1 -1
- package/dist/unlock/retire.d.ts +16 -64
- package/dist/unlock/retire.d.ts.map +1 -1
- package/dist/unlock/retire.js +7 -86
- package/dist/unlock/retire.js.map +1 -1
- package/dist/unlock/standingWebvh.d.ts +27 -61
- package/dist/unlock/standingWebvh.d.ts.map +1 -1
- package/dist/unlock/standingWebvh.js +40 -92
- package/dist/unlock/standingWebvh.js.map +1 -1
- package/dist/unlock/unlockRecord.d.ts.map +1 -1
- package/dist/unlock/unlockRecord.js +69 -44
- package/dist/unlock/unlockRecord.js.map +1 -1
- package/dist/webvh/accountEntry.d.ts +68 -19
- package/dist/webvh/accountEntry.d.ts.map +1 -1
- package/dist/webvh/accountEntry.js +117 -37
- package/dist/webvh/accountEntry.js.map +1 -1
- package/dist/webvh/delegatedLogStore.d.ts +24 -13
- package/dist/webvh/delegatedLogStore.d.ts.map +1 -1
- package/dist/webvh/delegatedLogStore.js +40 -11
- package/dist/webvh/delegatedLogStore.js.map +1 -1
- package/dist/webvh/didWebvh.d.ts +91 -86
- package/dist/webvh/didWebvh.d.ts.map +1 -1
- package/dist/webvh/didWebvh.js +117 -142
- package/dist/webvh/didWebvh.js.map +1 -1
- package/dist/webvh/enrollClient.d.ts +2 -8
- package/dist/webvh/enrollClient.d.ts.map +1 -1
- package/dist/webvh/enrollClient.js +22 -31
- package/dist/webvh/enrollClient.js.map +1 -1
- package/dist/webvh/index.d.ts +12 -8
- package/dist/webvh/index.d.ts.map +1 -1
- package/dist/webvh/index.js +10 -7
- package/dist/webvh/index.js.map +1 -1
- package/dist/webvh/listClients.d.ts.map +1 -1
- package/dist/webvh/listClients.js +102 -65
- package/dist/webvh/listClients.js.map +1 -1
- package/dist/webvh/mergeMethods.d.ts +84 -0
- package/dist/webvh/mergeMethods.d.ts.map +1 -0
- package/dist/webvh/mergeMethods.js +46 -0
- package/dist/webvh/mergeMethods.js.map +1 -0
- package/dist/webvh/revokeClient.d.ts +15 -11
- package/dist/webvh/revokeClient.d.ts.map +1 -1
- package/dist/webvh/revokeClient.js +130 -57
- package/dist/webvh/revokeClient.js.map +1 -1
- package/dist/webvh/verifyLog.d.ts +45 -4
- package/dist/webvh/verifyLog.d.ts.map +1 -1
- package/dist/webvh/verifyLog.js +62 -21
- package/dist/webvh/verifyLog.js.map +1 -1
- package/dist/webvh/wasIdStore.d.ts +16 -3
- package/dist/webvh/wasIdStore.d.ts.map +1 -1
- package/dist/webvh/wasIdStore.js +18 -3
- package/dist/webvh/wasIdStore.js.map +1 -1
- package/package.json +11 -11
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { PreconditionFailedError, WasClient } from '@interop/was-client';
|
|
2
2
|
import { resourcePath, toUrl } from '@interop/was-client/paths';
|
|
3
|
+
import { WALLET_SPACE_PROVISION_ROSTER } from '../space/collections.js';
|
|
4
|
+
import { logResourcePinId } from './verifyLog.js';
|
|
3
5
|
/**
|
|
4
6
|
* The `status` of a raw signed-request error, when it carries one.
|
|
5
7
|
*
|
|
@@ -10,32 +12,52 @@ function statusOf(err) {
|
|
|
10
12
|
const status = err?.status;
|
|
11
13
|
return typeof status === 'number' ? status : undefined;
|
|
12
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Whether a collection of the wallet Space is world-readable, per its
|
|
17
|
+
* provisioning spec. A collection the roster does not list (an annex
|
|
18
|
+
* generation's `gen-` collection) is capability-gated.
|
|
19
|
+
*
|
|
20
|
+
* @param options {object}
|
|
21
|
+
* @param options.collectionId {string}
|
|
22
|
+
* @returns {boolean}
|
|
23
|
+
*/
|
|
24
|
+
function collectionIsPublic({ collectionId }) {
|
|
25
|
+
return (WALLET_SPACE_PROVISION_ROSTER.find(spec => spec.collectionId === collectionId)?.isPublic ?? false);
|
|
26
|
+
}
|
|
13
27
|
/**
|
|
14
28
|
* Builds a delegated log store over one collection of one Space.
|
|
15
29
|
*
|
|
16
|
-
* Reads:
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* delegation allows GET and PUT).
|
|
21
|
-
*
|
|
30
|
+
* Reads: on a world-readable collection (the `id` collection's account log
|
|
31
|
+
* -- the bridge delegation allows PUT only) the GET is an unauthenticated
|
|
32
|
+
* fetch; on every other collection it invokes the same delegation (the annex
|
|
33
|
+
* inventory -- the generation collection is capability-gated and the sibling
|
|
34
|
+
* delegation allows GET and PUT). The choice is read off the wallet Space
|
|
35
|
+
* roster (`isPublic`), so no caller states it. Either way a 404 reads as
|
|
36
|
+
* "not published" and the response's ETag rides back as the compare-and-swap
|
|
37
|
+
* token.
|
|
22
38
|
*
|
|
23
39
|
* @param options {object}
|
|
24
40
|
* @param options.host {string} the storage server's base URL
|
|
25
41
|
* @param options.spaceId {string} the Space holding the collection
|
|
26
42
|
* @param options.collectionId {string} the collection holding the log
|
|
27
43
|
* @param options.delegation {IZcap} the pre-minted delegation the writes
|
|
28
|
-
* (and,
|
|
44
|
+
* (and, on a capability-gated collection, the reads) invoke
|
|
29
45
|
* @param options.zcapClient {ZcapClient} the ezcap client holding the
|
|
30
46
|
* invoking signer
|
|
31
|
-
* @param
|
|
32
|
-
*
|
|
47
|
+
* @param options.pinStore {ResourceLogPinStore} this client's chain-head
|
|
48
|
+
* pins; the log's slot is derived here from the collection
|
|
49
|
+
* (`logResourcePinId`)
|
|
33
50
|
* @returns {DelegatedWebvhLogStore}
|
|
34
51
|
*/
|
|
35
|
-
export function delegatedWebvhLogStore({ host, spaceId, collectionId, delegation, zcapClient,
|
|
52
|
+
export function delegatedWebvhLogStore({ host, spaceId, collectionId, delegation, zcapClient, pinStore }) {
|
|
53
|
+
const publicRead = collectionIsPublic({ collectionId });
|
|
36
54
|
const was = new WasClient({ serverUrl: host, zcapClient });
|
|
37
55
|
const pathOf = (resourceId) => resourcePath(spaceId, collectionId, resourceId);
|
|
38
56
|
return {
|
|
57
|
+
pin: {
|
|
58
|
+
store: pinStore,
|
|
59
|
+
logId: logResourcePinId({ spaceId, collectionId })
|
|
60
|
+
},
|
|
39
61
|
async getIdResourceRaw({ resourceId }) {
|
|
40
62
|
if (publicRead) {
|
|
41
63
|
const response = await fetch(toUrl({ serverUrl: host, path: pathOf(resourceId) }));
|
|
@@ -80,8 +102,9 @@ export function delegatedWebvhLogStore({ host, spaceId, collectionId, delegation
|
|
|
80
102
|
if (ifNoneMatch) {
|
|
81
103
|
headers['if-none-match'] = '*';
|
|
82
104
|
}
|
|
105
|
+
let response;
|
|
83
106
|
try {
|
|
84
|
-
await was.request({
|
|
107
|
+
response = await was.request({
|
|
85
108
|
path: pathOf(resourceId),
|
|
86
109
|
method: 'PUT',
|
|
87
110
|
headers,
|
|
@@ -98,6 +121,12 @@ export function delegatedWebvhLogStore({ host, spaceId, collectionId, delegation
|
|
|
98
121
|
}
|
|
99
122
|
throw err;
|
|
100
123
|
}
|
|
124
|
+
// The PUT's own response carries the stored resource's new validator,
|
|
125
|
+
// handed back as the root store hands it back: a ceremony that
|
|
126
|
+
// publishes through the bridge can then build its next entry on the
|
|
127
|
+
// head it just wrote, under a compare-and-swap, instead of re-reading.
|
|
128
|
+
const etag = response.headers.get('etag') ?? undefined;
|
|
129
|
+
return etag !== undefined ? { etag } : {};
|
|
101
130
|
}
|
|
102
131
|
};
|
|
103
132
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delegatedLogStore.js","sourceRoot":"","sources":["../../src/webvh/delegatedLogStore.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"delegatedLogStore.js","sourceRoot":"","sources":["../../src/webvh/delegatedLogStore.ts"],"names":[],"mappings":"AAoCA,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACxE,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,EAAE,6BAA6B,E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type { DIDDoc, DIDLog, Signer, VerificationMethod } from '@interop/did-method-webvh';
|
|
2
2
|
import { type ResourceLogHeadPin, type ResourceLogPinStore } from '@interop/vh-resource-log';
|
|
3
3
|
import type { DidWebKeyMap } from './didWeb.js';
|
|
4
|
+
export { assertPublishedLogDid } from './verifyLog.js';
|
|
4
5
|
/**
|
|
5
6
|
* The Space-side seam this module reads and writes through: the world-readable
|
|
6
7
|
* `id` collection (the DID log and document) and the private `key-map`
|
|
@@ -88,6 +89,23 @@ export interface WebvhIdStore {
|
|
|
88
89
|
}): Promise<{
|
|
89
90
|
etag?: string;
|
|
90
91
|
} | void>;
|
|
92
|
+
/**
|
|
93
|
+
* The chain-head pin for the log this store serves: the caller's keyed
|
|
94
|
+
* {@link ResourceLogPinStore} plus the slot this log occupies in it
|
|
95
|
+
* (`accountLogPinId({ spaceId })` for the account log; a store over
|
|
96
|
+
* another collection's `did.jsonl` derives its own slot the same way). A
|
|
97
|
+
* property of the store rather than an argument of every read and publish,
|
|
98
|
+
* so no ceremony can read the log unpinned or publish an entry without
|
|
99
|
+
* advancing the pin: {@link readPublishedLog} refuses a served rollback,
|
|
100
|
+
* fork, or SCID / method switch against it, and {@link putLogResource}
|
|
101
|
+
* advances it to every log this store publishes. The constructors derive
|
|
102
|
+
* the slot from the collection they serve, so no caller pairs a store with
|
|
103
|
+
* the wrong slot.
|
|
104
|
+
*/
|
|
105
|
+
pin: {
|
|
106
|
+
store: ResourceLogPinStore;
|
|
107
|
+
logId: string;
|
|
108
|
+
};
|
|
91
109
|
}
|
|
92
110
|
/**
|
|
93
111
|
* The Multikey verification-method type the did:webvh data model uses for both
|
|
@@ -373,9 +391,9 @@ export declare function didWebvhControllerTemplate({ wasServerUrl, spaceId, coll
|
|
|
373
391
|
* only update authority the log will ever accept, so they must be persisted
|
|
374
392
|
* client-local before {@link ensureDidWebvh} publishes anything.
|
|
375
393
|
*
|
|
376
|
-
* @returns {
|
|
394
|
+
* @returns {ClientWebvhUpdateKeys}
|
|
377
395
|
*/
|
|
378
|
-
export declare function mintClientWebvhUpdateKeys():
|
|
396
|
+
export declare function mintClientWebvhUpdateKeys(): ClientWebvhUpdateKeys;
|
|
379
397
|
/**
|
|
380
398
|
* The `publicKeyMultibase` of the Ed25519 update key a seed derives, as it
|
|
381
399
|
* appears in the log's `parameters.updateKeys`.
|
|
@@ -514,6 +532,25 @@ export declare class WebvhLogConflictError extends Error {
|
|
|
514
532
|
* @returns {Promise<*>} whatever the ceremony returns
|
|
515
533
|
*/
|
|
516
534
|
export declare function withLogConflictRetry<T>(run: () => Promise<T>): Promise<T>;
|
|
535
|
+
/**
|
|
536
|
+
* The threaded-head attempt every entry writer that saved a read shares. A caller that
|
|
537
|
+
* already read and verified the head under this same pin slot gets ONE
|
|
538
|
+
* attempt built on it; a lost compare-and-swap there says only that the head
|
|
539
|
+
* is stale, so the conflict retry re-reads under the pin with its whole
|
|
540
|
+
* budget. Every other failure is the caller's. The threaded attempt is EXTRA
|
|
541
|
+
* rather than one of the retry's three, so a caller who saved a read is left
|
|
542
|
+
* with the same conflict budget as one who did not.
|
|
543
|
+
*
|
|
544
|
+
* @param options {object}
|
|
545
|
+
* @param [options.published] {PublishedWebvhLog} the caller's threaded head
|
|
546
|
+
* @param options.attempt {Function} one attempt of the ceremony, taking the
|
|
547
|
+
* head to build on (absent, the attempt reads for itself)
|
|
548
|
+
* @returns {Promise<Result>}
|
|
549
|
+
*/
|
|
550
|
+
export declare function withThreadedHeadOnce<Result>({ published, attempt }: {
|
|
551
|
+
published?: PublishedWebvhLog;
|
|
552
|
+
attempt: (published?: PublishedWebvhLog) => Promise<Result>;
|
|
553
|
+
}): Promise<Result>;
|
|
517
554
|
/**
|
|
518
555
|
* PUTs the serialized log to `did.jsonl`, forwarding the conditional-write
|
|
519
556
|
* preconditions and mapping a failed one to {@link WebvhLogConflictError}. The
|
|
@@ -522,8 +559,18 @@ export declare function withLogConflictRetry<T>(run: () => Promise<T>): Promise<
|
|
|
522
559
|
* keeping the check implementation-agnostic. With neither precondition the PUT
|
|
523
560
|
* is unconditional -- the degradation on a backend that serves no ETags.
|
|
524
561
|
*
|
|
562
|
+
* A successful write advances the store's chain-head pin to the log just
|
|
563
|
+
* published, so a host rolling the log back straight afterwards is refused
|
|
564
|
+
* on the next read. The write and the advance are one function on purpose:
|
|
565
|
+
* separating them is what leaves a pin standing behind an entry this client
|
|
566
|
+
* itself published. The pin write still lands after the PUT, not with it, so
|
|
567
|
+
* a client torn between the two holds a pin behind its own entry; that
|
|
568
|
+
* one-request window is what `BuiltOnHeadNotReachedError` still guards on a
|
|
569
|
+
* resume. Every log publish in this library (the create, the rotation, every
|
|
570
|
+
* ceremony entry) runs through here.
|
|
571
|
+
*
|
|
525
572
|
* @param options {object}
|
|
526
|
-
* @param options.store {object}
|
|
573
|
+
* @param options.store {object} the seam's `putIdResource` and its `pin`
|
|
527
574
|
* @param options.log {DIDLog}
|
|
528
575
|
* @param [options.ifMatch] {string} publish only if the log is unchanged
|
|
529
576
|
* @param [options.ifNoneMatch] {boolean} publish only if the log is absent
|
|
@@ -532,7 +579,7 @@ export declare function withLogConflictRetry<T>(run: () => Promise<T>): Promise<
|
|
|
532
579
|
* backend that serves no ETags
|
|
533
580
|
*/
|
|
534
581
|
export declare function putLogResource({ store, log, ifMatch, ifNoneMatch }: {
|
|
535
|
-
store: Pick<WebvhIdStore, 'putIdResource'>;
|
|
582
|
+
store: Pick<WebvhIdStore, 'putIdResource' | 'pin'>;
|
|
536
583
|
log: DIDLog;
|
|
537
584
|
ifMatch?: string;
|
|
538
585
|
ifNoneMatch?: boolean;
|
|
@@ -542,7 +589,7 @@ export declare function putLogResource({ store, log, ifMatch, ifNoneMatch }: {
|
|
|
542
589
|
/**
|
|
543
590
|
* THE POSTAMBLE: publishes `did.jsonl` -- the log only, never `did.json` (a
|
|
544
591
|
* caller writing through a bridge delegation is authorized for nothing else)
|
|
545
|
-
* -- and advances the
|
|
592
|
+
* -- and advances the store's chain-head pin to what it just published, so a
|
|
546
593
|
* host rolling the log back straight afterwards is refused on the next read.
|
|
547
594
|
*
|
|
548
595
|
* So an entry published here leaves the `did:web` projection standing at
|
|
@@ -556,27 +603,21 @@ export declare function putLogResource({ store, log, ifMatch, ifNoneMatch }: {
|
|
|
556
603
|
* surfaces as a {@link WebvhLogConflictError} (the mapping lives in
|
|
557
604
|
* {@link putLogResource}).
|
|
558
605
|
*
|
|
559
|
-
* The
|
|
560
|
-
*
|
|
561
|
-
*
|
|
562
|
-
* compensating class.
|
|
606
|
+
* The pin advance is {@link putLogResource}'s own, since the pin is a member
|
|
607
|
+
* of the store; this name is the ladder-signed ceremonies' statement that
|
|
608
|
+
* their publish is the log-only one.
|
|
563
609
|
*
|
|
564
610
|
* @param options {object}
|
|
565
|
-
* @param options.store {object}
|
|
611
|
+
* @param options.store {object} the seam's `putIdResource` and its `pin`
|
|
566
612
|
* @param options.log {DIDLog} the log this entry produced
|
|
567
613
|
* @param [options.ifMatch] {string} publish only if `did.jsonl` is unchanged
|
|
568
|
-
* @param [options.pinStore] {ResourceLogPinStore} the caller's chain-head
|
|
569
|
-
* pins; the pin advances only when a `logId` names its slot
|
|
570
|
-
* @param [options.logId] {string} the log's pin slot
|
|
571
614
|
* @returns {Promise<{ etag?: string }>} the new validator of the log this
|
|
572
615
|
* entry just published, for a stage building on the post-entry head
|
|
573
616
|
*/
|
|
574
|
-
export declare function publishEntryPinned({ store, log, ifMatch
|
|
575
|
-
store: Pick<WebvhIdStore, 'putIdResource'>;
|
|
617
|
+
export declare function publishEntryPinned({ store, log, ifMatch }: {
|
|
618
|
+
store: Pick<WebvhIdStore, 'putIdResource' | 'pin'>;
|
|
576
619
|
log: DIDLog;
|
|
577
620
|
ifMatch?: string;
|
|
578
|
-
pinStore?: ResourceLogPinStore;
|
|
579
|
-
logId?: string;
|
|
580
621
|
}): Promise<{
|
|
581
622
|
etag?: string;
|
|
582
623
|
}>;
|
|
@@ -731,10 +772,10 @@ export interface PublishedWebvhLog {
|
|
|
731
772
|
* hold the account pointer (or an earlier read of the same log, mid-ceremony)
|
|
732
773
|
* pass it; a caller discovering the DID from the log itself cannot.
|
|
733
774
|
*
|
|
734
|
-
*
|
|
735
|
-
*
|
|
736
|
-
* class: a served log that is a rollback, a fork, or an
|
|
737
|
-
* relative to the pinned head is refused with a
|
|
775
|
+
* The resolved log takes the same chain-head continuity check
|
|
776
|
+
* `verifyAccountLog` runs, against the store's own pin, through literally the
|
|
777
|
+
* same seam and refusal class: a served log that is a rollback, a fork, or an
|
|
778
|
+
* SCID/method switch relative to the pinned head is refused with a
|
|
738
779
|
* {@link ResourceLogContinuityError} rather than built on, and the pin is
|
|
739
780
|
* established at first contact and advanced only by a log that verifies past
|
|
740
781
|
* it. This is what stops a host from feeding a ceremony a valid PREFIX of the
|
|
@@ -747,43 +788,23 @@ export interface PublishedWebvhLog {
|
|
|
747
788
|
* refused as a `rollback` instead of read as `undefined`.
|
|
748
789
|
*
|
|
749
790
|
* @param options {object}
|
|
750
|
-
* @param options.idStore {Pick<WebvhIdStore, 'getIdResourceRaw'>}
|
|
751
|
-
* half of the seam
|
|
752
|
-
* delegation's read + PUT pair) passes it directly
|
|
791
|
+
* @param options.idStore {Pick<WebvhIdStore, 'getIdResourceRaw' | 'pin'>}
|
|
792
|
+
* the read half of the seam plus its pin, so a caller holding a narrower
|
|
793
|
+
* store (a bridge delegation's read + PUT pair) passes it directly
|
|
753
794
|
* @param [options.expectedDid] {string} the DID the log must resolve to
|
|
754
|
-
* @param [options.
|
|
755
|
-
*
|
|
756
|
-
*
|
|
757
|
-
*
|
|
795
|
+
* @param [options.absentUnderPin] {'refuse' | 'absent'} what an absent log
|
|
796
|
+
* under a held pin reads as: `refuse` (the default, the account log's
|
|
797
|
+
* rule above) throws the `rollback` refusal; `absent` resolves `undefined`
|
|
798
|
+
* and leaves the pin standing, for a log that is deleted by design (an
|
|
799
|
+
* annex generation). A served log that falls behind the pin stays refused
|
|
800
|
+
* under both
|
|
758
801
|
* @returns {Promise<PublishedWebvhLog | undefined>}
|
|
759
802
|
*/
|
|
760
|
-
export declare function readPublishedLog({ idStore, expectedDid,
|
|
761
|
-
idStore: Pick<WebvhIdStore, 'getIdResourceRaw'>;
|
|
803
|
+
export declare function readPublishedLog({ idStore, expectedDid, absentUnderPin }: {
|
|
804
|
+
idStore: Pick<WebvhIdStore, 'getIdResourceRaw' | 'pin'>;
|
|
762
805
|
expectedDid?: string;
|
|
763
|
-
|
|
764
|
-
logId?: string;
|
|
806
|
+
absentUnderPin?: 'refuse' | 'absent';
|
|
765
807
|
}): Promise<PublishedWebvhLog | undefined>;
|
|
766
|
-
/**
|
|
767
|
-
* The substituted-account refusal on its own: a resolved head that is not the
|
|
768
|
-
* DID the caller expected is refused rather than built on. Stated once so a
|
|
769
|
-
* fresh read and a caller-threaded head refuse identically.
|
|
770
|
-
*
|
|
771
|
-
* A ceremony that takes an already-read head from its caller (the transient
|
|
772
|
-
* visit's one-read composition, where the readiness stage hands its verified
|
|
773
|
-
* head to the enrollment) runs this explicitly: the read that would otherwise
|
|
774
|
-
* have run it never happened, and a head resolving to another DID must not
|
|
775
|
-
* become the entry's basis just because it arrived by parameter.
|
|
776
|
-
*
|
|
777
|
-
* @param options {object}
|
|
778
|
-
* @param options.published {PublishedWebvhLog} the resolved head
|
|
779
|
-
* @param [options.expectedDid] {string} the DID it must resolve to; absent,
|
|
780
|
-
* the head is accepted (the caller discovering the DID from the log itself)
|
|
781
|
-
* @returns {PublishedWebvhLog} the head verbatim
|
|
782
|
-
*/
|
|
783
|
-
export declare function assertPublishedLogDid({ published, expectedDid }: {
|
|
784
|
-
published: PublishedWebvhLog;
|
|
785
|
-
expectedDid?: string;
|
|
786
|
-
}): PublishedWebvhLog;
|
|
787
808
|
/**
|
|
788
809
|
* {@link readPublishedLog} for the ceremonies whose premise is a log that
|
|
789
810
|
* already exists: an absent `did.jsonl` is a refusal rather than a state to
|
|
@@ -800,21 +821,15 @@ export declare function assertPublishedLogDid({ published, expectedDid }: {
|
|
|
800
821
|
* an orchestrator's pre-read.
|
|
801
822
|
*
|
|
802
823
|
* @param options {object}
|
|
803
|
-
* @param options.idStore {Pick<WebvhIdStore, 'getIdResourceRaw'>}
|
|
824
|
+
* @param options.idStore {Pick<WebvhIdStore, 'getIdResourceRaw' | 'pin'>}
|
|
804
825
|
* @param [options.expectedDid] {string} the DID the log must resolve to
|
|
805
|
-
* @param [options.pinStore] {ResourceLogPinStore} this client's chain-head
|
|
806
|
-
* pins for the log being read
|
|
807
|
-
* @param [options.logId] {string} the log's pin-slot key; required whenever
|
|
808
|
-
* a `pinStore` is supplied
|
|
809
826
|
* @param [options.missingMessage] {string} the thrown `Error`'s message when
|
|
810
827
|
* the log is absent
|
|
811
828
|
* @returns {Promise<PublishedWebvhLog>}
|
|
812
829
|
*/
|
|
813
|
-
export declare function readPublishedLogOrThrow({ idStore, expectedDid,
|
|
814
|
-
idStore: Pick<WebvhIdStore, 'getIdResourceRaw'>;
|
|
830
|
+
export declare function readPublishedLogOrThrow({ idStore, expectedDid, missingMessage }: {
|
|
831
|
+
idStore: Pick<WebvhIdStore, 'getIdResourceRaw' | 'pin'>;
|
|
815
832
|
expectedDid?: string;
|
|
816
|
-
pinStore?: ResourceLogPinStore;
|
|
817
|
-
logId?: string;
|
|
818
833
|
missingMessage?: string;
|
|
819
834
|
}): Promise<PublishedWebvhLog>;
|
|
820
835
|
/**
|
|
@@ -937,13 +952,14 @@ export declare function currentLogParameters(published: {
|
|
|
937
952
|
*
|
|
938
953
|
* The probe read is checked against the DID this run expects -- a caller's
|
|
939
954
|
* `expectedDid`, else the `webvh` block of the `keys.json` it was handed -- and
|
|
940
|
-
* against
|
|
941
|
-
* prefix of the real one can be adopted here. One exemption, and it
|
|
942
|
-
* documented first-contact case: an adoption holding neither a
|
|
943
|
-
* `expectedDid` nor a `keys.json` webvh block legitimately
|
|
944
|
-
* from the log itself, and
|
|
945
|
-
*
|
|
946
|
-
*
|
|
955
|
+
* against the store's chain-head pin, so neither a substituted log nor a
|
|
956
|
+
* truncated prefix of the real one can be adopted here. One exemption, and it
|
|
957
|
+
* is the documented first-contact case: an adoption holding neither a
|
|
958
|
+
* caller-supplied `expectedDid` nor a `keys.json` webvh block legitimately
|
|
959
|
+
* discovers the DID from the log itself, and its read is what establishes the
|
|
960
|
+
* pin (trust-on-first-use). On the create path the pin is written to the log
|
|
961
|
+
* this run just published, since the creator knows the true genesis and first
|
|
962
|
+
* contact should not be left to the next read.
|
|
947
963
|
*
|
|
948
964
|
* @param options {object}
|
|
949
965
|
* @param options.idStore {WebvhIdStore}
|
|
@@ -959,9 +975,6 @@ export declare function currentLogParameters(published: {
|
|
|
959
975
|
* client-local
|
|
960
976
|
* @param [options.expectedDid] {string} the DID the published log must
|
|
961
977
|
* resolve to, when the caller holds the account pointer
|
|
962
|
-
* @param [options.pinStore] {ResourceLogPinStore} this client's chain-head
|
|
963
|
-
* pins; the account log's slot is keyed by `accountLogPinId` over the
|
|
964
|
-
* `spaceId` above
|
|
965
978
|
* @returns {Promise<{ did: string }>}
|
|
966
979
|
*/
|
|
967
980
|
export declare function ensureDidWebvh(options: {
|
|
@@ -973,7 +986,6 @@ export declare function ensureDidWebvh(options: {
|
|
|
973
986
|
clientKeys: WebvhClientKeys;
|
|
974
987
|
updateKeys: ClientWebvhUpdateKeys;
|
|
975
988
|
expectedDid?: string;
|
|
976
|
-
pinStore?: ResourceLogPinStore;
|
|
977
989
|
}): Promise<{
|
|
978
990
|
did: string;
|
|
979
991
|
}>;
|
|
@@ -1006,12 +1018,12 @@ export declare function ensureDidWebvh(options: {
|
|
|
1006
1018
|
* seed again -- the documented cost of a torn rotation, one unused staged key.
|
|
1007
1019
|
*
|
|
1008
1020
|
* A rotation is a publish, so the read it builds on carries the full check: an
|
|
1009
|
-
* `expectedDid` refuses a substituted log, and
|
|
1010
|
-
* history that is a rollback, a fork, or an SCID/method
|
|
1011
|
-
* host serving a truncated prefix gets this ceremony to
|
|
1012
|
-
* truncation plus its own entry as the log's durable state. The
|
|
1013
|
-
* to the head this ceremony publishes, so a host that rolls the
|
|
1014
|
-
* immediately afterwards is caught by the next read.
|
|
1021
|
+
* `expectedDid` refuses a substituted log, and the store's chain-head pin
|
|
1022
|
+
* refuses a served history that is a rollback, a fork, or an SCID/method
|
|
1023
|
+
* switch -- without it a host serving a truncated prefix gets this ceremony to
|
|
1024
|
+
* republish the truncation plus its own entry as the log's durable state. The
|
|
1025
|
+
* pin advances to the head this ceremony publishes, so a host that rolls the
|
|
1026
|
+
* log back immediately afterwards is caught by the next read.
|
|
1015
1027
|
*
|
|
1016
1028
|
* @param options {object}
|
|
1017
1029
|
* @param options.idStore {WebvhIdStore}
|
|
@@ -1020,11 +1032,6 @@ export declare function ensureDidWebvh(options: {
|
|
|
1020
1032
|
* that changes the log's authorized update keys
|
|
1021
1033
|
* @param [options.expectedDid] {string} the DID the published log must
|
|
1022
1034
|
* resolve to
|
|
1023
|
-
* @param [options.pinStore] {ResourceLogPinStore} this client's chain-head
|
|
1024
|
-
* pins for the account log
|
|
1025
|
-
* @param [options.logId] {string} the account log's pin-slot key, built by
|
|
1026
|
-
* the caller with `accountLogPinId({ spaceId })`; required whenever a
|
|
1027
|
-
* `pinStore` is supplied
|
|
1028
1035
|
* @returns {Promise<{ did: string }>}
|
|
1029
1036
|
*/
|
|
1030
1037
|
export declare function rotateWebvhUpdateKey(options: {
|
|
@@ -1032,8 +1039,6 @@ export declare function rotateWebvhUpdateKey(options: {
|
|
|
1032
1039
|
updateKeys: ClientWebvhUpdateKeys;
|
|
1033
1040
|
persistUpdateKeys: (next: ClientWebvhUpdateKeys) => Promise<void>;
|
|
1034
1041
|
expectedDid?: string;
|
|
1035
|
-
pinStore?: ResourceLogPinStore;
|
|
1036
|
-
logId?: string;
|
|
1037
1042
|
}): Promise<{
|
|
1038
1043
|
did: string;
|
|
1039
1044
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"didWebvh.d.ts","sourceRoot":"","sources":["../../src/webvh/didWebvh.ts"],"names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