@interop/wallet-core 0.51.0 → 0.53.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 +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 +51 -30
- package/dist/clientAnnex/forgetLast.d.ts.map +1 -1
- package/dist/clientAnnex/forgetLast.js +72 -26
- 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 +6 -6
- 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 +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 +146 -10
- package/dist/clientAnnex/ladderAnchored.d.ts.map +1 -1
- package/dist/clientAnnex/ladderAnchored.js +230 -26
- 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 +18 -7
- package/dist/clientAnnex/recoveryLadderAnchored.d.ts.map +1 -1
- package/dist/clientAnnex/recoveryLadderAnchored.js +54 -14
- package/dist/clientAnnex/recoveryLadderAnchored.js.map +1 -1
- package/dist/clientAnnex/selfEnroll.d.ts +67 -6
- package/dist/clientAnnex/selfEnroll.d.ts.map +1 -1
- package/dist/clientAnnex/selfEnroll.js +91 -15
- 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/clients/rosterPolicy.js +10 -7
- package/dist/clients/rosterPolicy.js.map +1 -1
- package/dist/descriptors/acquire.js +1 -1
- package/dist/descriptors/logSource.d.ts +6 -4
- package/dist/descriptors/logSource.d.ts.map +1 -1
- package/dist/descriptors/logSource.js +7 -4
- 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 +8 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -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/clientKeyRecord.d.ts +68 -1
- package/dist/keys/clientKeyRecord.d.ts.map +1 -1
- package/dist/keys/clientKeyRecord.js +155 -20
- package/dist/keys/clientKeyRecord.js.map +1 -1
- package/dist/keys/index.d.ts +2 -2
- package/dist/keys/index.d.ts.map +1 -1
- package/dist/keys/index.js +1 -1
- package/dist/keys/index.js.map +1 -1
- package/dist/keys/rosterLogStore.d.ts +16 -14
- package/dist/keys/rosterLogStore.d.ts.map +1 -1
- package/dist/keys/rosterLogStore.js +164 -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/log.d.ts +49 -0
- package/dist/log.d.ts.map +1 -0
- package/dist/log.js +53 -0
- package/dist/log.js.map +1 -0
- package/dist/recovery/index.d.ts +2 -2
- package/dist/recovery/index.js +2 -2
- package/dist/recovery/recoveryDelegation.d.ts +6 -2
- package/dist/recovery/recoveryDelegation.d.ts.map +1 -1
- package/dist/recovery/recoveryDelegation.js +32 -6
- package/dist/recovery/recoveryDelegation.js.map +1 -1
- package/dist/recovery/recoveryWebvh.d.ts +67 -8
- package/dist/recovery/recoveryWebvh.d.ts.map +1 -1
- package/dist/recovery/recoveryWebvh.js +114 -19
- package/dist/recovery/recoveryWebvh.js.map +1 -1
- 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/capabilityRequest.d.ts +9 -1
- package/dist/request/capabilityRequest.d.ts.map +1 -1
- package/dist/request/capabilityRequest.js +13 -2
- package/dist/request/capabilityRequest.js.map +1 -1
- package/dist/request/classify.d.ts +37 -1
- package/dist/request/classify.d.ts.map +1 -1
- package/dist/request/classify.js +74 -3
- package/dist/request/classify.js.map +1 -1
- package/dist/request/ephemeralExchange.d.ts +5 -18
- package/dist/request/ephemeralExchange.d.ts.map +1 -1
- package/dist/request/ephemeralExchange.js +9 -3
- 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 +24 -3
- package/dist/request/interactionUrl.js.map +1 -1
- package/dist/request/parse.d.ts +0 -10
- package/dist/request/parse.d.ts.map +1 -1
- package/dist/request/parse.js +15 -1
- 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/types.d.ts +23 -2
- package/dist/request/types.d.ts.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 +41 -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 +42 -27
- package/dist/resourceLog/license.d.ts.map +1 -1
- package/dist/resourceLog/license.js +53 -30
- package/dist/resourceLog/license.js.map +1 -1
- package/dist/space/activity.d.ts +48 -1
- package/dist/space/activity.d.ts.map +1 -1
- package/dist/space/activity.js +52 -4
- package/dist/space/activity.js.map +1 -1
- package/dist/space/index.d.ts +1 -1
- package/dist/space/index.d.ts.map +1 -1
- package/dist/space/index.js +1 -1
- package/dist/space/index.js.map +1 -1
- package/dist/sync/pull.d.ts +0 -22
- package/dist/sync/pull.d.ts.map +1 -1
- package/dist/sync/pull.js +30 -2
- package/dist/sync/pull.js.map +1 -1
- package/dist/unlock/index.d.ts +7 -7
- package/dist/unlock/index.d.ts.map +1 -1
- package/dist/unlock/index.js +6 -6
- package/dist/unlock/index.js.map +1 -1
- 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.d.ts +37 -0
- package/dist/unlock/unlockRecord.d.ts.map +1 -1
- package/dist/unlock/unlockRecord.js +54 -1
- package/dist/unlock/unlockRecord.js.map +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 +33 -3
- package/dist/webvh/didWebvh.d.ts.map +1 -1
- package/dist/webvh/didWebvh.js +40 -11
- package/dist/webvh/didWebvh.js.map +1 -1
- package/dist/webvh/index.d.ts +1 -1
- package/dist/webvh/index.d.ts.map +1 -1
- package/dist/webvh/index.js +1 -1
- package/dist/webvh/index.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 +9 -11
- 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,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"}
|
|
@@ -1,474 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* The Resource Log Profile's verification algorithm (App Connect spec,
|
|
6
|
-
* `#log-verification`), end-to-end and fail-closed: entry-shape parse checks,
|
|
7
|
-
* SCID recomputation, chain-hash recomputation (never a stated head), proof
|
|
8
|
-
* verification through the did:webvh log kernel, the external-authorization
|
|
9
|
-
* rule (anchor resolution against the independently verified controller
|
|
10
|
-
* document, `assertionMethod` membership at the anchored version, anchor
|
|
11
|
-
* monotonicity), the ceremony-tail license on ladder-signed appends,
|
|
12
|
-
* terminal-entry recognition, and continuity against the chain-head pin. Any
|
|
13
|
-
* failure rejects the LOG, not just the failing entry, and nothing served --
|
|
14
|
-
* a stated head, a digest, a count -- is ever accepted in place of
|
|
15
|
-
* recomputation; a license refusal keeps its own class
|
|
16
|
-
* (`ResourceLogLicenseError`) so callers can tell an unlicensed append from
|
|
17
|
-
* a corrupt log.
|
|
18
|
-
*/
|
|
19
|
-
import { buildVersionId, canonicalizeStrict, defaultWebvhLogVerifier, deriveHash, parseAndValidateVersionId, SCID_PLACEHOLDER, verifyEntryProofs } from '@interop/did-method-webvh';
|
|
20
|
-
import { ResourceLogContinuityError, ResourceLogIntegrityError, ResourceLogLicenseError } from './errors.js';
|
|
21
|
-
import { assertLadderAppendLicensed } from './license.js';
|
|
22
|
-
import { vmFragmentOf } from './vmFragment.js';
|
|
23
|
-
/**
|
|
24
|
-
* The five members a log entry carries, exactly.
|
|
25
|
-
*/
|
|
26
|
-
const ENTRY_MEMBERS = [
|
|
27
|
-
'versionId',
|
|
28
|
-
'versionTime',
|
|
29
|
-
'parameters',
|
|
30
|
-
'state',
|
|
31
|
-
'proof'
|
|
32
|
-
];
|
|
33
|
-
/**
|
|
34
|
-
* Whether an entry is a terminal handover entry: its `parameters` carry a
|
|
35
|
-
* `nextLog` member. Position, exact member set, and state equality are the
|
|
36
|
-
* verifier's checks; this is only the discriminant.
|
|
37
|
-
*
|
|
38
|
-
* @param entry {ResourceLogEntry}
|
|
39
|
-
* @returns {boolean}
|
|
40
|
-
*/
|
|
41
|
-
export function isTerminalResourceLogEntry(entry) {
|
|
42
|
-
return (typeof entry.parameters === 'object' &&
|
|
43
|
-
entry.parameters !== null &&
|
|
44
|
-
'nextLog' in entry.parameters);
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Structural check of one member of an entry's `proof` array against the
|
|
48
|
-
* profile's fixed shape, before any cryptography runs.
|
|
49
|
-
*
|
|
50
|
-
* @param proof {unknown}
|
|
51
|
-
* @param ordinal {number} the owning entry's 1-based position
|
|
52
|
-
* @returns {ResourceLogEntryProof}
|
|
53
|
-
*/
|
|
54
|
-
function checkProofShape(proof, ordinal) {
|
|
55
|
-
const candidate = proof;
|
|
56
|
-
if (candidate === null ||
|
|
57
|
-
typeof candidate !== 'object' ||
|
|
58
|
-
candidate.type !== 'DataIntegrityProof' ||
|
|
59
|
-
candidate.cryptosuite !== 'eddsa-jcs-2022' ||
|
|
60
|
-
candidate.proofPurpose !== 'assertionMethod' ||
|
|
61
|
-
typeof candidate.verificationMethod !== 'string' ||
|
|
62
|
-
typeof candidate.proofValue !== 'string') {
|
|
63
|
-
throw new ResourceLogIntegrityError(`Resource log entry ${ordinal} carries a proof outside the profile's ` +
|
|
64
|
-
`fixed shape (DataIntegrityProof / eddsa-jcs-2022 / assertionMethod).`);
|
|
65
|
-
}
|
|
66
|
-
return candidate;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Shape-checks one entry (the profile's parse step): exactly the five
|
|
70
|
-
* members, `versionId` ordinal at its 1-based position, an RFC3339 UTC
|
|
71
|
-
* `versionTime` (format only -- temporal refusals are forbidden), the
|
|
72
|
-
* per-position `parameters` rules fail-closed, a `state` carrying `type` and
|
|
73
|
-
* no `history`, and a non-empty fixed-shape `proof` array.
|
|
74
|
-
*
|
|
75
|
-
* @param entry {ResourceLogEntry}
|
|
76
|
-
* @param index {number} the entry's 0-based position
|
|
77
|
-
*/
|
|
78
|
-
function checkEntryShape(entry, index) {
|
|
79
|
-
const ordinal = index + 1;
|
|
80
|
-
const members = Object.keys(entry);
|
|
81
|
-
if (members.length !== ENTRY_MEMBERS.length ||
|
|
82
|
-
ENTRY_MEMBERS.some(member => !(member in entry))) {
|
|
83
|
-
throw new ResourceLogIntegrityError(`Resource log entry ${ordinal} does not carry exactly the profile's ` +
|
|
84
|
-
`five members (versionId, versionTime, parameters, state, proof).`);
|
|
85
|
-
}
|
|
86
|
-
try {
|
|
87
|
-
parseAndValidateVersionId(entry.versionId, ordinal);
|
|
88
|
-
}
|
|
89
|
-
catch (err) {
|
|
90
|
-
throw new ResourceLogIntegrityError(`Resource log entry ${ordinal} has a malformed or misplaced versionId.`, { cause: err });
|
|
91
|
-
}
|
|
92
|
-
if (typeof entry.versionTime !== 'string' ||
|
|
93
|
-
!entry.versionTime.endsWith('Z') ||
|
|
94
|
-
Number.isNaN(Date.parse(entry.versionTime))) {
|
|
95
|
-
throw new ResourceLogIntegrityError(`Resource log entry ${ordinal} has a malformed versionTime (RFC3339 ` +
|
|
96
|
-
`UTC required; the value itself is advisory).`);
|
|
97
|
-
}
|
|
98
|
-
const parameters = entry.parameters;
|
|
99
|
-
if (parameters === null || typeof parameters !== 'object') {
|
|
100
|
-
throw new ResourceLogIntegrityError(`Resource log entry ${ordinal} has a non-object parameters member.`);
|
|
101
|
-
}
|
|
102
|
-
const parameterMembers = Object.keys(parameters);
|
|
103
|
-
if (index === 0) {
|
|
104
|
-
const genesis = parameters;
|
|
105
|
-
const allowed = parameterMembers.every(member => ['method', 'scid', 'previousLog'].includes(member));
|
|
106
|
-
if (!allowed ||
|
|
107
|
-
typeof genesis.method !== 'string' ||
|
|
108
|
-
typeof genesis.scid !== 'string' ||
|
|
109
|
-
(genesis.previousLog !== undefined &&
|
|
110
|
-
(genesis.previousLog === null ||
|
|
111
|
-
typeof genesis.previousLog !== 'object' ||
|
|
112
|
-
typeof genesis.previousLog.scid !== 'string' ||
|
|
113
|
-
typeof genesis.previousLog.head !== 'string' ||
|
|
114
|
-
Object.keys(genesis.previousLog).length !== 2))) {
|
|
115
|
-
throw new ResourceLogIntegrityError('The resource log genesis parameters must carry method and scid ' +
|
|
116
|
-
'(plus, on a handover successor only, previousLog) and nothing else.');
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
else if (parameterMembers.length !== 0) {
|
|
120
|
-
// The only non-genesis entry with parameters is a terminal handover
|
|
121
|
-
// entry, exactly { nextLog: { method, scid } }. Anything else -- the
|
|
122
|
-
// deleted did:webvh key-management parameters in particular -- is refused
|
|
123
|
-
// fail-closed.
|
|
124
|
-
const terminal = parameters;
|
|
125
|
-
if (parameterMembers.length !== 1 ||
|
|
126
|
-
terminal.nextLog === undefined ||
|
|
127
|
-
terminal.nextLog === null ||
|
|
128
|
-
typeof terminal.nextLog !== 'object' ||
|
|
129
|
-
typeof terminal.nextLog.method !== 'string' ||
|
|
130
|
-
typeof terminal.nextLog.scid !== 'string' ||
|
|
131
|
-
Object.keys(terminal.nextLog).length !== 2) {
|
|
132
|
-
throw new ResourceLogIntegrityError(`Resource log entry ${ordinal} carries parameters this profile does ` +
|
|
133
|
-
`not define for its position (only a terminal entry's nextLog is ` +
|
|
134
|
-
`permitted past genesis).`);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
const state = entry.state;
|
|
138
|
-
if (state === null ||
|
|
139
|
-
typeof state !== 'object' ||
|
|
140
|
-
typeof state.type !== 'string') {
|
|
141
|
-
throw new ResourceLogIntegrityError(`Resource log entry ${ordinal} has no state.type schema identifier.`);
|
|
142
|
-
}
|
|
143
|
-
if ('history' in state) {
|
|
144
|
-
throw new ResourceLogIntegrityError(`Resource log entry ${ordinal} carries a history member inside its ` +
|
|
145
|
-
`state (the profile reserves that member name).`);
|
|
146
|
-
}
|
|
147
|
-
if (!Array.isArray(entry.proof) || entry.proof.length === 0) {
|
|
148
|
-
throw new ResourceLogIntegrityError(`Resource log entry ${ordinal} carries no proof array.`);
|
|
149
|
-
}
|
|
150
|
-
for (const proof of entry.proof) {
|
|
151
|
-
checkProofShape(proof, ordinal);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Deep-clones a JSON value, replacing every string equal to the SCID with the
|
|
156
|
-
* `{SCID}` placeholder -- the inverse of genesis construction, used to
|
|
157
|
-
* recompute the SCID from a served genesis entry.
|
|
158
|
-
*
|
|
159
|
-
* @param value {unknown}
|
|
160
|
-
* @param scid {string}
|
|
161
|
-
* @returns {unknown}
|
|
162
|
-
*/
|
|
163
|
-
function substituteScid(value, scid) {
|
|
164
|
-
if (typeof value === 'string') {
|
|
165
|
-
return value === scid ? SCID_PLACEHOLDER : value;
|
|
166
|
-
}
|
|
167
|
-
if (Array.isArray(value)) {
|
|
168
|
-
return value.map(item => substituteScid(item, scid));
|
|
169
|
-
}
|
|
170
|
-
if (value !== null && typeof value === 'object') {
|
|
171
|
-
const result = {};
|
|
172
|
-
for (const [key, member] of Object.entries(value)) {
|
|
173
|
-
result[key] = substituteScid(member, scid);
|
|
174
|
-
}
|
|
175
|
-
return result;
|
|
176
|
-
}
|
|
177
|
-
return value;
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* The hash input of entry `n`: the entry with `proof` removed and `versionId`
|
|
181
|
-
* replaced by the predecessor's `versionId` (the SCID for the genesis entry).
|
|
182
|
-
*
|
|
183
|
-
* @param entry {ResourceLogEntry}
|
|
184
|
-
* @param predecessorVersionId {string}
|
|
185
|
-
* @returns {object}
|
|
186
|
-
*/
|
|
187
|
-
function hashInputOf(entry, predecessorVersionId) {
|
|
188
|
-
return {
|
|
189
|
-
versionId: predecessorVersionId,
|
|
190
|
-
versionTime: entry.versionTime,
|
|
191
|
-
parameters: entry.parameters,
|
|
192
|
-
state: entry.state
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Splits a proof's `verificationMethod` DID URL into its base DID, its
|
|
197
|
-
* `versionId` DID parameter (the entry anchor), and its fragment (the signing
|
|
198
|
-
* key's multibase).
|
|
199
|
-
*
|
|
200
|
-
* @param verificationMethod {string}
|
|
201
|
-
* @param ordinal {number} the owning entry's 1-based position
|
|
202
|
-
* @returns {object}
|
|
203
|
-
*/
|
|
204
|
-
function parseAnchoredVm(verificationMethod, ordinal) {
|
|
205
|
-
const keyMultibase = vmFragmentOf(verificationMethod);
|
|
206
|
-
if (keyMultibase === undefined) {
|
|
207
|
-
throw new ResourceLogIntegrityError(`Resource log entry ${ordinal} has a proof verificationMethod without ` +
|
|
208
|
-
`a key fragment.`);
|
|
209
|
-
}
|
|
210
|
-
const didUrl = verificationMethod.slice(0, verificationMethod.length - keyMultibase.length - 1);
|
|
211
|
-
const queryIndex = didUrl.indexOf('?');
|
|
212
|
-
if (queryIndex === -1) {
|
|
213
|
-
return { did: didUrl, keyMultibase };
|
|
214
|
-
}
|
|
215
|
-
const did = didUrl.slice(0, queryIndex);
|
|
216
|
-
const params = new URLSearchParams(didUrl.slice(queryIndex + 1));
|
|
217
|
-
const anchor = params.get('versionId') ?? undefined;
|
|
218
|
-
return { did, anchor, keyMultibase };
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* Runs the profile's full verification over a parsed log, in order: parse
|
|
222
|
-
* shape, genesis (SCID recomputation, format identifier), chain-hash
|
|
223
|
-
* recomputation, per-entry proofs, the external-authorization rule with
|
|
224
|
-
* anchor monotonicity, termination, and continuity against the chain-head
|
|
225
|
-
* pin. Throws {@link ResourceLogIntegrityError} on fabrication-class
|
|
226
|
-
* failures, {@link ResourceLogContinuityError} on pin conflicts, and
|
|
227
|
-
* `ResourceLogLicenseError` on a ladder-signed append outside the
|
|
228
|
-
* ceremony-tail license; any failure rejects the whole log.
|
|
229
|
-
*
|
|
230
|
-
* The controller view is the independently verified controller document --
|
|
231
|
-
* never material served beside the log. An unversioned controller (empty
|
|
232
|
-
* `versionIds`) degrades every anchor rule to current-document verification
|
|
233
|
-
* and requires anchorless proofs.
|
|
234
|
-
*
|
|
235
|
-
* @param options {object}
|
|
236
|
-
* @param options.entries {ResourceLogEntry[]} the parsed served log
|
|
237
|
-
* @param options.controller {ResourceLogController} the verified controller
|
|
238
|
-
* view ({@link webvhResourceLogController})
|
|
239
|
-
* @param options.expectedMethod {string} the format identifier this caller
|
|
240
|
-
* expects (`RESOURCE_LOG_METHOD`; also confirmed against any `history`
|
|
241
|
-
* dispatch hint the caller followed)
|
|
242
|
-
* @param [options.pin] {ResourceLogHeadPin} the held chain-head pin, when
|
|
243
|
-
* this client has verified the log before
|
|
244
|
-
* @returns {Promise<VerifiedResourceLog>}
|
|
245
|
-
*/
|
|
246
|
-
export async function verifyResourceLog({ entries, controller, expectedMethod, pin }) {
|
|
247
|
-
if (entries.length === 0) {
|
|
248
|
-
throw new ResourceLogIntegrityError('The resource log is empty (a log carries at least its genesis entry).');
|
|
249
|
-
}
|
|
250
|
-
// 1. Parse: per-entry shape, parameters rules, ordinal positions.
|
|
251
|
-
entries.forEach((entry, index) => {
|
|
252
|
-
checkEntryShape(entry, index);
|
|
253
|
-
});
|
|
254
|
-
// 2. Genesis: format identifier, then SCID recomputation.
|
|
255
|
-
const genesisParameters = entries[0].parameters;
|
|
256
|
-
const { method, scid } = genesisParameters;
|
|
257
|
-
if (method !== expectedMethod) {
|
|
258
|
-
throw new ResourceLogIntegrityError(`The resource log declares format "${method}", not the expected ` +
|
|
259
|
-
`"${expectedMethod}".`);
|
|
260
|
-
}
|
|
261
|
-
const preliminary = substituteScid(hashInputOf(entries[0], SCID_PLACEHOLDER), scid);
|
|
262
|
-
if ((await deriveHash(preliminary)) !== scid) {
|
|
263
|
-
throw new ResourceLogIntegrityError('The resource log SCID does not verify against its genesis content.');
|
|
264
|
-
}
|
|
265
|
-
// 3. Chain: recompute every entry hash from the predecessor-substituted
|
|
266
|
-
// input; never accept a stated head.
|
|
267
|
-
let predecessorVersionId = scid;
|
|
268
|
-
for (const [index, entry] of entries.entries()) {
|
|
269
|
-
const entryHash = await deriveHash(hashInputOf(entry, predecessorVersionId));
|
|
270
|
-
if (entry.versionId !== buildVersionId(index + 1, entryHash)) {
|
|
271
|
-
throw new ResourceLogIntegrityError(`Resource log entry ${index + 1} does not hash-chain to its ` +
|
|
272
|
-
`predecessor.`);
|
|
273
|
-
}
|
|
274
|
-
predecessorVersionId = entry.versionId;
|
|
275
|
-
}
|
|
276
|
-
// 4 + 5. Proofs and authorization, entry by entry, with anchor
|
|
277
|
-
// monotonicity carried along the log.
|
|
278
|
-
const versioned = controller.versionIds.length > 0;
|
|
279
|
-
const anchorIndexes = new Map();
|
|
280
|
-
for (const [index, versionId] of controller.versionIds.entries()) {
|
|
281
|
-
if (!anchorIndexes.has(versionId)) {
|
|
282
|
-
anchorIndexes.set(versionId, index);
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
let anchorFloor = 0;
|
|
286
|
-
for (const [index, entry] of entries.entries()) {
|
|
287
|
-
const ordinal = index + 1;
|
|
288
|
-
let entryAnchorIndex = anchorFloor;
|
|
289
|
-
// The kernel calls `authorize` before `resolveVM` for the same proof, so
|
|
290
|
-
// the parse throws from `authorize` exactly as it did when both parsed.
|
|
291
|
-
const parsed = new Map();
|
|
292
|
-
const parseOnce = (verificationMethod) => {
|
|
293
|
-
let result = parsed.get(verificationMethod);
|
|
294
|
-
if (result === undefined) {
|
|
295
|
-
result = parseAnchoredVm(verificationMethod, ordinal);
|
|
296
|
-
parsed.set(verificationMethod, result);
|
|
297
|
-
}
|
|
298
|
-
return result;
|
|
299
|
-
};
|
|
300
|
-
const authorize = async (proof) => {
|
|
301
|
-
const { did, anchor, keyMultibase } = parseOnce(proof.verificationMethod ?? '');
|
|
302
|
-
if (did !== controller.did) {
|
|
303
|
-
throw new ResourceLogIntegrityError(`Resource log entry ${ordinal} is signed under a different ` +
|
|
304
|
-
`controller than this log's account.`);
|
|
305
|
-
}
|
|
306
|
-
if (versioned && anchor === undefined) {
|
|
307
|
-
throw new ResourceLogIntegrityError(`Resource log entry ${ordinal} carries no entry anchor against a ` +
|
|
308
|
-
`version-resolvable controller.`);
|
|
309
|
-
}
|
|
310
|
-
if (!versioned && anchor !== undefined) {
|
|
311
|
-
throw new ResourceLogIntegrityError(`Resource log entry ${ordinal} anchors a version on an unversioned ` +
|
|
312
|
-
`controller.`);
|
|
313
|
-
}
|
|
314
|
-
let anchorIndex = 0;
|
|
315
|
-
if (anchor !== undefined) {
|
|
316
|
-
const known = anchorIndexes.get(anchor);
|
|
317
|
-
if (known === undefined) {
|
|
318
|
-
throw new ResourceLogIntegrityError(`Resource log entry ${ordinal} anchors an unknown controller ` +
|
|
319
|
-
`document version.`);
|
|
320
|
-
}
|
|
321
|
-
anchorIndex = known;
|
|
322
|
-
if (anchorIndex < anchorFloor) {
|
|
323
|
-
throw new ResourceLogIntegrityError(`Resource log entry ${ordinal} anchors behind its predecessor ` +
|
|
324
|
-
`(anchors must be monotone along the log).`);
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
const assertionKeys = await controller.assertionKeysAt(anchor);
|
|
328
|
-
if (!assertionKeys.has(keyMultibase)) {
|
|
329
|
-
throw new ResourceLogIntegrityError(`Resource log entry ${ordinal} is signed by a key the controller ` +
|
|
330
|
-
`document does not list under assertionMethod at the anchored ` +
|
|
331
|
-
`version.`);
|
|
332
|
-
}
|
|
333
|
-
// The ceremony-tail license: a ladder-signed proof (the anchored
|
|
334
|
-
// version's relation-asymmetry ladder VM) is admitted only on the
|
|
335
|
-
// genesis entry, or anchored at a posture-changing version no prior
|
|
336
|
-
// entry anchors at or past. The floor at this point is still the
|
|
337
|
-
// previous entries' effective anchor -- the verified head this append
|
|
338
|
-
// extended.
|
|
339
|
-
if (index > 0) {
|
|
340
|
-
const posture = await controller.postureAt(anchor);
|
|
341
|
-
if (posture.ladderKeys.has(keyMultibase)) {
|
|
342
|
-
await assertLadderAppendLicensed({
|
|
343
|
-
controller,
|
|
344
|
-
anchorIndex: versioned ? anchorIndex : null,
|
|
345
|
-
headAnchorIndex: anchorFloor
|
|
346
|
-
});
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
entryAnchorIndex = Math.max(entryAnchorIndex, anchorIndex);
|
|
350
|
-
};
|
|
351
|
-
try {
|
|
352
|
-
// The wire proof type narrows the kernel's (fixed purpose, optional
|
|
353
|
-
// created); the shape check above already enforced the profile form.
|
|
354
|
-
await verifyEntryProofs(entry, {
|
|
355
|
-
verifier: defaultWebvhLogVerifier,
|
|
356
|
-
authorize,
|
|
357
|
-
resolveVM: async (verificationMethod) => ({
|
|
358
|
-
publicKeyMultibase: parseOnce(verificationMethod).keyMultibase
|
|
359
|
-
})
|
|
360
|
-
});
|
|
361
|
-
}
|
|
362
|
-
catch (err) {
|
|
363
|
-
if (err instanceof ResourceLogIntegrityError ||
|
|
364
|
-
err instanceof ResourceLogLicenseError) {
|
|
365
|
-
throw err;
|
|
366
|
-
}
|
|
367
|
-
throw new ResourceLogIntegrityError(`Resource log entry ${ordinal} failed proof verification.`, { cause: err });
|
|
368
|
-
}
|
|
369
|
-
anchorFloor = entryAnchorIndex;
|
|
370
|
-
}
|
|
371
|
-
// 6. Termination: a terminal entry closes the log -- it must be last, must
|
|
372
|
-
// not be the genesis, and must change no state.
|
|
373
|
-
let terminal = null;
|
|
374
|
-
for (const [index, entry] of entries.entries()) {
|
|
375
|
-
if (!isTerminalResourceLogEntry(entry) || index === 0) {
|
|
376
|
-
continue;
|
|
377
|
-
}
|
|
378
|
-
if (index !== entries.length - 1) {
|
|
379
|
-
throw new ResourceLogIntegrityError('The resource log continues past a terminal handover entry.');
|
|
380
|
-
}
|
|
381
|
-
const predecessorState = entries[index - 1].state;
|
|
382
|
-
if (canonicalizeStrict(entry.state) !== canonicalizeStrict(predecessorState)) {
|
|
383
|
-
throw new ResourceLogIntegrityError("The terminal handover entry's state differs from its " +
|
|
384
|
-
"predecessor's (a handover changes no resource state).");
|
|
385
|
-
}
|
|
386
|
-
terminal = entry.parameters.nextLog;
|
|
387
|
-
}
|
|
388
|
-
// 7. Continuity against the chain-head pin, where one is held.
|
|
389
|
-
const head = entries[entries.length - 1];
|
|
390
|
-
if (pin) {
|
|
391
|
-
if (pin.method !== method) {
|
|
392
|
-
throw new ResourceLogContinuityError({
|
|
393
|
-
reason: 'method-switch',
|
|
394
|
-
pinnedHead: pin.head
|
|
395
|
-
});
|
|
396
|
-
}
|
|
397
|
-
if (pin.scid !== scid) {
|
|
398
|
-
throw new ResourceLogContinuityError({
|
|
399
|
-
reason: 'scid-switch',
|
|
400
|
-
pinnedHead: pin.head
|
|
401
|
-
});
|
|
402
|
-
}
|
|
403
|
-
const pinnedOrdinal = Number.parseInt(pin.head, 10);
|
|
404
|
-
if (!Number.isInteger(pinnedOrdinal) || pinnedOrdinal < 1) {
|
|
405
|
-
throw new ResourceLogContinuityError({
|
|
406
|
-
reason: 'fork',
|
|
407
|
-
pinnedHead: pin.head,
|
|
408
|
-
servedEntries: entries
|
|
409
|
-
});
|
|
410
|
-
}
|
|
411
|
-
if (entries.length < pinnedOrdinal) {
|
|
412
|
-
throw new ResourceLogContinuityError({
|
|
413
|
-
reason: 'rollback',
|
|
414
|
-
pinnedHead: pin.head
|
|
415
|
-
});
|
|
416
|
-
}
|
|
417
|
-
if (entries[pinnedOrdinal - 1].versionId !== pin.head) {
|
|
418
|
-
throw new ResourceLogContinuityError({
|
|
419
|
-
reason: 'fork',
|
|
420
|
-
pinnedHead: pin.head,
|
|
421
|
-
servedEntries: entries
|
|
422
|
-
});
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
return {
|
|
426
|
-
entries,
|
|
427
|
-
method,
|
|
428
|
-
scid,
|
|
429
|
-
head,
|
|
430
|
-
state: head.state,
|
|
431
|
-
pin: { method, scid, head: head.versionId },
|
|
432
|
-
headAnchorIndex: versioned ? anchorFloor : null,
|
|
433
|
-
terminal,
|
|
434
|
-
previousLog: genesisParameters.previousLog ?? null
|
|
435
|
-
};
|
|
436
|
-
}
|
|
437
|
-
/**
|
|
438
|
-
* Verifies a handover link from both sides: the prior log's terminal entry
|
|
439
|
-
* and the successor log's genesis back-reference. Both logs must already have
|
|
440
|
-
* passed {@link verifyResourceLog}. Checks: the terminal `nextLog` names the
|
|
441
|
-
* successor's SCID and method; the successor's `previousLog` names the prior
|
|
442
|
-
* log's SCID; and the successor's `previousLog.head` is the `versionId` of
|
|
443
|
-
* the terminal entry's immediate predecessor -- the terminal entry chains
|
|
444
|
-
* directly off the head the successor references. A verified handover is the
|
|
445
|
-
* one transition that replaces a chain-head pin wholesale (the caller stores
|
|
446
|
-
* `successor.pin`).
|
|
447
|
-
*
|
|
448
|
-
* @param options {object}
|
|
449
|
-
* @param options.prior {VerifiedResourceLog} the closed log
|
|
450
|
-
* @param options.successor {VerifiedResourceLog} the log its terminal entry
|
|
451
|
-
* names
|
|
452
|
-
* @returns {void}
|
|
453
|
-
*/
|
|
454
|
-
export function verifyResourceLogHandover({ prior, successor }) {
|
|
455
|
-
if (!prior.terminal) {
|
|
456
|
-
throw new ResourceLogContinuityError({
|
|
457
|
-
reason: 'scid-switch',
|
|
458
|
-
pinnedHead: prior.pin.head
|
|
459
|
-
});
|
|
460
|
-
}
|
|
461
|
-
const predecessor = prior.entries[prior.entries.length - 2];
|
|
462
|
-
if (prior.terminal.scid !== successor.scid ||
|
|
463
|
-
prior.terminal.method !== successor.method ||
|
|
464
|
-
successor.previousLog?.scid !== prior.scid ||
|
|
465
|
-
predecessor === undefined ||
|
|
466
|
-
successor.previousLog.head !== predecessor.versionId) {
|
|
467
|
-
throw new ResourceLogContinuityError({
|
|
468
|
-
reason: 'scid-switch',
|
|
469
|
-
pinnedHead: prior.pin.head,
|
|
470
|
-
servedEntries: successor.entries
|
|
471
|
-
});
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
//# sourceMappingURL=verify.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"verify.js","sourceRoot":"","sources":["../../src/resourceLog/verify.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;GAcG;AACH,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,uBAAuB,EACvB,UAAU,EACV,yBAAyB,EACzB,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,2BAA2B,CAAA;AAMlC,OAAO,EACL,0BAA0B,EAC1B,yBAAyB,EACzB,uBAAuB,EACxB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAA;AAEzD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C;;GAEG;AACH,MAAM,aAAa,GAAG;IACpB,WAAW;IACX,aAAa;IACb,YAAY;IACZ,OAAO;IACP,OAAO;CACR,CAAA;AA2BD;;;;;;;GAOG;AACH,MAAM,UAAU,0BAA0B,CAAC,KAAuB;IAChE,OA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,IACE,KAAK,CAAC,QAAQ,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI;QACtC,KAAK,CAAC,QAAQ,CAAC,MAAM,KAAK,SAAS,CAAC,MAAM;QAC1C,SAAS,CAAC,WAAW,EAAE,IAAI,KAAK,KAAK,CAAC,IAAI;QAC1C,WAAW,KAAK,SAAS;QACzB,SAAS,CAAC,WAAW,CAAC,IAAI,KAAK,WAAW,CAAC,SAAS,EACpD,CAAC;QACD,MAAM,IAAI,0BAA0B,CAAC;YACnC,MAAM,EAAE,aAAa;YACrB,UAAU,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI;YAC1B,aAAa,EAAE,SAAS,CAAC,OAAO;SACjC,CAAC,CAAA;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* The one fragment reader for verification-method ids. Every id this stack
|
|
6
|
-
* handles is minted as `${did}#${multibase}`, so the fragment IS the key's
|
|
7
|
-
* public multibase -- which is what lets a did:key kid and a
|
|
8
|
-
* `did:webvh`-spelled verification method be compared as key material rather
|
|
9
|
-
* than as strings. The extraction used to exist in four spellings that
|
|
10
|
-
* disagreed on the degenerate inputs; it lives here instead, dependency-free,
|
|
11
|
-
* because `resourceLog` is the lowest layer the webvh, keys, and descriptors
|
|
12
|
-
* modules all import.
|
|
13
|
-
*/
|
|
14
|
-
/**
|
|
15
|
-
* The fragment after the LAST `#` of a DID URL or verification-method id, or
|
|
16
|
-
* `undefined` when the id carries no `#` at all or its fragment is empty (a
|
|
17
|
-
* trailing `#`).
|
|
18
|
-
*
|
|
19
|
-
* The last `#` wins on a degenerate double-`#` id: ids are minted as
|
|
20
|
-
* `${did}#${multibase}`, so the final segment is the key material either way,
|
|
21
|
-
* and reading it from the end also survives a DID whose method-specific id
|
|
22
|
-
* ever grows a `#`.
|
|
23
|
-
*
|
|
24
|
-
* `undefined` is the only absent-fragment posture here. A caller that needs a
|
|
25
|
-
* different one -- throwing on a fragmentless id, or falling back to the whole
|
|
26
|
-
* string -- wraps this helper explicitly at its own call site, so the choice
|
|
27
|
-
* stays visible where it is made.
|
|
28
|
-
*
|
|
29
|
-
* @param id {string}
|
|
30
|
-
* @returns {string | undefined}
|
|
31
|
-
*/
|
|
32
|
-
export declare function vmFragmentOf(id: string): string | undefined;
|
|
33
|
-
//# sourceMappingURL=vmFragment.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vmFragment.d.ts","sourceRoot":"","sources":["../../src/resourceLog/vmFragment.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;GASG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAM3D"}
|