@interop/wallet-core 0.50.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 +17 -8
- package/dist/clientAnnex/credentialAnchoredGenesis.d.ts.map +1 -1
- package/dist/clientAnnex/credentialAnchoredGenesis.js +33 -12
- package/dist/clientAnnex/credentialAnchoredGenesis.js.map +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 +65 -28
- package/dist/clientAnnex/forgetLast.d.ts.map +1 -1
- package/dist/clientAnnex/forgetLast.js +78 -18
- 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 +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 +13 -1
- package/dist/genesis/accountGenesis.d.ts.map +1 -1
- package/dist/genesis/accountGenesis.js +1 -1
- package/dist/genesis/accountGenesis.js.map +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 +6 -10
- 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,167 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Resource-log entry construction: the two-pass SCID genesis build and the
|
|
6
|
-
* ordinary next-entry build, both signed under the writer's enrolled Ed25519
|
|
7
|
-
* key with the entry anchor riding as a `versionId` DID parameter on the
|
|
8
|
-
* proof's `verificationMethod` -- the writer anchors at the head of the
|
|
9
|
-
* controller document as it last verified it. All hashing and proof
|
|
10
|
-
* construction comes from the did:webvh log kernel; nothing is re-derived
|
|
11
|
-
* here.
|
|
12
|
-
*/
|
|
13
|
-
import { buildVersionId, createDataIntegrityProofTemplate, deriveHash, parseAndValidateVersionId, SCID_PLACEHOLDER, signDataIntegrityProof, signerFromExternalKey } from '@interop/did-method-webvh';
|
|
14
|
-
/**
|
|
15
|
-
* The writer's anchored verification-method DID URL: the controller DID, the
|
|
16
|
-
* anchor at the controller's verified head as a `versionId` DID parameter
|
|
17
|
-
* (omitted for an unversioned controller), and the signing key's multibase as
|
|
18
|
-
* the fragment.
|
|
19
|
-
*
|
|
20
|
-
* @param options {object}
|
|
21
|
-
* @param options.controller {ResourceLogController}
|
|
22
|
-
* @param options.keyMultibase {string}
|
|
23
|
-
* @returns {string}
|
|
24
|
-
*/
|
|
25
|
-
function anchoredVerificationMethod({ controller, keyMultibase }) {
|
|
26
|
-
const anchor = controller.versionIds[controller.versionIds.length - 1];
|
|
27
|
-
const query = anchor === undefined ? '' : `?versionId=${anchor}`;
|
|
28
|
-
return `${controller.did}${query}#${keyMultibase}`;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Refuses a state document the profile forbids in an entry: one without a
|
|
32
|
-
* `type` schema identifier, or one carrying the projection-only `history`
|
|
33
|
-
* member.
|
|
34
|
-
*
|
|
35
|
-
* @param state {ResourceLogEntry['state']}
|
|
36
|
-
*/
|
|
37
|
-
function checkState(state) {
|
|
38
|
-
if (typeof state.type !== 'string') {
|
|
39
|
-
throw new Error('A resource log entry state must carry a type schema identifier.');
|
|
40
|
-
}
|
|
41
|
-
if ('history' in state) {
|
|
42
|
-
throw new Error('A resource log entry state must not carry a history member (the ' +
|
|
43
|
-
'profile reserves that member name).');
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Signs a fully version-identified entry under the profile's fixed proof
|
|
48
|
-
* shape.
|
|
49
|
-
*
|
|
50
|
-
* @param options {object}
|
|
51
|
-
* @param options.entry {object} the entry, `proof` absent
|
|
52
|
-
* @param options.signer {ResourceLogSigner}
|
|
53
|
-
* @param options.verificationMethod {string} the anchored DID URL
|
|
54
|
-
* @param options.created {string} the proof timestamp
|
|
55
|
-
* @returns {Promise<ResourceLogEntry>}
|
|
56
|
-
*/
|
|
57
|
-
async function signEntry({ entry, signer, verificationMethod, created }) {
|
|
58
|
-
const proofTemplate = createDataIntegrityProofTemplate({
|
|
59
|
-
verificationMethod,
|
|
60
|
-
created
|
|
61
|
-
});
|
|
62
|
-
const proof = await signDataIntegrityProof(entry, proofTemplate, signerFromExternalKey({
|
|
63
|
-
publicKeyMultibase: signer.keyMultibase,
|
|
64
|
-
sign: signer.sign
|
|
65
|
-
}));
|
|
66
|
-
// The kernel's proof type keeps proofPurpose as the full union; the
|
|
67
|
-
// template fixed it to the profile's assertionMethod shape.
|
|
68
|
-
return { ...entry, proof: [proof] };
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Builds and signs a genesis entry by the profile's two-pass SCID procedure:
|
|
72
|
-
* the preliminary entry carries the `{SCID}` placeholder as `versionId` and
|
|
73
|
-
* `parameters.scid`, its hash is the SCID, and the final entry substitutes it
|
|
74
|
-
* back in before the ordinary entry hash is computed (`versionId` input
|
|
75
|
-
* value: the SCID).
|
|
76
|
-
*
|
|
77
|
-
* @param options {object}
|
|
78
|
-
* @param options.state {ResourceLogEntry['state']} the full initial state
|
|
79
|
-
* (with its `type`)
|
|
80
|
-
* @param options.method {string} the format identifier
|
|
81
|
-
* (`RESOURCE_LOG_METHOD`)
|
|
82
|
-
* @param options.controller {ResourceLogController} the verified controller
|
|
83
|
-
* view -- the anchor source
|
|
84
|
-
* @param options.signer {ResourceLogSigner}
|
|
85
|
-
* @param [options.previousLog] {object} handover successors only: the prior
|
|
86
|
-
* log's SCID and the `versionId` of its terminal entry's predecessor
|
|
87
|
-
* @param [options.versionTime] {string} RFC3339 UTC; defaults to now
|
|
88
|
-
* @returns {Promise<ResourceLogEntry>}
|
|
89
|
-
*/
|
|
90
|
-
export async function buildResourceLogGenesis({ state, method, controller, signer, previousLog, versionTime }) {
|
|
91
|
-
checkState(state);
|
|
92
|
-
const time = versionTime ?? new Date().toISOString();
|
|
93
|
-
const parametersOf = (scid) => ({
|
|
94
|
-
method,
|
|
95
|
-
scid,
|
|
96
|
-
...(previousLog === undefined ? {} : { previousLog })
|
|
97
|
-
});
|
|
98
|
-
const scid = await deriveHash({
|
|
99
|
-
versionId: SCID_PLACEHOLDER,
|
|
100
|
-
versionTime: time,
|
|
101
|
-
parameters: parametersOf(SCID_PLACEHOLDER),
|
|
102
|
-
state
|
|
103
|
-
});
|
|
104
|
-
const parameters = parametersOf(scid);
|
|
105
|
-
const entryHash = await deriveHash({
|
|
106
|
-
versionId: scid,
|
|
107
|
-
versionTime: time,
|
|
108
|
-
parameters,
|
|
109
|
-
state
|
|
110
|
-
});
|
|
111
|
-
return signEntry({
|
|
112
|
-
entry: {
|
|
113
|
-
versionId: buildVersionId(1, entryHash),
|
|
114
|
-
versionTime: time,
|
|
115
|
-
parameters,
|
|
116
|
-
state
|
|
117
|
-
},
|
|
118
|
-
signer,
|
|
119
|
-
verificationMethod: anchoredVerificationMethod({
|
|
120
|
-
controller,
|
|
121
|
-
keyMultibase: signer.keyMultibase
|
|
122
|
-
}),
|
|
123
|
-
created: time
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Builds and signs the next ordinary entry against a verified head: full
|
|
128
|
-
* state, empty `parameters`, hash chained off the head's `versionId`, proof
|
|
129
|
-
* anchored at the controller's verified head. Callers hold a verified head
|
|
130
|
-
* by construction (an entry is never built on an unverified one).
|
|
131
|
-
*
|
|
132
|
-
* @param options {object}
|
|
133
|
-
* @param options.head {ResourceLogEntry} the verified head entry
|
|
134
|
-
* @param options.state {ResourceLogEntry['state']} the full next state
|
|
135
|
-
* @param options.controller {ResourceLogController}
|
|
136
|
-
* @param options.signer {ResourceLogSigner}
|
|
137
|
-
* @param [options.versionTime] {string} RFC3339 UTC; defaults to now
|
|
138
|
-
* @returns {Promise<ResourceLogEntry>}
|
|
139
|
-
*/
|
|
140
|
-
export async function buildResourceLogEntry({ head, state, controller, signer, versionTime }) {
|
|
141
|
-
checkState(state);
|
|
142
|
-
const time = versionTime ?? new Date().toISOString();
|
|
143
|
-
const headOrdinal = Number.parseInt(head.versionId, 10);
|
|
144
|
-
const ordinal = headOrdinal + 1;
|
|
145
|
-
parseAndValidateVersionId(head.versionId, headOrdinal);
|
|
146
|
-
const entryHash = await deriveHash({
|
|
147
|
-
versionId: head.versionId,
|
|
148
|
-
versionTime: time,
|
|
149
|
-
parameters: {},
|
|
150
|
-
state
|
|
151
|
-
});
|
|
152
|
-
return signEntry({
|
|
153
|
-
entry: {
|
|
154
|
-
versionId: buildVersionId(ordinal, entryHash),
|
|
155
|
-
versionTime: time,
|
|
156
|
-
parameters: {},
|
|
157
|
-
state
|
|
158
|
-
},
|
|
159
|
-
signer,
|
|
160
|
-
verificationMethod: anchoredVerificationMethod({
|
|
161
|
-
controller,
|
|
162
|
-
keyMultibase: signer.keyMultibase
|
|
163
|
-
}),
|
|
164
|
-
created: time
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
//# sourceMappingURL=entry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"entry.js","sourceRoot":"","sources":["../../src/resourceLog/entry.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;GAQG;AACH,OAAO,EACL,cAAc,EACd,gCAAgC,EAChC,UAAU,EACV,yBAAyB,EACzB,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,2BAA2B,CAAA;AAgBlC;;;;;;;;;;GAUG;AACH,SAAS,0BAA0B,CAAC,EAClC,UAAU,EACV,YAAY,EAIb;IACC,MAAM,MAAM,GAAG,UAAU,CAAC,UAAU,CAAC,UAAU,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;IACtE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AAC,CAAA;IAC/B,yBAAyB,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAA;IACtD,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC;QACjC,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,WAAW,EAAE,IAAI;QACjB,UAAU,EAAE,EAAE;QACd,KAAK;KACN,CAAC,CAAA;IACF,OAAO,SAAS,CAAC;QACf,KAAK,EAAE;YACL,SAAS,EAAE,cAAc,CAAC,OAAO,EAAE,SAAS,CAAC;YAC7C,WAAW,EAAE,IAAI;YACjB,UAAU,EAAE,EAAE;YACd,KAAK;SACN;QACD,MAAM;QACN,kBAAkB,EAAE,0BAA0B,CAAC;YAC7C,UAAU;YACV,YAAY,EAAE,MAAM,CAAC,YAAY;SAClC,CAAC;QACF,OAAO,EAAE,IAAI;KACd,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* The chain-head pin: the client-local durable record of a resource log's
|
|
6
|
-
* verified identity and latest verified head, kept per log beside the app's
|
|
7
|
-
* other continuity pins (the account pointer, the roster epoch pin). The pin
|
|
8
|
-
* is what turns one-shot verification into continuity: a served log whose
|
|
9
|
-
* SCID or method differs from the pin outside a verified handover, or whose
|
|
10
|
-
* history is not a descendant of the pinned head, is refused instead of
|
|
11
|
-
* adopted. Storage is the app's concern (freewallet: beside its other pins in
|
|
12
|
-
* localStorage; DCW: a table row), so only the seam lives here, plus an
|
|
13
|
-
* in-memory implementation for tests and single-session use.
|
|
14
|
-
*
|
|
15
|
-
* The seam is keyed: every read and write names the log it concerns with a
|
|
16
|
-
* `logId`, so one store instance serves every log a wallet holds. Wallet-core
|
|
17
|
-
* supplies the key at every call, built by {@link resourceLogPinId} (or one of
|
|
18
|
-
* the named builders over it), so an app implements one keyed store and never
|
|
19
|
-
* chooses keys itself.
|
|
20
|
-
*/
|
|
21
|
-
/**
|
|
22
|
-
* One log's pin: the format identifier from the genesis `parameters.method`,
|
|
23
|
-
* the SCID, and the `versionId` of the latest verified head. Established at
|
|
24
|
-
* first contact (trust-on-first-use of the log's identity), advanced only
|
|
25
|
-
* after a full verification whose head is the pinned head or a descendant,
|
|
26
|
-
* and replaced wholesale only across a verified handover.
|
|
27
|
-
*/
|
|
28
|
-
export interface ResourceLogHeadPin {
|
|
29
|
-
method: string;
|
|
30
|
-
scid: string;
|
|
31
|
-
head: string;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Where a client keeps its chain-head pins, one record per log, keyed by
|
|
35
|
-
* `logId`. `read` resolves `null` before first contact with that log. Writes
|
|
36
|
-
* happen only on the two legal transitions (advance after full verification,
|
|
37
|
-
* replace across a verified handover) -- the verifier never regresses a pin.
|
|
38
|
-
*
|
|
39
|
-
* The `logId` uniquely names one log among all the logs this store instance
|
|
40
|
-
* serves: one store may serve every log a wallet holds, keyed per log, and two
|
|
41
|
-
* different logs must never share a `logId`. Wallet-core supplies the key at
|
|
42
|
-
* every read and write, built by {@link resourceLogPinId} (or one of the named
|
|
43
|
-
* builders over it), so an implementation never chooses keys of its own.
|
|
44
|
-
*/
|
|
45
|
-
export interface ResourceLogPinStore {
|
|
46
|
-
read(options: {
|
|
47
|
-
logId: string;
|
|
48
|
-
}): Promise<ResourceLogHeadPin | null>;
|
|
49
|
-
write(options: {
|
|
50
|
-
logId: string;
|
|
51
|
-
pin: ResourceLogHeadPin;
|
|
52
|
-
}): Promise<void>;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* The pin-slot key for one log: an opaque per-log identity key for pin
|
|
56
|
-
* storage, not a fetchable path or URL.
|
|
57
|
-
*
|
|
58
|
-
* It is deliberately host-free. The `spaceId` is the account's stable random
|
|
59
|
-
* id, so a log served from a claimed new host lands in the SAME pin slot and
|
|
60
|
-
* is checked against the pin already held, rather than opening a fresh
|
|
61
|
-
* trust-on-first-use slate (the mirror-fork concern).
|
|
62
|
-
*
|
|
63
|
-
* @param options {object}
|
|
64
|
-
* @param options.spaceId {string} the Space the log lives in
|
|
65
|
-
* @param options.collectionId {string} the collection holding the log
|
|
66
|
-
* @param options.resourceId {string} the log resource's id
|
|
67
|
-
* @returns {string}
|
|
68
|
-
*/
|
|
69
|
-
export declare function resourceLogPinId({ spaceId, collectionId, resourceId }: {
|
|
70
|
-
spaceId: string;
|
|
71
|
-
collectionId: string;
|
|
72
|
-
resourceId: string;
|
|
73
|
-
}): string;
|
|
74
|
-
/**
|
|
75
|
-
* An in-memory pin store: continuity within one session only, keyed by
|
|
76
|
-
* `logId` like any other implementation, so one instance serves several logs.
|
|
77
|
-
* Tests use it as the seam's reference implementation; apps persist for real.
|
|
78
|
-
*
|
|
79
|
-
* @returns {ResourceLogPinStore}
|
|
80
|
-
*/
|
|
81
|
-
export declare function memoryResourceLogPinStore(): ResourceLogPinStore;
|
|
82
|
-
//# sourceMappingURL=pin.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pin.d.ts","sourceRoot":"","sources":["../../src/resourceLog/pin.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAAA;IACpE,KAAK,CAAC,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,kBAAkB,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAC1E;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,OAAO,EACP,YAAY,EACZ,UAAU,EACX,EAAE;IACD,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;CACnB,GAAG,MAAM,CAET;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,IAAI,mBAAmB,CAU/D"}
|
package/dist/resourceLog/pin.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* The chain-head pin: the client-local durable record of a resource log's
|
|
6
|
-
* verified identity and latest verified head, kept per log beside the app's
|
|
7
|
-
* other continuity pins (the account pointer, the roster epoch pin). The pin
|
|
8
|
-
* is what turns one-shot verification into continuity: a served log whose
|
|
9
|
-
* SCID or method differs from the pin outside a verified handover, or whose
|
|
10
|
-
* history is not a descendant of the pinned head, is refused instead of
|
|
11
|
-
* adopted. Storage is the app's concern (freewallet: beside its other pins in
|
|
12
|
-
* localStorage; DCW: a table row), so only the seam lives here, plus an
|
|
13
|
-
* in-memory implementation for tests and single-session use.
|
|
14
|
-
*
|
|
15
|
-
* The seam is keyed: every read and write names the log it concerns with a
|
|
16
|
-
* `logId`, so one store instance serves every log a wallet holds. Wallet-core
|
|
17
|
-
* supplies the key at every call, built by {@link resourceLogPinId} (or one of
|
|
18
|
-
* the named builders over it), so an app implements one keyed store and never
|
|
19
|
-
* chooses keys itself.
|
|
20
|
-
*/
|
|
21
|
-
/**
|
|
22
|
-
* The pin-slot key for one log: an opaque per-log identity key for pin
|
|
23
|
-
* storage, not a fetchable path or URL.
|
|
24
|
-
*
|
|
25
|
-
* It is deliberately host-free. The `spaceId` is the account's stable random
|
|
26
|
-
* id, so a log served from a claimed new host lands in the SAME pin slot and
|
|
27
|
-
* is checked against the pin already held, rather than opening a fresh
|
|
28
|
-
* trust-on-first-use slate (the mirror-fork concern).
|
|
29
|
-
*
|
|
30
|
-
* @param options {object}
|
|
31
|
-
* @param options.spaceId {string} the Space the log lives in
|
|
32
|
-
* @param options.collectionId {string} the collection holding the log
|
|
33
|
-
* @param options.resourceId {string} the log resource's id
|
|
34
|
-
* @returns {string}
|
|
35
|
-
*/
|
|
36
|
-
export function resourceLogPinId({ spaceId, collectionId, resourceId }) {
|
|
37
|
-
return `space/${spaceId}/${collectionId}/${resourceId}`;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* An in-memory pin store: continuity within one session only, keyed by
|
|
41
|
-
* `logId` like any other implementation, so one instance serves several logs.
|
|
42
|
-
* Tests use it as the seam's reference implementation; apps persist for real.
|
|
43
|
-
*
|
|
44
|
-
* @returns {ResourceLogPinStore}
|
|
45
|
-
*/
|
|
46
|
-
export function memoryResourceLogPinStore() {
|
|
47
|
-
const pins = new Map();
|
|
48
|
-
return {
|
|
49
|
-
async read({ logId }) {
|
|
50
|
-
return pins.get(logId) ?? null;
|
|
51
|
-
},
|
|
52
|
-
async write({ logId, pin }) {
|
|
53
|
-
pins.set(logId, pin);
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
//# sourceMappingURL=pin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pin.js","sourceRoot":"","sources":["../../src/resourceLog/pin.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;GAgBG;AAgCH;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAC/B,OAAO,EACP,YAAY,EACZ,UAAU,EAKX;IACC,OAAO,SAAS,OAAO,IAAI,YAAY,IAAI,UAAU,EAAE,CAAA;AACzD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB;IACvC,MAAM,IAAI,GAAG,IAAI,GAAG,EAA8B,CAAA;IAClD,OAAO;QACL,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE;YAClB,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,IAAI,CAAA;QAChC,CAAC;QACD,KAAK,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE;YACxB,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;QACtB,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -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,S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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,UA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