@interop/wallet-core 0.24.0 → 0.26.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 +18 -14
- package/dist/clients/index.d.ts +6 -4
- package/dist/clients/index.d.ts.map +1 -1
- package/dist/clients/index.js +5 -3
- package/dist/clients/index.js.map +1 -1
- package/dist/clients/policy.d.ts +11 -3
- package/dist/clients/policy.d.ts.map +1 -1
- package/dist/clients/policy.js +12 -4
- package/dist/clients/policy.js.map +1 -1
- package/dist/clients/revocation.d.ts +21 -3
- package/dist/clients/revocation.d.ts.map +1 -1
- package/dist/clients/revocation.js +18 -1
- package/dist/clients/revocation.js.map +1 -1
- package/dist/clients/rosterPolicy.d.ts +12 -5
- package/dist/clients/rosterPolicy.d.ts.map +1 -1
- package/dist/clients/rosterPolicy.js +28 -4
- package/dist/clients/rosterPolicy.js.map +1 -1
- package/dist/descriptors/acquire.d.ts +4 -1
- package/dist/descriptors/acquire.d.ts.map +1 -1
- package/dist/descriptors/acquire.js +29 -1
- package/dist/descriptors/acquire.js.map +1 -1
- package/dist/descriptors/index.d.ts +9 -1
- package/dist/descriptors/index.d.ts.map +1 -1
- package/dist/descriptors/index.js +9 -1
- package/dist/descriptors/index.js.map +1 -1
- package/dist/descriptors/logSource.d.ts +33 -0
- package/dist/descriptors/logSource.d.ts.map +1 -0
- package/dist/descriptors/logSource.js +49 -0
- package/dist/descriptors/logSource.js.map +1 -0
- package/dist/keys/index.d.ts +6 -2
- package/dist/keys/index.d.ts.map +1 -1
- package/dist/keys/index.js +5 -2
- package/dist/keys/index.js.map +1 -1
- package/dist/keys/rosterLogStore.d.ts +24 -5
- package/dist/keys/rosterLogStore.d.ts.map +1 -1
- package/dist/keys/rosterLogStore.js +29 -5
- package/dist/keys/rosterLogStore.js.map +1 -1
- package/dist/keys/rosterStore.d.ts +3 -3
- package/dist/keys/rosterStore.d.ts.map +1 -1
- package/dist/keys/rosterStore.js +1 -1
- package/dist/keys/rosterStore.js.map +1 -1
- package/dist/keys/userKeyCascade.d.ts +13 -6
- package/dist/keys/userKeyCascade.d.ts.map +1 -1
- package/dist/keys/userKeyCascade.js +11 -2
- package/dist/keys/userKeyCascade.js.map +1 -1
- package/dist/request/appKey.d.ts +8 -7
- package/dist/request/appKey.d.ts.map +1 -1
- package/dist/request/appKey.js +17 -23
- package/dist/request/appKey.js.map +1 -1
- package/dist/request/composeVp.d.ts +6 -7
- package/dist/request/composeVp.d.ts.map +1 -1
- package/dist/request/composeVp.js +44 -55
- package/dist/request/composeVp.js.map +1 -1
- package/dist/request/processRequest.d.ts +1 -4
- package/dist/request/processRequest.d.ts.map +1 -1
- package/dist/request/processRequest.js +2 -5
- package/dist/request/processRequest.js.map +1 -1
- package/dist/resourceLog/index.d.ts +5 -2
- package/dist/resourceLog/index.d.ts.map +1 -1
- package/dist/resourceLog/index.js +5 -2
- package/dist/resourceLog/index.js.map +1 -1
- package/dist/resourceLog/seal.d.ts +86 -0
- package/dist/resourceLog/seal.d.ts.map +1 -0
- package/dist/resourceLog/seal.js +99 -0
- package/dist/resourceLog/seal.js.map +1 -0
- package/dist/resourceLog/verify.d.ts +7 -1
- package/dist/resourceLog/verify.d.ts.map +1 -1
- package/dist/resourceLog/verify.js +1 -0
- package/dist/resourceLog/verify.js.map +1 -1
- package/dist/space/activity.d.ts +6 -3
- package/dist/space/activity.d.ts.map +1 -1
- package/dist/space/activity.js +5 -3
- package/dist/space/activity.js.map +1 -1
- package/package.json +2 -1
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { IDocumentLoader } from '@interop/data-integrity-core';
|
|
2
2
|
import type { IVerifiablePresentation, IVerifiableCredential, IZcap, PresentationSigner } from './types.js';
|
|
3
3
|
/**
|
|
4
|
-
* Shared JSON-LD document loader for presentation and credential signing
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Shared JSON-LD document loader for presentation and credential signing: the
|
|
5
|
+
* standard security contexts plus the hosted App Connect context, resolved
|
|
6
|
+
* from the bundled `byoe-context` document so neither signing nor verification
|
|
7
|
+
* fetches it. Exported so single-VC issuance paths reuse the same context
|
|
8
|
+
* resolution the VP compose path uses.
|
|
7
9
|
*/
|
|
8
10
|
export declare const documentLoader: IDocumentLoader;
|
|
9
11
|
/**
|
|
@@ -25,13 +27,11 @@ export declare const documentLoader: IDocumentLoader;
|
|
|
25
27
|
* VP's `zcap` array (before signing, so a DIDAuth proof covers them).
|
|
26
28
|
* @param [options.appConnect] {{ firstRun: boolean }} - App Connect response
|
|
27
29
|
* marker to embed (before signing, like the grants).
|
|
28
|
-
* @param [options.vocabBaseIri] {string} - Vocabulary base IRI for the embedded
|
|
29
|
-
* term definitions; defaults to Freewallet's value.
|
|
30
30
|
* @param [options.documentLoader] {IDocumentLoader} - JSON-LD loader; defaults
|
|
31
31
|
* to the shared security loader.
|
|
32
32
|
* @returns {Promise<IVerifiablePresentation>}
|
|
33
33
|
*/
|
|
34
|
-
export declare function composeVp({ presentationSigner, selectedVcs, challenge, domain, didAuthRequested, cryptosuite, zcaps, appConnect,
|
|
34
|
+
export declare function composeVp({ presentationSigner, selectedVcs, challenge, domain, didAuthRequested, cryptosuite, zcaps, appConnect, documentLoader: loader }: {
|
|
35
35
|
presentationSigner?: PresentationSigner;
|
|
36
36
|
selectedVcs?: IVerifiableCredential[];
|
|
37
37
|
challenge?: string;
|
|
@@ -42,7 +42,6 @@ export declare function composeVp({ presentationSigner, selectedVcs, challenge,
|
|
|
42
42
|
appConnect?: {
|
|
43
43
|
firstRun: boolean;
|
|
44
44
|
};
|
|
45
|
-
vocabBaseIri?: string;
|
|
46
45
|
documentLoader?: IDocumentLoader;
|
|
47
46
|
}): Promise<IVerifiablePresentation>;
|
|
48
47
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composeVp.d.ts","sourceRoot":"","sources":["../../src/request/composeVp.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"composeVp.d.ts","sourceRoot":"","sources":["../../src/request/composeVp.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAA;AAGnE,OAAO,KAAK,EACV,uBAAuB,EACvB,qBAAqB,EACrB,KAAK,EACL,kBAAkB,EACnB,MAAM,YAAY,CAAA;AAEnB;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,EAAE,eAMzB,CAAA;AAsFJ;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,SAAS,CAAC,EAC9B,kBAAkB,EAClB,WAAgB,EAChB,SAAS,EACT,MAAM,EACN,gBAAgB,EAChB,WAAW,EACX,KAAU,EACV,UAAU,EACV,cAAc,EAAE,MAAuB,EACxC,EAAE;IACD,kBAAkB,CAAC,EAAE,kBAAkB,CAAA;IACvC,WAAW,CAAC,EAAE,qBAAqB,EAAE,CAAA;IACrC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,gBAAgB,EAAE,OAAO,CAAA;IACzB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,CAAC,EAAE,KAAK,EAAE,CAAA;IACf,UAAU,CAAC,EAAE;QAAE,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAA;IAClC,cAAc,CAAC,EAAE,eAAe,CAAA;CACjC,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAyDnC;AAED;;;GAGG;AACH,eAAO,MAAM,SAAS,kBAAY,CAAA"}
|
|
@@ -18,23 +18,31 @@
|
|
|
18
18
|
*/
|
|
19
19
|
import * as vc from '@interop/vc';
|
|
20
20
|
import { securityLoader } from '@interop/security-document-loader';
|
|
21
|
+
import { contexts as byoeContexts, CONTEXT_URL_V1 } from 'byoe-context';
|
|
21
22
|
import { presentationSuiteFor } from './presentationSuite.js';
|
|
22
23
|
import { presentationVersionFor } from './classify.js';
|
|
23
24
|
/**
|
|
24
|
-
* Shared JSON-LD document loader for presentation and credential signing
|
|
25
|
-
*
|
|
26
|
-
*
|
|
25
|
+
* Shared JSON-LD document loader for presentation and credential signing: the
|
|
26
|
+
* standard security contexts plus the hosted App Connect context, resolved
|
|
27
|
+
* from the bundled `byoe-context` document so neither signing nor verification
|
|
28
|
+
* fetches it. Exported so single-VC issuance paths reuse the same context
|
|
29
|
+
* resolution the VP compose path uses.
|
|
27
30
|
*/
|
|
28
|
-
export const documentLoader =
|
|
29
|
-
fetchRemoteContexts: true
|
|
30
|
-
|
|
31
|
+
export const documentLoader = (() => {
|
|
32
|
+
const loader = securityLoader({ fetchRemoteContexts: true });
|
|
33
|
+
for (const [url, context] of byoeContexts) {
|
|
34
|
+
loader.addStatic(url, context);
|
|
35
|
+
}
|
|
36
|
+
return loader.build();
|
|
37
|
+
})();
|
|
31
38
|
/**
|
|
32
|
-
* The
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
39
|
+
* The hosted App Connect context URL appended to the VP `@context` when grants
|
|
40
|
+
* or the App Connect response marker are embedded. The context document
|
|
41
|
+
* defines the `zcap` (`@container: @set`) and `appConnect` (`@type: @json`)
|
|
42
|
+
* terms, which is what lets JSON-LD safe-mode canonicalization include (rather
|
|
43
|
+
* than reject) the members, so the authentication proof genuinely covers them.
|
|
36
44
|
*/
|
|
37
|
-
const
|
|
45
|
+
const APP_CONNECT_CONTEXT_URL = CONTEXT_URL_V1;
|
|
38
46
|
/**
|
|
39
47
|
* Reads a presentation's `@context` as a mutable array of entries.
|
|
40
48
|
*/
|
|
@@ -50,58 +58,41 @@ function setContext(presentation, entries) {
|
|
|
50
58
|
presentation['@context'] = entries;
|
|
51
59
|
}
|
|
52
60
|
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* canonicalization include (rather than reject) the grants, so the
|
|
58
|
-
* authentication proof genuinely covers them.
|
|
59
|
-
*/
|
|
60
|
-
function zcapTermContext(vocabBaseIri) {
|
|
61
|
-
return {
|
|
62
|
-
'@protected': true,
|
|
63
|
-
zcap: { '@id': `${vocabBaseIri}zcap`, '@container': '@set' }
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* The `appConnect` term definition appended to the VP `@context` when an App
|
|
68
|
-
* Connect response marker is embedded. The member is a JSON literal
|
|
69
|
-
* (`@type: '@json'`) so its `firstRun` boolean canonicalizes as one opaque
|
|
70
|
-
* value; embedding happens before signing, so the DIDAuth proof covers the
|
|
71
|
-
* marker the same way it covers the grants.
|
|
61
|
+
* Appends the hosted App Connect context URL to the presentation's `@context`,
|
|
62
|
+
* once: a response carrying both grants and the marker still appends a single
|
|
63
|
+
* entry. Each embedded zcap additionally self-describes via its own
|
|
64
|
+
* `@context`; the profile context defines only the top-level members.
|
|
72
65
|
*/
|
|
73
|
-
function
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
66
|
+
function appendAppConnectContext(presentation) {
|
|
67
|
+
const entries = contextEntries(presentation);
|
|
68
|
+
if (entries.includes(APP_CONNECT_CONTEXT_URL)) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
setContext(presentation, [...entries, APP_CONNECT_CONTEXT_URL]);
|
|
78
72
|
}
|
|
79
73
|
/**
|
|
80
|
-
* Embeds the delegated capabilities on the presentation and
|
|
81
|
-
* `zcap` term
|
|
74
|
+
* Embeds the delegated capabilities on the presentation and appends the App
|
|
75
|
+
* Connect context that defines the `zcap` term.
|
|
82
76
|
*/
|
|
83
|
-
function embedZcaps(presentation, zcaps
|
|
77
|
+
function embedZcaps(presentation, zcaps) {
|
|
84
78
|
if (zcaps.length === 0) {
|
|
85
79
|
return;
|
|
86
80
|
}
|
|
87
|
-
|
|
88
|
-
...contextEntries(presentation),
|
|
89
|
-
zcapTermContext(vocabBaseIri)
|
|
90
|
-
]);
|
|
81
|
+
appendAppConnectContext(presentation);
|
|
91
82
|
presentation.zcap = zcaps;
|
|
92
83
|
}
|
|
93
84
|
/**
|
|
94
85
|
* Embeds the App Connect response marker (the wallet-provided `firstRun`
|
|
95
|
-
* signal) on the presentation and
|
|
86
|
+
* signal) on the presentation and appends the App Connect context that defines
|
|
87
|
+
* the `appConnect` term (a JSON literal, so its `firstRun` boolean
|
|
88
|
+
* canonicalizes as one opaque value; embedding happens before signing, so the
|
|
89
|
+
* DIDAuth proof covers the marker the same way it covers the grants).
|
|
96
90
|
*/
|
|
97
|
-
function embedAppConnect(presentation, appConnect
|
|
91
|
+
function embedAppConnect(presentation, appConnect) {
|
|
98
92
|
if (!appConnect) {
|
|
99
93
|
return;
|
|
100
94
|
}
|
|
101
|
-
|
|
102
|
-
...contextEntries(presentation),
|
|
103
|
-
appConnectTermContext(vocabBaseIri)
|
|
104
|
-
]);
|
|
95
|
+
appendAppConnectContext(presentation);
|
|
105
96
|
presentation.appConnect = appConnect;
|
|
106
97
|
}
|
|
107
98
|
/**
|
|
@@ -123,13 +114,11 @@ function embedAppConnect(presentation, appConnect, vocabBaseIri) {
|
|
|
123
114
|
* VP's `zcap` array (before signing, so a DIDAuth proof covers them).
|
|
124
115
|
* @param [options.appConnect] {{ firstRun: boolean }} - App Connect response
|
|
125
116
|
* marker to embed (before signing, like the grants).
|
|
126
|
-
* @param [options.vocabBaseIri] {string} - Vocabulary base IRI for the embedded
|
|
127
|
-
* term definitions; defaults to Freewallet's value.
|
|
128
117
|
* @param [options.documentLoader] {IDocumentLoader} - JSON-LD loader; defaults
|
|
129
118
|
* to the shared security loader.
|
|
130
119
|
* @returns {Promise<IVerifiablePresentation>}
|
|
131
120
|
*/
|
|
132
|
-
export async function composeVp({ presentationSigner, selectedVcs = [], challenge, domain, didAuthRequested, cryptosuite, zcaps = [], appConnect,
|
|
121
|
+
export async function composeVp({ presentationSigner, selectedVcs = [], challenge, domain, didAuthRequested, cryptosuite, zcaps = [], appConnect, documentLoader: loader = documentLoader }) {
|
|
133
122
|
if (!didAuthRequested && selectedVcs.length === 0 && zcaps.length === 0) {
|
|
134
123
|
throw new Error('A VP requires credentials, capabilities, or a DID Auth request.');
|
|
135
124
|
}
|
|
@@ -147,8 +136,8 @@ export async function composeVp({ presentationSigner, selectedVcs = [], challeng
|
|
|
147
136
|
verify: false,
|
|
148
137
|
version: presentationVersionFor(selectedVcs)
|
|
149
138
|
});
|
|
150
|
-
embedZcaps(presentation, zcaps
|
|
151
|
-
embedAppConnect(presentation, appConnect
|
|
139
|
+
embedZcaps(presentation, zcaps);
|
|
140
|
+
embedAppConnect(presentation, appConnect);
|
|
152
141
|
return presentation;
|
|
153
142
|
}
|
|
154
143
|
if (!presentationSigner) {
|
|
@@ -169,8 +158,8 @@ export async function composeVp({ presentationSigner, selectedVcs = [], challeng
|
|
|
169
158
|
// Embed the grants (and any App Connect marker) before signing so the
|
|
170
159
|
// authentication proof covers them; the grants additionally self-authenticate
|
|
171
160
|
// via their own delegation proofs and carry their own `@context`.
|
|
172
|
-
embedZcaps(presentation, zcaps
|
|
173
|
-
embedAppConnect(presentation, appConnect
|
|
161
|
+
embedZcaps(presentation, zcaps);
|
|
162
|
+
embedAppConnect(presentation, appConnect);
|
|
174
163
|
return (await vc.signPresentation({
|
|
175
164
|
presentation,
|
|
176
165
|
challenge,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composeVp.js","sourceRoot":"","sources":["../../src/request/composeVp.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAA;
|
|
1
|
+
{"version":3,"file":"composeVp.js","sourceRoot":"","sources":["../../src/request/composeVp.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAClE,OAAO,EAAE,QAAQ,IAAI,YAAY,EAAE,cAAc,EAAE,MA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
32
|
* @param [options.cryptosuite] {string} - Cryptosuite override; when absent it
|
|
33
33
|
* is negotiated from the request's `acceptedCryptosuites`.
|
|
34
|
-
* @param [options.vocabBaseIri] {string} - Vocabulary base IRI passed through to
|
|
35
|
-
* {@link composeVp} for embedded-grant term definitions.
|
|
36
34
|
* @returns {Promise<WalletResponse>} The response VP (and any granted zcaps), or
|
|
37
35
|
* `{}` when there is nothing to send.
|
|
38
36
|
*/
|
|
39
|
-
export declare function processRequest({ request, presentationSigner, selectedVCs, credentialRequestOrigin, processors, cryptosuite
|
|
37
|
+
export declare function processRequest({ request, presentationSigner, selectedVCs, credentialRequestOrigin, processors, cryptosuite }: {
|
|
40
38
|
request: IVPRDetails;
|
|
41
39
|
presentationSigner: PresentationSigner;
|
|
42
40
|
selectedVCs?: IVerifiableCredential[];
|
|
43
41
|
credentialRequestOrigin?: string;
|
|
44
42
|
processors?: RequestProcessors;
|
|
45
43
|
cryptosuite?: string;
|
|
46
|
-
vocabBaseIri?: string;
|
|
47
44
|
}): Promise<WalletResponse>;
|
|
48
45
|
//# sourceMappingURL=processRequest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processRequest.d.ts","sourceRoot":"","sources":["../../src/request/processRequest.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EACV,qBAAqB,EACrB,WAAW,EAEX,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACf,MAAM,YAAY,CAAA;AAkBnB;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,MAAM,EACN,MAAM,EACP,EAAE;IACD,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,GAAG,OAAO,CAOV;AAED
|
|
1
|
+
{"version":3,"file":"processRequest.d.ts","sourceRoot":"","sources":["../../src/request/processRequest.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EACV,qBAAqB,EACrB,WAAW,EAEX,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACf,MAAM,YAAY,CAAA;AAkBnB;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,MAAM,EACN,MAAM,EACP,EAAE;IACD,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,GAAG,OAAO,CAOV;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,cAAc,CAAC,EACnC,OAAO,EACP,kBAAkB,EAClB,WAAgB,EAChB,uBAAuB,EACvB,UAAU,EACV,WAAW,EACZ,EAAE;IACD,OAAO,EAAE,WAAW,CAAA;IACpB,kBAAkB,EAAE,kBAAkB,CAAA;IACtC,WAAW,CAAC,EAAE,qBAAqB,EAAE,CAAA;IACrC,uBAAuB,CAAC,EAAE,MAAM,CAAA;IAChC,UAAU,CAAC,EAAE,iBAAiB,CAAA;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,GAAG,OAAO,CAAC,cAAc,CAAC,CAkF1B"}
|
|
@@ -70,12 +70,10 @@ export function domainMatchesOrigin({ domain, origin }) {
|
|
|
70
70
|
* App Connect processors.
|
|
71
71
|
* @param [options.cryptosuite] {string} - Cryptosuite override; when absent it
|
|
72
72
|
* is negotiated from the request's `acceptedCryptosuites`.
|
|
73
|
-
* @param [options.vocabBaseIri] {string} - Vocabulary base IRI passed through to
|
|
74
|
-
* {@link composeVp} for embedded-grant term definitions.
|
|
75
73
|
* @returns {Promise<WalletResponse>} The response VP (and any granted zcaps), or
|
|
76
74
|
* `{}` when there is nothing to send.
|
|
77
75
|
*/
|
|
78
|
-
export async function processRequest({ request, presentationSigner, selectedVCs = [], credentialRequestOrigin, processors, cryptosuite
|
|
76
|
+
export async function processRequest({ request, presentationSigner, selectedVCs = [], credentialRequestOrigin, processors, cryptosuite }) {
|
|
79
77
|
const { didAuth, zcapRequests } = classifyRequest(request);
|
|
80
78
|
const queries = queriesOf(request);
|
|
81
79
|
const { challenge, domain } = request;
|
|
@@ -137,8 +135,7 @@ export async function processRequest({ request, presentationSigner, selectedVCs
|
|
|
137
135
|
domain,
|
|
138
136
|
didAuthRequested: didAuth,
|
|
139
137
|
cryptosuite: negotiatedCryptosuite,
|
|
140
|
-
zcaps
|
|
141
|
-
...(vocabBaseIri !== undefined && { vocabBaseIri })
|
|
138
|
+
zcaps
|
|
142
139
|
});
|
|
143
140
|
// Return the delegated capabilities alongside the VP so the caller can log
|
|
144
141
|
// exactly what was granted from these objects, rather than reading them back
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processRequest.js","sourceRoot":"","sources":["../../src/request/processRequest.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAU7D;;;GAGG;AACH,SAAS,MAAM,CAAC,KAAa;IAC3B,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC;YAC/B,CAAC,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC;YAChB,CAAC,CAAC,IAAI,GAAG,CAAC,WAAW,KAAK,EAAE,CAAC,CAAA;QAC/B,OAAO,GAAG,CAAC,IAAI,CAAA;IACjB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,IAAI,CAAC,8BAA8B,KAAK,IAAI,EAAE,GAAG,CAAC,CAAA;QAC1D,OAAO,SAAS,CAAA;IAClB,CAAC;AACH,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,mBAAmB,CAAC,EAClC,MAAM,EACN,MAAM,EAIP;IACC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,KAAK,CAAA;IACd,CAAC;IACD,MAAM,UAAU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OAAO;YACP,MAAM,EAAE,uBAAuB;SAChC,CAAC,CAAA;QACF,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAA;QAChE,CAAC;QACD,OAAO,UAAU,CAAC,iBAAiB,CAAC;YAClC,OAAO;YACP,UAAU;YACV,MAAM,EAAE,uBAAuB;YAC/B,SAAS;YACT,MAAM;YACN,gBAAgB,EAAE,OAAO;YACzB,WAAW,EAAE,qBAAqB;SACnC,CAAC,CAAA;IACJ,CAAC;IAED,uEAAuE;IACvE,MAAM,KAAK,GACT,YAAY,CAAC,MAAM,GAAG,CAAC,IAAI,UAAU,EAAE,YAAY;QACjD,CAAC,CAAC,MAAM,UAAU,CAAC,YAAY,CAAC,EAAE,YAAY,EAAE,CAAC;QACjD,CAAC,CAAC,EAAE,CAAA;IAER,IAAI,CAAC,OAAO,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC/D,mEAAmE;QACnE,OAAO,EAAE,CAAA;IACX,CAAC;IAED,MAAM,sBAAsB,GAAG,MAAM,SAAS,CAAC;QAC7C,kBAAkB;QAClB,WAAW,EAAE,WAAW;QACxB,SAAS;QACT,MAAM;QACN,gBAAgB,EAAE,OAAO;QACzB,WAAW,EAAE,qBAAqB;QAClC,KAAK;KACN,CAAC,CAAA;IACF,2EAA2E;IAC3E,6EAA6E;IAC7E,uBAAuB;IACvB,OAAO,EAAE,sBAAsB,EAAE,KAAK,EAAE,CAAA;AAC1C,CAAC"}
|
|
@@ -7,8 +7,10 @@
|
|
|
7
7
|
* chain verification against an adversarial host (parse shape, SCID and
|
|
8
8
|
* entry-hash recomputation, entry proofs, the external-authorization rule
|
|
9
9
|
* against the independently verified did:webvh controller document, terminal
|
|
10
|
-
* entries), the chain-head pin with its continuity rules,
|
|
11
|
-
* (verified-head build, CAS with rebase-and-retry, read-back confirmation)
|
|
10
|
+
* entries), the chain-head pin with its continuity rules, the append path
|
|
11
|
+
* (verified-head build, CAS with rebase-and-retry, read-back confirmation),
|
|
12
|
+
* and the sealing sweep (the idempotent backstop append that re-anchors a
|
|
13
|
+
* log's head past the controller's latest membership change).
|
|
12
14
|
* Transport (JSON Lines, the store seam, the projection write) lives in
|
|
13
15
|
* `@interop/was-client/log`; the hashing and proof kernel in
|
|
14
16
|
* `@interop/did-method-webvh`. Kept out of the root export: this subpath
|
|
@@ -20,4 +22,5 @@ export { buildResourceLogEntry, buildResourceLogGenesis, type ResourceLogSigner
|
|
|
20
22
|
export { memoryResourceLogPinStore, type ResourceLogHeadPin, type ResourceLogPinStore } from './pin.js';
|
|
21
23
|
export { isTerminalResourceLogEntry, verifyResourceLog, verifyResourceLogHandover, type VerifiedResourceLog } from './verify.js';
|
|
22
24
|
export { appendResourceLog, createResourceLog, readResourceLog } from './append.js';
|
|
25
|
+
export { latestAssertionRemovalIndex, sealResourceLog } from './seal.js';
|
|
23
26
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resourceLog/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resourceLog/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;GAcG;AACH,OAAO,EACL,0BAA0B,EAC1B,KAAK,qBAAqB,EAC3B,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,sBAAsB,EACtB,0BAA0B,EAC1B,yBAAyB,EAC1B,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,KAAK,iBAAiB,EACvB,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,yBAAyB,EACzB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACzB,MAAM,UAAU,CAAA;AACjB,OAAO,EACL,0BAA0B,EAC1B,iBAAiB,EACjB,yBAAyB,EACzB,KAAK,mBAAmB,EACzB,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EAChB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,2BAA2B,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA"}
|
|
@@ -7,8 +7,10 @@
|
|
|
7
7
|
* chain verification against an adversarial host (parse shape, SCID and
|
|
8
8
|
* entry-hash recomputation, entry proofs, the external-authorization rule
|
|
9
9
|
* against the independently verified did:webvh controller document, terminal
|
|
10
|
-
* entries), the chain-head pin with its continuity rules,
|
|
11
|
-
* (verified-head build, CAS with rebase-and-retry, read-back confirmation)
|
|
10
|
+
* entries), the chain-head pin with its continuity rules, the append path
|
|
11
|
+
* (verified-head build, CAS with rebase-and-retry, read-back confirmation),
|
|
12
|
+
* and the sealing sweep (the idempotent backstop append that re-anchors a
|
|
13
|
+
* log's head past the controller's latest membership change).
|
|
12
14
|
* Transport (JSON Lines, the store seam, the projection write) lives in
|
|
13
15
|
* `@interop/was-client/log`; the hashing and proof kernel in
|
|
14
16
|
* `@interop/did-method-webvh`. Kept out of the root export: this subpath
|
|
@@ -20,4 +22,5 @@ export { buildResourceLogEntry, buildResourceLogGenesis } from './entry.js';
|
|
|
20
22
|
export { memoryResourceLogPinStore } from './pin.js';
|
|
21
23
|
export { isTerminalResourceLogEntry, verifyResourceLog, verifyResourceLogHandover } from './verify.js';
|
|
22
24
|
export { appendResourceLog, createResourceLog, readResourceLog } from './append.js';
|
|
25
|
+
export { latestAssertionRemovalIndex, sealResourceLog } from './seal.js';
|
|
23
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resourceLog/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resourceLog/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;GAcG;AACH,OAAO,EACL,0BAA0B,EAE3B,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,sBAAsB,EACtB,0BAA0B,EAC1B,yBAAyB,EAC1B,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EAExB,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,yBAAyB,EAG1B,MAAM,UAAU,CAAA;AACjB,OAAO,EACL,0BAA0B,EAC1B,iBAAiB,EACjB,yBAAyB,EAE1B,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EAChB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,2BAA2B,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA"}
|
|
@@ -0,0 +1,86 @@
|
|
|
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.signer {ResourceLogSigner} this client's enrolled signing
|
|
71
|
+
* key
|
|
72
|
+
* @param [options.versionTime] {string} RFC3339 UTC; defaults to now
|
|
73
|
+
* @returns {Promise<{ sealed: boolean, verified: VerifiedResourceLog | null }>}
|
|
74
|
+
*/
|
|
75
|
+
export declare function sealResourceLog({ store, controller, expectedMethod, pinStore, signer, versionTime }: {
|
|
76
|
+
store: ResourceLogStore;
|
|
77
|
+
controller: ResourceLogController;
|
|
78
|
+
expectedMethod: string;
|
|
79
|
+
pinStore: ResourceLogPinStore;
|
|
80
|
+
signer: ResourceLogSigner;
|
|
81
|
+
versionTime?: string;
|
|
82
|
+
}): Promise<{
|
|
83
|
+
sealed: boolean;
|
|
84
|
+
verified: VerifiedResourceLog | null;
|
|
85
|
+
}>;
|
|
86
|
+
//# sourceMappingURL=seal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,eAAe,CAAC,EACpC,KAAK,EACL,UAAU,EACV,cAAc,EACd,QAAQ,EACR,MAAM,EACN,WAAW,EACZ,EAAE;IACD,KAAK,EAAE,gBAAgB,CAAA;IACvB,UAAU,EAAE,qBAAqB,CAAA;IACjC,cAAc,EAAE,MAAM,CAAA;IACtB,QAAQ,EAAE,mBAAmB,CAAA;IAC7B,MAAM,EAAE,iBAAiB,CAAA;IACzB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,GAAG,OAAO,CAAC;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,mBAAmB,GAAG,IAAI,CAAA;CAAE,CAAC,CAwCrE"}
|
|
@@ -0,0 +1,99 @@
|
|
|
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.signer {ResourceLogSigner} this client's enrolled signing
|
|
57
|
+
* key
|
|
58
|
+
* @param [options.versionTime] {string} RFC3339 UTC; defaults to now
|
|
59
|
+
* @returns {Promise<{ sealed: boolean, verified: VerifiedResourceLog | null }>}
|
|
60
|
+
*/
|
|
61
|
+
export async function sealResourceLog({ store, controller, expectedMethod, pinStore, signer, versionTime }) {
|
|
62
|
+
if (controller.versionIds.length === 0) {
|
|
63
|
+
return { sealed: false, verified: null };
|
|
64
|
+
}
|
|
65
|
+
const removalIndex = await latestAssertionRemovalIndex({ controller });
|
|
66
|
+
if (removalIndex === 0) {
|
|
67
|
+
return { sealed: false, verified: null };
|
|
68
|
+
}
|
|
69
|
+
const current = await readResourceLog({
|
|
70
|
+
store,
|
|
71
|
+
controller,
|
|
72
|
+
expectedMethod,
|
|
73
|
+
pinStore
|
|
74
|
+
});
|
|
75
|
+
if (current === null) {
|
|
76
|
+
return { sealed: false, verified: null };
|
|
77
|
+
}
|
|
78
|
+
const { verified } = current;
|
|
79
|
+
if (verified.headAnchorIndex !== null &&
|
|
80
|
+
verified.headAnchorIndex >= removalIndex) {
|
|
81
|
+
return { sealed: false, verified };
|
|
82
|
+
}
|
|
83
|
+
const confirmed = await appendResourceLog({
|
|
84
|
+
store,
|
|
85
|
+
controller,
|
|
86
|
+
expectedMethod,
|
|
87
|
+
pinStore,
|
|
88
|
+
signer,
|
|
89
|
+
// The rebase hook doubles as the convergence check: a concurrent writer
|
|
90
|
+
// whose entry already anchors past the removal sealed the log for us.
|
|
91
|
+
buildState: rebased => rebased.headAnchorIndex !== null &&
|
|
92
|
+
rebased.headAnchorIndex >= removalIndex
|
|
93
|
+
? null
|
|
94
|
+
: rebased.head.state,
|
|
95
|
+
...(versionTime === undefined ? {} : { versionTime })
|
|
96
|
+
});
|
|
97
|
+
return { sealed: true, verified: confirmed };
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=seal.js.map
|
|
@@ -0,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C;QACvB,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAA;IAC1C,CAAC;IACD,MAAM,OAAO,GAAG,MAAM,eAAe,CAAC;QACpC,KAAK;QACL,UAAU;QACV,cAAc;QACd,QAAQ;KACT,CAAC,CAAA;IACF,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACrB,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAA;IAC1C,CAAC;IACD,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAA;IAC5B,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,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"}
|
|
@@ -7,7 +7,12 @@ import type { ResourceLogHeadPin } from './pin.js';
|
|
|
7
7
|
* `pin` is the record the caller must store as its new chain-head pin.
|
|
8
8
|
* `terminal` is the head's `nextLog` when the log is closed by a handover
|
|
9
9
|
* entry (appends must be refused), `previousLog` the genesis back-reference
|
|
10
|
-
* when this log is a handover successor.
|
|
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.
|
|
11
16
|
*/
|
|
12
17
|
export interface VerifiedResourceLog {
|
|
13
18
|
entries: ResourceLogEntry[];
|
|
@@ -16,6 +21,7 @@ export interface VerifiedResourceLog {
|
|
|
16
21
|
head: ResourceLogEntry;
|
|
17
22
|
state: ResourceLogEntry['state'];
|
|
18
23
|
pin: ResourceLogHeadPin;
|
|
24
|
+
headAnchorIndex: number | null;
|
|
19
25
|
terminal: {
|
|
20
26
|
method: string;
|
|
21
27
|
scid: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../src/resourceLog/verify.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EACV,gBAAgB,EAEjB,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAK5D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAalD
|
|
1
|
+
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../src/resourceLog/verify.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EACV,gBAAgB,EAEjB,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAK5D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAalD;;;;;;;;;;;;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;AAwOD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;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,CAgN/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"}
|
|
@@ -390,6 +390,7 @@ export async function verifyResourceLog({ entries, controller, expectedMethod, p
|
|
|
390
390
|
head,
|
|
391
391
|
state: head.state,
|
|
392
392
|
pin: { method, scid, head: head.versionId },
|
|
393
|
+
headAnchorIndex: versioned ? anchorFloor : null,
|
|
393
394
|
terminal,
|
|
394
395
|
previousLog: genesisParameters.previousLog ?? null
|
|
395
396
|
};
|