@interop/wallet-core 0.51.0 → 0.52.1
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 +7 -11
- package/dist/clientAnnex/credentialAnchoredGenesis.d.ts +2 -2
- package/dist/clientAnnex/credentialAnchoredGenesis.d.ts.map +1 -1
- package/dist/clientAnnex/credentialAnchoredGenesis.js +1 -1
- package/dist/clientAnnex/forget.d.ts +18 -6
- package/dist/clientAnnex/forget.d.ts.map +1 -1
- package/dist/clientAnnex/forget.js +19 -6
- package/dist/clientAnnex/forget.js.map +1 -1
- package/dist/clientAnnex/forgetLast.d.ts +33 -20
- package/dist/clientAnnex/forgetLast.d.ts.map +1 -1
- package/dist/clientAnnex/forgetLast.js +43 -17
- package/dist/clientAnnex/forgetLast.js.map +1 -1
- package/dist/clientAnnex/gc.d.ts +3 -3
- package/dist/clientAnnex/gc.d.ts.map +1 -1
- package/dist/clientAnnex/gc.js +2 -2
- package/dist/clientAnnex/gc.js.map +1 -1
- package/dist/clientAnnex/index.d.ts +5 -5
- package/dist/clientAnnex/index.d.ts.map +1 -1
- package/dist/clientAnnex/index.js +4 -4
- package/dist/clientAnnex/index.js.map +1 -1
- package/dist/clientAnnex/ladder.d.ts +19 -11
- package/dist/clientAnnex/ladder.d.ts.map +1 -1
- package/dist/clientAnnex/ladder.js +77 -14
- package/dist/clientAnnex/ladder.js.map +1 -1
- package/dist/clientAnnex/ladderAnchored.d.ts +36 -7
- package/dist/clientAnnex/ladderAnchored.d.ts.map +1 -1
- package/dist/clientAnnex/ladderAnchored.js +80 -18
- package/dist/clientAnnex/ladderAnchored.js.map +1 -1
- package/dist/clientAnnex/log.d.ts +6 -6
- package/dist/clientAnnex/log.d.ts.map +1 -1
- package/dist/clientAnnex/log.js +8 -8
- package/dist/clientAnnex/log.js.map +1 -1
- package/dist/clientAnnex/recoveryLadderAnchored.d.ts +7 -7
- package/dist/clientAnnex/recoveryLadderAnchored.js +9 -9
- package/dist/clientAnnex/recoveryLadderAnchored.js.map +1 -1
- package/dist/clientAnnex/selfEnroll.d.ts +6 -4
- package/dist/clientAnnex/selfEnroll.d.ts.map +1 -1
- package/dist/clientAnnex/selfEnroll.js +19 -7
- package/dist/clientAnnex/selfEnroll.js.map +1 -1
- package/dist/clients/listing.d.ts +1 -1
- package/dist/clients/listing.d.ts.map +1 -1
- package/dist/clients/listing.js +1 -1
- package/dist/clients/listing.js.map +1 -1
- package/dist/clients/revocation.d.ts +1 -1
- package/dist/clients/rosterPolicy.d.ts +1 -1
- package/dist/clients/rosterPolicy.d.ts.map +1 -1
- package/dist/descriptors/acquire.js +1 -1
- package/dist/descriptors/logSource.d.ts +1 -2
- package/dist/descriptors/logSource.d.ts.map +1 -1
- package/dist/descriptors/logSource.js +2 -2
- package/dist/descriptors/logSource.js.map +1 -1
- package/dist/enrollment/enrollment.d.ts +1 -1
- package/dist/enrollment/enrollment.d.ts.map +1 -1
- package/dist/enrollment/enrollment.js +2 -1
- package/dist/enrollment/enrollment.js.map +1 -1
- package/dist/genesis/accountGenesis.d.ts +1 -1
- package/dist/genesis/accountGenesis.d.ts.map +1 -1
- package/dist/genesis/accountGenesis.js +1 -1
- package/dist/index.d.ts +1 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -3
- package/dist/index.js.map +1 -1
- package/dist/keyring/kdf.d.ts +6 -20
- package/dist/keyring/kdf.d.ts.map +1 -1
- package/dist/keyring/kdf.js +8 -5
- package/dist/keyring/kdf.js.map +1 -1
- package/dist/keyring/unlockSpace.js +1 -1
- package/dist/keys/rosterLogStore.d.ts +16 -14
- package/dist/keys/rosterLogStore.d.ts.map +1 -1
- package/dist/keys/rosterLogStore.js +149 -32
- package/dist/keys/rosterLogStore.js.map +1 -1
- package/dist/keys/rosterStore.d.ts +8 -7
- package/dist/keys/rosterStore.d.ts.map +1 -1
- package/dist/keys/rosterStore.js +6 -6
- package/dist/keys/rosterStore.js.map +1 -1
- package/dist/keys/spaceEpochs.d.ts +1 -1
- package/dist/keys/spaceEpochs.js +1 -1
- package/dist/keys/userKeyRoster.d.ts +3 -3
- package/dist/keys/userKeyRoster.d.ts.map +1 -1
- package/dist/keys/userKeyRoster.js +3 -3
- package/dist/keys/userKeyRoster.js.map +1 -1
- package/dist/recovery/index.d.ts +2 -2
- package/dist/recovery/index.js +2 -2
- package/dist/recovery/recoveryDelegation.js +1 -1
- package/dist/recovery/recoveryDelegation.js.map +1 -1
- package/dist/recovery/recoveryWebvh.d.ts +4 -4
- package/dist/recovery/recoveryWebvh.js +5 -5
- package/dist/request/appKey.d.ts +9 -3
- package/dist/request/appKey.d.ts.map +1 -1
- package/dist/request/appKey.js +13 -8
- package/dist/request/appKey.js.map +1 -1
- package/dist/request/classify.d.ts.map +1 -1
- package/dist/request/classify.js +13 -1
- package/dist/request/classify.js.map +1 -1
- package/dist/request/ephemeralExchange.d.ts +6 -1
- package/dist/request/ephemeralExchange.d.ts.map +1 -1
- package/dist/request/ephemeralExchange.js +6 -1
- package/dist/request/ephemeralExchange.js.map +1 -1
- package/dist/request/exchangeClient.d.ts +0 -23
- package/dist/request/exchangeClient.d.ts.map +1 -1
- package/dist/request/exchangeClient.js +30 -1
- package/dist/request/exchangeClient.js.map +1 -1
- package/dist/request/index.d.ts +4 -1
- package/dist/request/index.d.ts.map +1 -1
- package/dist/request/index.js +4 -1
- package/dist/request/index.js.map +1 -1
- package/dist/request/interactionRequest.d.ts +23 -0
- package/dist/request/interactionRequest.d.ts.map +1 -0
- package/dist/request/interactionRequest.js +46 -0
- package/dist/request/interactionRequest.js.map +1 -0
- package/dist/request/interactionUrl.d.ts +3 -14
- package/dist/request/interactionUrl.d.ts.map +1 -1
- package/dist/request/interactionUrl.js +20 -1
- package/dist/request/interactionUrl.js.map +1 -1
- package/dist/resourceLog/controller.d.ts +48 -49
- package/dist/resourceLog/controller.d.ts.map +1 -1
- package/dist/resourceLog/controller.js +40 -20
- package/dist/resourceLog/controller.js.map +1 -1
- package/dist/resourceLog/errors.d.ts +12 -78
- package/dist/resourceLog/errors.d.ts.map +1 -1
- package/dist/resourceLog/errors.js +12 -79
- package/dist/resourceLog/errors.js.map +1 -1
- package/dist/resourceLog/index.d.ts +17 -22
- package/dist/resourceLog/index.d.ts.map +1 -1
- package/dist/resourceLog/index.js +16 -21
- package/dist/resourceLog/index.js.map +1 -1
- package/dist/resourceLog/license.d.ts +27 -26
- package/dist/resourceLog/license.d.ts.map +1 -1
- package/dist/resourceLog/license.js +31 -30
- package/dist/resourceLog/license.js.map +1 -1
- package/dist/unlock/index.d.ts +6 -6
- package/dist/unlock/index.d.ts.map +1 -1
- package/dist/unlock/index.js +5 -5
- package/dist/unlock/retire.d.ts +29 -28
- package/dist/unlock/retire.d.ts.map +1 -1
- package/dist/unlock/retire.js +25 -16
- package/dist/unlock/retire.js.map +1 -1
- package/dist/unlock/standingClient.d.ts +1 -1
- package/dist/unlock/standingClient.js +3 -3
- package/dist/unlock/standingWebvh.d.ts +28 -10
- package/dist/unlock/standingWebvh.d.ts.map +1 -1
- package/dist/unlock/standingWebvh.js +75 -37
- package/dist/unlock/standingWebvh.js.map +1 -1
- package/dist/unlock/unlockRecord.js +1 -1
- package/dist/webvh/delegatedLogStore.d.ts +2 -2
- package/dist/webvh/delegatedLogStore.js +2 -2
- package/dist/webvh/didWeb.js +1 -1
- package/dist/webvh/didWeb.js.map +1 -1
- package/dist/webvh/didWebvh.d.ts +3 -3
- package/dist/webvh/didWebvh.d.ts.map +1 -1
- package/dist/webvh/didWebvh.js +5 -5
- package/dist/webvh/didWebvh.js.map +1 -1
- package/dist/webvh/listClients.js +1 -1
- package/dist/webvh/listClients.js.map +1 -1
- package/dist/webvh/verifyLog.d.ts +1 -1
- package/dist/webvh/verifyLog.d.ts.map +1 -1
- package/dist/webvh/verifyLog.js +1 -2
- package/dist/webvh/verifyLog.js.map +1 -1
- package/package.json +5 -9
- package/dist/display/alignment.d.ts +0 -55
- package/dist/display/alignment.d.ts.map +0 -1
- package/dist/display/alignment.js +0 -117
- package/dist/display/alignment.js.map +0 -1
- package/dist/display/credentialName.d.ts +0 -42
- package/dist/display/credentialName.d.ts.map +0 -1
- package/dist/display/credentialName.js +0 -106
- package/dist/display/credentialName.js.map +0 -1
- package/dist/display/displayFields.d.ts +0 -59
- package/dist/display/displayFields.d.ts.map +0 -1
- package/dist/display/displayFields.js +0 -136
- package/dist/display/displayFields.js.map +0 -1
- package/dist/display/evidence.d.ts +0 -50
- package/dist/display/evidence.d.ts.map +0 -1
- package/dist/display/evidence.js +0 -67
- package/dist/display/evidence.js.map +0 -1
- package/dist/display/image.d.ts +0 -18
- package/dist/display/image.d.ts.map +0 -1
- package/dist/display/image.js +0 -23
- package/dist/display/image.js.map +0 -1
- package/dist/display/index.d.ts +0 -38
- package/dist/display/index.d.ts.map +0 -1
- package/dist/display/index.js +0 -32
- package/dist/display/index.js.map +0 -1
- package/dist/display/issuer.d.ts +0 -105
- package/dist/display/issuer.d.ts.map +0 -1
- package/dist/display/issuer.js +0 -126
- package/dist/display/issuer.js.map +0 -1
- package/dist/display/obv3.d.ts +0 -82
- package/dist/display/obv3.d.ts.map +0 -1
- package/dist/display/obv3.js +0 -117
- package/dist/display/obv3.js.map +0 -1
- package/dist/display/parse.d.ts +0 -66
- package/dist/display/parse.d.ts.map +0 -1
- package/dist/display/parse.js +0 -104
- package/dist/display/parse.js.map +0 -1
- package/dist/display/subject.d.ts +0 -79
- package/dist/display/subject.d.ts.map +0 -1
- package/dist/display/subject.js +0 -124
- package/dist/display/subject.js.map +0 -1
- package/dist/display/text.d.ts +0 -53
- package/dist/display/text.d.ts.map +0 -1
- package/dist/display/text.js +0 -78
- package/dist/display/text.js.map +0 -1
- package/dist/display/types.d.ts +0 -55
- package/dist/display/types.d.ts.map +0 -1
- package/dist/display/types.js +0 -41
- package/dist/display/types.js.map +0 -1
- package/dist/display/validity.d.ts +0 -51
- package/dist/display/validity.d.ts.map +0 -1
- package/dist/display/validity.js +0 -51
- package/dist/display/validity.js.map +0 -1
- package/dist/display/verificationView.d.ts +0 -115
- package/dist/display/verificationView.d.ts.map +0 -1
- package/dist/display/verificationView.js +0 -199
- package/dist/display/verificationView.js.map +0 -1
- package/dist/resourceLog/append.d.ts +0 -112
- package/dist/resourceLog/append.d.ts.map +0 -1
- package/dist/resourceLog/append.js +0 -197
- package/dist/resourceLog/append.js.map +0 -1
- package/dist/resourceLog/entry.d.ts +0 -68
- package/dist/resourceLog/entry.d.ts.map +0 -1
- package/dist/resourceLog/entry.js +0 -167
- package/dist/resourceLog/entry.js.map +0 -1
- package/dist/resourceLog/pin.d.ts +0 -82
- package/dist/resourceLog/pin.d.ts.map +0 -1
- package/dist/resourceLog/pin.js +0 -57
- package/dist/resourceLog/pin.js.map +0 -1
- package/dist/resourceLog/seal.d.ts +0 -97
- package/dist/resourceLog/seal.d.ts.map +0 -1
- package/dist/resourceLog/seal.js +0 -113
- package/dist/resourceLog/seal.js.map +0 -1
- package/dist/resourceLog/verify.d.ts +0 -96
- package/dist/resourceLog/verify.d.ts.map +0 -1
- package/dist/resourceLog/verify.js +0 -474
- package/dist/resourceLog/verify.js.map +0 -1
- package/dist/resourceLog/vmFragment.d.ts +0 -33
- package/dist/resourceLog/vmFragment.d.ts.map +0 -1
- package/dist/resourceLog/vmFragment.js +0 -39
- package/dist/resourceLog/vmFragment.js.map +0 -1
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* The sealing sweep (App Connect spec `#log-authorization`): after a
|
|
6
|
-
* controller-document edit removes a member's append authority, every
|
|
7
|
-
* co-managed resource log must gain an entry anchored at (or past) the
|
|
8
|
-
* post-removal document version -- the "sealing append" that proves the
|
|
9
|
-
* surviving writers extended the log under the new membership. An ordinary
|
|
10
|
-
* post-edit write (a roster rotation) is that append by construction; the gap
|
|
11
|
-
* this module closes is the run where no such write happens -- a rotation
|
|
12
|
-
* that no-ops because the retiree held no current-epoch wrap (an orphan
|
|
13
|
-
* client, or any re-run), leaving the log's head still anchored pre-removal.
|
|
14
|
-
*
|
|
15
|
-
* Both halves are computed from durable state alone, keeping every cascade's
|
|
16
|
-
* no-checkpoint convergence rule: the membership change is read off the
|
|
17
|
-
* controller view (the latest version whose `assertionMethod` set lost a
|
|
18
|
-
* member against its predecessor -- only assertion removals affect append
|
|
19
|
-
* authority, so a spent recovery code's `keyAgreement`-only method never
|
|
20
|
-
* registers here), and the log's side is the verified head's effective anchor
|
|
21
|
-
* ({@link VerifiedResourceLog}`.headAnchorIndex`). "Sealed" is simply "head
|
|
22
|
-
* anchor at or past the removal", so the backstop append is idempotent and a
|
|
23
|
-
* torn sweep is finished by a naive re-run.
|
|
24
|
-
*/
|
|
25
|
-
import type { ResourceLogStore } from '@interop/was-client/log';
|
|
26
|
-
import type { ResourceLogController } from './controller.js';
|
|
27
|
-
import type { ResourceLogSigner } from './entry.js';
|
|
28
|
-
import type { ResourceLogPinStore } from './pin.js';
|
|
29
|
-
import type { VerifiedResourceLog } from './verify.js';
|
|
30
|
-
/**
|
|
31
|
-
* The controller's latest membership change: the largest index into
|
|
32
|
-
* `controller.versionIds` whose `assertionMethod` key set LOST a member
|
|
33
|
-
* against its predecessor's, or `0` when no version ever removed one (the
|
|
34
|
-
* genesis version has no predecessor and can never register as a removal, so
|
|
35
|
-
* `0` doubles as "nothing to seal against" -- every anchor satisfies it). An
|
|
36
|
-
* unversioned controller resolves `0` for the same reason: with no version
|
|
37
|
-
* history there is no removal to locate.
|
|
38
|
-
*
|
|
39
|
-
* @param options {object}
|
|
40
|
-
* @param options.controller {ResourceLogController} the verified controller
|
|
41
|
-
* view
|
|
42
|
-
* @returns {Promise<number>}
|
|
43
|
-
*/
|
|
44
|
-
export declare function latestAssertionRemovalIndex({ controller }: {
|
|
45
|
-
controller: ResourceLogController;
|
|
46
|
-
}): Promise<number>;
|
|
47
|
-
/**
|
|
48
|
-
* Seals one resource log against the controller's latest membership change,
|
|
49
|
-
* idempotently: when the verified head already anchors at or past the latest
|
|
50
|
-
* `assertionMethod` removal (or the controller never removed one, or the log
|
|
51
|
-
* does not exist yet, or the controller is unversioned) nothing is written;
|
|
52
|
-
* otherwise the head state is re-appended VERBATIM as a no-op entry whose
|
|
53
|
-
* only job is its post-removal anchor -- ordinary entries may repeat state
|
|
54
|
-
* (only terminal entries are state-constrained), so the resource itself is
|
|
55
|
-
* untouched. A closed log that needs sealing propagates the append path's
|
|
56
|
-
* `ResourceLogClosedError`.
|
|
57
|
-
*
|
|
58
|
-
* `sealed` reports whether this call found the log unsealed (and it now is,
|
|
59
|
-
* by this call's append or a concurrent writer's -- the rebase hook converges
|
|
60
|
-
* rather than duplicating); `verified` is the log as last verified, `null`
|
|
61
|
-
* when it was never read (absent, or nothing to seal against).
|
|
62
|
-
*
|
|
63
|
-
* @param options {object}
|
|
64
|
-
* @param options.store {ResourceLogStore} the log's transport seam
|
|
65
|
-
* @param options.controller {ResourceLogController} the verified controller
|
|
66
|
-
* view
|
|
67
|
-
* @param options.expectedMethod {string} the format identifier expected
|
|
68
|
-
* @param options.pinStore {ResourceLogPinStore} this client's chain-head
|
|
69
|
-
* pin for this log
|
|
70
|
-
* @param options.logId {string} the pin-slot key for this log, from
|
|
71
|
-
* `resourceLogPinId`
|
|
72
|
-
* @param options.signer {ResourceLogSigner} this client's enrolled signing
|
|
73
|
-
* key
|
|
74
|
-
* @param [options.versionTime] {string} RFC3339 UTC; defaults to now
|
|
75
|
-
* @param [options.verified] {VerifiedResourceLog} a log view the caller
|
|
76
|
-
* verified moments ago (the most recent read or confirmed append on the same
|
|
77
|
-
* store), letting the sweep skip its own read. Staleness is safe in both
|
|
78
|
-
* directions: entry anchors are verifier-enforced monotone, so a stale head
|
|
79
|
-
* anchoring at or past the removal means the true head does too, and an
|
|
80
|
-
* unsealed verdict is re-checked by the append path's own read before
|
|
81
|
-
* anything is written
|
|
82
|
-
* @returns {Promise<{ sealed: boolean, verified: VerifiedResourceLog | null }>}
|
|
83
|
-
*/
|
|
84
|
-
export declare function sealResourceLog({ store, controller, expectedMethod, pinStore, logId, signer, versionTime, verified: knownVerified }: {
|
|
85
|
-
store: ResourceLogStore;
|
|
86
|
-
controller: ResourceLogController;
|
|
87
|
-
expectedMethod: string;
|
|
88
|
-
pinStore: ResourceLogPinStore;
|
|
89
|
-
logId: string;
|
|
90
|
-
signer: ResourceLogSigner;
|
|
91
|
-
versionTime?: string;
|
|
92
|
-
verified?: VerifiedResourceLog;
|
|
93
|
-
}): Promise<{
|
|
94
|
-
sealed: boolean;
|
|
95
|
-
verified: VerifiedResourceLog | null;
|
|
96
|
-
}>;
|
|
97
|
-
//# sourceMappingURL=seal.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"seal.d.ts","sourceRoot":"","sources":["../../src/resourceLog/seal.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAE/D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAC5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AACnD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AACnD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAEtD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,2BAA2B,CAAC,EAChD,UAAU,EACX,EAAE;IACD,UAAU,EAAE,qBAAqB,CAAA;CAClC,GAAG,OAAO,CAAC,MAAM,CAAC,CAgBlB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAsB,eAAe,CAAC,EACpC,KAAK,EACL,UAAU,EACV,cAAc,EACd,QAAQ,EACR,KAAK,EACL,MAAM,EACN,WAAW,EACX,QAAQ,EAAE,aAAa,EACxB,EAAE;IACD,KAAK,EAAE,gBAAgB,CAAA;IACvB,UAAU,EAAE,qBAAqB,CAAA;IACjC,cAAc,EAAE,MAAM,CAAA;IACtB,QAAQ,EAAE,mBAAmB,CAAA;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,iBAAiB,CAAA;IACzB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,mBAAmB,CAAA;CAC/B,GAAG,OAAO,CAAC;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,mBAAmB,GAAG,IAAI,CAAA;CAAE,CAAC,CA6CrE"}
|
package/dist/resourceLog/seal.js
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { appendResourceLog, readResourceLog } from './append.js';
|
|
2
|
-
/**
|
|
3
|
-
* The controller's latest membership change: the largest index into
|
|
4
|
-
* `controller.versionIds` whose `assertionMethod` key set LOST a member
|
|
5
|
-
* against its predecessor's, or `0` when no version ever removed one (the
|
|
6
|
-
* genesis version has no predecessor and can never register as a removal, so
|
|
7
|
-
* `0` doubles as "nothing to seal against" -- every anchor satisfies it). An
|
|
8
|
-
* unversioned controller resolves `0` for the same reason: with no version
|
|
9
|
-
* history there is no removal to locate.
|
|
10
|
-
*
|
|
11
|
-
* @param options {object}
|
|
12
|
-
* @param options.controller {ResourceLogController} the verified controller
|
|
13
|
-
* view
|
|
14
|
-
* @returns {Promise<number>}
|
|
15
|
-
*/
|
|
16
|
-
export async function latestAssertionRemovalIndex({ controller }) {
|
|
17
|
-
let removalIndex = 0;
|
|
18
|
-
let previous = null;
|
|
19
|
-
for (const [index, versionId] of controller.versionIds.entries()) {
|
|
20
|
-
const keys = await controller.assertionKeysAt(versionId);
|
|
21
|
-
if (previous !== null) {
|
|
22
|
-
for (const key of previous) {
|
|
23
|
-
if (!keys.has(key)) {
|
|
24
|
-
removalIndex = index;
|
|
25
|
-
break;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
previous = keys;
|
|
30
|
-
}
|
|
31
|
-
return removalIndex;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Seals one resource log against the controller's latest membership change,
|
|
35
|
-
* idempotently: when the verified head already anchors at or past the latest
|
|
36
|
-
* `assertionMethod` removal (or the controller never removed one, or the log
|
|
37
|
-
* does not exist yet, or the controller is unversioned) nothing is written;
|
|
38
|
-
* otherwise the head state is re-appended VERBATIM as a no-op entry whose
|
|
39
|
-
* only job is its post-removal anchor -- ordinary entries may repeat state
|
|
40
|
-
* (only terminal entries are state-constrained), so the resource itself is
|
|
41
|
-
* untouched. A closed log that needs sealing propagates the append path's
|
|
42
|
-
* `ResourceLogClosedError`.
|
|
43
|
-
*
|
|
44
|
-
* `sealed` reports whether this call found the log unsealed (and it now is,
|
|
45
|
-
* by this call's append or a concurrent writer's -- the rebase hook converges
|
|
46
|
-
* rather than duplicating); `verified` is the log as last verified, `null`
|
|
47
|
-
* when it was never read (absent, or nothing to seal against).
|
|
48
|
-
*
|
|
49
|
-
* @param options {object}
|
|
50
|
-
* @param options.store {ResourceLogStore} the log's transport seam
|
|
51
|
-
* @param options.controller {ResourceLogController} the verified controller
|
|
52
|
-
* view
|
|
53
|
-
* @param options.expectedMethod {string} the format identifier expected
|
|
54
|
-
* @param options.pinStore {ResourceLogPinStore} this client's chain-head
|
|
55
|
-
* pin for this log
|
|
56
|
-
* @param options.logId {string} the pin-slot key for this log, from
|
|
57
|
-
* `resourceLogPinId`
|
|
58
|
-
* @param options.signer {ResourceLogSigner} this client's enrolled signing
|
|
59
|
-
* key
|
|
60
|
-
* @param [options.versionTime] {string} RFC3339 UTC; defaults to now
|
|
61
|
-
* @param [options.verified] {VerifiedResourceLog} a log view the caller
|
|
62
|
-
* verified moments ago (the most recent read or confirmed append on the same
|
|
63
|
-
* store), letting the sweep skip its own read. Staleness is safe in both
|
|
64
|
-
* directions: entry anchors are verifier-enforced monotone, so a stale head
|
|
65
|
-
* anchoring at or past the removal means the true head does too, and an
|
|
66
|
-
* unsealed verdict is re-checked by the append path's own read before
|
|
67
|
-
* anything is written
|
|
68
|
-
* @returns {Promise<{ sealed: boolean, verified: VerifiedResourceLog | null }>}
|
|
69
|
-
*/
|
|
70
|
-
export async function sealResourceLog({ store, controller, expectedMethod, pinStore, logId, signer, versionTime, verified: knownVerified }) {
|
|
71
|
-
if (controller.versionIds.length === 0) {
|
|
72
|
-
return { sealed: false, verified: null };
|
|
73
|
-
}
|
|
74
|
-
const removalIndex = await latestAssertionRemovalIndex({ controller });
|
|
75
|
-
if (removalIndex === 0) {
|
|
76
|
-
return { sealed: false, verified: knownVerified ?? null };
|
|
77
|
-
}
|
|
78
|
-
let verified = knownVerified ?? null;
|
|
79
|
-
if (verified === null) {
|
|
80
|
-
const current = await readResourceLog({
|
|
81
|
-
store,
|
|
82
|
-
controller,
|
|
83
|
-
expectedMethod,
|
|
84
|
-
pinStore,
|
|
85
|
-
logId
|
|
86
|
-
});
|
|
87
|
-
if (current === null) {
|
|
88
|
-
return { sealed: false, verified: null };
|
|
89
|
-
}
|
|
90
|
-
verified = current.verified;
|
|
91
|
-
}
|
|
92
|
-
if (verified.headAnchorIndex !== null &&
|
|
93
|
-
verified.headAnchorIndex >= removalIndex) {
|
|
94
|
-
return { sealed: false, verified };
|
|
95
|
-
}
|
|
96
|
-
const confirmed = await appendResourceLog({
|
|
97
|
-
store,
|
|
98
|
-
controller,
|
|
99
|
-
expectedMethod,
|
|
100
|
-
pinStore,
|
|
101
|
-
logId,
|
|
102
|
-
signer,
|
|
103
|
-
// The rebase hook doubles as the convergence check: a concurrent writer
|
|
104
|
-
// whose entry already anchors past the removal sealed the log for us.
|
|
105
|
-
buildState: rebased => rebased.headAnchorIndex !== null &&
|
|
106
|
-
rebased.headAnchorIndex >= removalIndex
|
|
107
|
-
? null
|
|
108
|
-
: rebased.head.state,
|
|
109
|
-
...(versionTime === undefined ? {} : { versionTime })
|
|
110
|
-
});
|
|
111
|
-
return { sealed: true, verified: confirmed };
|
|
112
|
-
}
|
|
113
|
-
//# sourceMappingURL=seal.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"seal.js","sourceRoot":"","sources":["../../src/resourceLog/seal.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAMhE;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAAC,EAChD,UAAU,EAGX;IACC,IAAI,YAAY,GAAG,CAAC,CAAA;IACpB,IAAI,QAAQ,GAAuB,IAAI,CAAA;IACvC,KAAK,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,IAAI,UAAU,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC;QACjE,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,eAAe,CAAC,SAAS,CAAC,CAAA;QACxD,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;YACtB,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;gBAC3B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;oBACnB,YAAY,GAAG,KAAK,CAAA;oBACpB,MAAK;gBACP,CAAC;YACH,CAAC;QACH,CAAC;QACD,QAAQ,GAAG,IAAI,CAAA;IACjB,CAAC;IACD,OAAO,YAAY,CAAA;AACrB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,EACpC,KAAK,EACL,UAAU,EACV,cAAc,EACd,QAAQ,EACR,KAAK,EACL,MAAM,EACN,WAAW,EACX,QAAQ,EAAE,aAAa,EAUxB;IACC,IAAI,UAAU,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAA;IAC1C,CAAC;IACD,MAAM,YAAY,GAAG,MAAM,2BAA2B,CAAC,EAAE,UAAU,EAAE,CAAC,CAAA;IACtE,IAAI,YAAY,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,aAAa,IAAI,IAAI,EAAE,CAAA;IAC3D,CAAC;IACD,IAAI,QAAQ,GAAG,aAAa,IAAI,IAAI,CAAA;IACpC,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QACtB,MAAM,OAAO,GAAG,MAAM,eAAe,CAAC;YACpC,KAAK;YACL,UAAU;YACV,cAAc;YACd,QAAQ;YACR,KAAK;SACN,CAAC,CAAA;QACF,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;YACrB,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAA;QAC1C,CAAC;QACD,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;IAC7B,CAAC;IACD,IACE,QAAQ,CAAC,eAAe,KAAK,IAAI;QACjC,QAAQ,CAAC,eAAe,IAAI,YAAY,EACxC,CAAC;QACD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAA;IACpC,CAAC;IACD,MAAM,SAAS,GAAG,MAAM,iBAAiB,CAAC;QACxC,KAAK;QACL,UAAU;QACV,cAAc;QACd,QAAQ;QACR,KAAK;QACL,MAAM;QACN,wEAAwE;QACxE,sEAAsE;QACtE,UAAU,EAAE,OAAO,CAAC,EAAE,CACpB,OAAO,CAAC,eAAe,KAAK,IAAI;YAChC,OAAO,CAAC,eAAe,IAAI,YAAY;YACrC,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK;QACxB,GAAG,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC;KACtD,CAAC,CAAA;IACF,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAA;AAC9C,CAAC"}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import type { ResourceLogEntry } from '@interop/was-client/log';
|
|
2
|
-
import type { ResourceLogController } from './controller.js';
|
|
3
|
-
import type { ResourceLogHeadPin } from './pin.js';
|
|
4
|
-
/**
|
|
5
|
-
* What full verification resolves to. `state` is the profile's definition of
|
|
6
|
-
* the resource's current state -- the verified head entry's `state` -- and
|
|
7
|
-
* `pin` is the record the caller must store as its new chain-head pin.
|
|
8
|
-
* `terminal` is the head's `nextLog` when the log is closed by a handover
|
|
9
|
-
* entry (appends must be refused), `previousLog` the genesis back-reference
|
|
10
|
-
* when this log is a handover successor. `headAnchorIndex` is the head's
|
|
11
|
-
* effective anchor -- the verifier's anchor floor after the whole loop, which
|
|
12
|
-
* monotonicity makes the head entry's own anchor -- as an index into the
|
|
13
|
-
* controller's `versionIds` (`null` on an unversioned controller, whose
|
|
14
|
-
* entries carry no anchors); the sealing sweep compares it against the
|
|
15
|
-
* controller's latest membership change.
|
|
16
|
-
*/
|
|
17
|
-
export interface VerifiedResourceLog {
|
|
18
|
-
entries: ResourceLogEntry[];
|
|
19
|
-
method: string;
|
|
20
|
-
scid: string;
|
|
21
|
-
head: ResourceLogEntry;
|
|
22
|
-
state: ResourceLogEntry['state'];
|
|
23
|
-
pin: ResourceLogHeadPin;
|
|
24
|
-
headAnchorIndex: number | null;
|
|
25
|
-
terminal: {
|
|
26
|
-
method: string;
|
|
27
|
-
scid: string;
|
|
28
|
-
} | null;
|
|
29
|
-
previousLog: {
|
|
30
|
-
scid: string;
|
|
31
|
-
head: string;
|
|
32
|
-
} | null;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Whether an entry is a terminal handover entry: its `parameters` carry a
|
|
36
|
-
* `nextLog` member. Position, exact member set, and state equality are the
|
|
37
|
-
* verifier's checks; this is only the discriminant.
|
|
38
|
-
*
|
|
39
|
-
* @param entry {ResourceLogEntry}
|
|
40
|
-
* @returns {boolean}
|
|
41
|
-
*/
|
|
42
|
-
export declare function isTerminalResourceLogEntry(entry: ResourceLogEntry): boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Runs the profile's full verification over a parsed log, in order: parse
|
|
45
|
-
* shape, genesis (SCID recomputation, format identifier), chain-hash
|
|
46
|
-
* recomputation, per-entry proofs, the external-authorization rule with
|
|
47
|
-
* anchor monotonicity, termination, and continuity against the chain-head
|
|
48
|
-
* pin. Throws {@link ResourceLogIntegrityError} on fabrication-class
|
|
49
|
-
* failures, {@link ResourceLogContinuityError} on pin conflicts, and
|
|
50
|
-
* `ResourceLogLicenseError` on a ladder-signed append outside the
|
|
51
|
-
* ceremony-tail license; any failure rejects the whole log.
|
|
52
|
-
*
|
|
53
|
-
* The controller view is the independently verified controller document --
|
|
54
|
-
* never material served beside the log. An unversioned controller (empty
|
|
55
|
-
* `versionIds`) degrades every anchor rule to current-document verification
|
|
56
|
-
* and requires anchorless proofs.
|
|
57
|
-
*
|
|
58
|
-
* @param options {object}
|
|
59
|
-
* @param options.entries {ResourceLogEntry[]} the parsed served log
|
|
60
|
-
* @param options.controller {ResourceLogController} the verified controller
|
|
61
|
-
* view ({@link webvhResourceLogController})
|
|
62
|
-
* @param options.expectedMethod {string} the format identifier this caller
|
|
63
|
-
* expects (`RESOURCE_LOG_METHOD`; also confirmed against any `history`
|
|
64
|
-
* dispatch hint the caller followed)
|
|
65
|
-
* @param [options.pin] {ResourceLogHeadPin} the held chain-head pin, when
|
|
66
|
-
* this client has verified the log before
|
|
67
|
-
* @returns {Promise<VerifiedResourceLog>}
|
|
68
|
-
*/
|
|
69
|
-
export declare function verifyResourceLog({ entries, controller, expectedMethod, pin }: {
|
|
70
|
-
entries: ResourceLogEntry[];
|
|
71
|
-
controller: ResourceLogController;
|
|
72
|
-
expectedMethod: string;
|
|
73
|
-
pin?: ResourceLogHeadPin | null;
|
|
74
|
-
}): Promise<VerifiedResourceLog>;
|
|
75
|
-
/**
|
|
76
|
-
* Verifies a handover link from both sides: the prior log's terminal entry
|
|
77
|
-
* and the successor log's genesis back-reference. Both logs must already have
|
|
78
|
-
* passed {@link verifyResourceLog}. Checks: the terminal `nextLog` names the
|
|
79
|
-
* successor's SCID and method; the successor's `previousLog` names the prior
|
|
80
|
-
* log's SCID; and the successor's `previousLog.head` is the `versionId` of
|
|
81
|
-
* the terminal entry's immediate predecessor -- the terminal entry chains
|
|
82
|
-
* directly off the head the successor references. A verified handover is the
|
|
83
|
-
* one transition that replaces a chain-head pin wholesale (the caller stores
|
|
84
|
-
* `successor.pin`).
|
|
85
|
-
*
|
|
86
|
-
* @param options {object}
|
|
87
|
-
* @param options.prior {VerifiedResourceLog} the closed log
|
|
88
|
-
* @param options.successor {VerifiedResourceLog} the log its terminal entry
|
|
89
|
-
* names
|
|
90
|
-
* @returns {void}
|
|
91
|
-
*/
|
|
92
|
-
export declare function verifyResourceLogHandover({ prior, successor }: {
|
|
93
|
-
prior: VerifiedResourceLog;
|
|
94
|
-
successor: VerifiedResourceLog;
|
|
95
|
-
}): void;
|
|
96
|
-
//# sourceMappingURL=verify.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../src/resourceLog/verify.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EACV,gBAAgB,EAEjB,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAO5D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAclD;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,gBAAgB,EAAE,CAAA;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,gBAAgB,CAAA;IACtB,KAAK,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAA;IAChC,GAAG,EAAE,kBAAkB,CAAA;IACvB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,QAAQ,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;IACjD,WAAW,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;CACnD;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAM3E;AA0OD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,iBAAiB,CAAC,EACtC,OAAO,EACP,UAAU,EACV,cAAc,EACd,GAAG,EACJ,EAAE;IACD,OAAO,EAAE,gBAAgB,EAAE,CAAA;IAC3B,UAAU,EAAE,qBAAqB,CAAA;IACjC,cAAc,EAAE,MAAM,CAAA;IACtB,GAAG,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAA;CAChC,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAqP/B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,yBAAyB,CAAC,EACxC,KAAK,EACL,SAAS,EACV,EAAE;IACD,KAAK,EAAE,mBAAmB,CAAA;IAC1B,SAAS,EAAE,mBAAmB,CAAA;CAC/B,GAAG,IAAI,CAqBP"}
|