@getvda/bundle 0.1.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/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,30 @@
1
+ Verified Digital Agents (VDA) — Agent Control Plane
2
+ Copyright 2026 getvda.ai
3
+
4
+ This product is licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use these files except in compliance with the License. A copy of the
6
+ License is in the LICENSE file at the repository root and at:
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software distributed
11
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12
+ CONDITIONS OF ANY KIND, either express or implied.
13
+
14
+ ---
15
+
16
+ What these packages do and do NOT carry
17
+ ----------------------------------------
18
+
19
+ The @getvda/* packages VERIFY and ENFORCE governance. They do not carry the
20
+ trust anchors that governance rests on:
21
+
22
+ - Bundle-signing keys (#key-3) live only in getvda's Secret Manager. These
23
+ packages VERIFY a bundle's signature against the public key resolved from
24
+ did:web:acp.getvda.ai; they cannot mint a bundle that verifies.
25
+ - Witness account credentials are the customer's own (customer-managed
26
+ custody). These packages SEAL to a Witness account the caller supplies;
27
+ they carry no standing credential.
28
+
29
+ The code is open. The trust anchors are not in the code — and giving away the
30
+ verifier does not give away the ability to forge what it verifies.
package/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # @getvda/bundle
2
+
3
+ > **Status: pre-1.0 (0.x).** Public API may change between minor versions —
4
+ > pin an exact version if you need stability. Part of the [getvda.ai](https://getvda.ai)
5
+ > governance suite. Honesty discipline: nothing documented here is live unless it
6
+ > says so, boundaries (fail-static, condition-assertion) are stated where they apply,
7
+ > and a stub is labelled a stub.
8
+
9
+ > **What this carries — and what it does not.** This package *verifies and
10
+ > enforces* governance. The trust anchors are not in it: bundle-signing keys
11
+ > (`#key-3`) live only in getvda's Secret Manager, and Witness account
12
+ > credentials are the caller's own (customer-managed custody). It verifies a
13
+ > signature against the public key resolved from `did:web:acp.getvda.ai` and
14
+ > seals to a Witness account you supply — it cannot mint a bundle that verifies,
15
+ > and carries no standing credential. Open code, trust anchors elsewhere.
16
+
17
+ The signed, versioned, content-hashed **governance bundle** (Phase 5a) — the
18
+ runtime projection of approved git state. Agents fetch, verify, cache, and
19
+ evaluate this locally; they never `git pull`.
20
+
21
+ ## Deterministic
22
+
23
+ The signed manifest carries `version`, `environment`, `commitSha`, `contentHash`,
24
+ `did`, `keyId`, `files` — and **no timestamp**. Same commit + version → same
25
+ bytes → same signature. (Activation time lives in the Witness attestation's
26
+ `as_of`, not the bundle.) One Ed25519 signature over the canonical manifest binds
27
+ manifest → files (the manifest carries the files' `contentHash`).
28
+
29
+ ## Signed with #key-3, verified against the DID
30
+
31
+ `Ed25519BundleSigner` signs with ACP's dedicated **bundle-signing key** (`#key-3`
32
+ — separate from the Witness record key `#key-2`: different verifier, different
33
+ lifetime, different blast radius). Agents verify with `verifyBundle(bundle,
34
+ resolver)`:
35
+
36
+ 1. the files still hash to `manifest.contentHash` (no tampering),
37
+ 2. the signature keyId matches the manifest,
38
+ 3. the signature verifies over the canonical manifest against the resolved key.
39
+
40
+ `DidWebKeyResolver` resolves `did:web:acp.getvda.ai#key-3` →
41
+ `https://acp.getvda.ai/.well-known/did.json` → the `verificationMethod[]` entry.
42
+ `StaticKeyResolver` is the offline/test counterpart.
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Build a bundle from approved git state (5a). Deterministic: same commit +
3
+ * version → same bytes.
4
+ */
5
+ import { type GovernanceFileName, type GovernanceSet } from '@getvda/governance-schema';
6
+ import type { UnsignedBundle } from './types.js';
7
+ export interface BuildBundleInput {
8
+ readonly version: string;
9
+ readonly environment: string;
10
+ readonly commitSha: string;
11
+ readonly did: string;
12
+ readonly keyId: string;
13
+ }
14
+ /** Content hash binding the governance files to the manifest. */
15
+ export declare function contentHashOf(files: Partial<Record<GovernanceFileName, string>>): string;
16
+ export declare function buildBundle(set: GovernanceSet, input: BuildBundleInput): UnsignedBundle;
17
+ //# sourceMappingURL=build.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,aAAa,EACnB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EAAkB,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAeD,iEAAiE;AACjE,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC,GAAG,MAAM,CAExF;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,gBAAgB,GAAG,cAAc,CAavF"}
package/dist/build.js ADDED
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Build a bundle from approved git state (5a). Deterministic: same commit +
3
+ * version → same bytes.
4
+ */
5
+ import { createHash } from 'node:crypto';
6
+ import { GOVERNANCE_FILE_NAMES, } from '@getvda/governance-schema';
7
+ import { canonicalize } from './ed25519.js';
8
+ function sha256Hex(s) {
9
+ return createHash('sha256').update(s).digest('hex');
10
+ }
11
+ function sourcesOf(set) {
12
+ const out = {};
13
+ for (const name of GOVERNANCE_FILE_NAMES) {
14
+ const entry = set.files[name];
15
+ if (entry)
16
+ out[name] = entry.source;
17
+ }
18
+ return out;
19
+ }
20
+ /** Content hash binding the governance files to the manifest. */
21
+ export function contentHashOf(files) {
22
+ return `sha256:${sha256Hex(canonicalize(files))}`;
23
+ }
24
+ export function buildBundle(set, input) {
25
+ const files = sourcesOf(set);
26
+ const manifest = {
27
+ schema: 'acp.bundle/1',
28
+ version: input.version,
29
+ environment: input.environment,
30
+ commitSha: input.commitSha,
31
+ contentHash: contentHashOf(files),
32
+ did: input.did,
33
+ keyId: input.keyId,
34
+ files: Object.keys(files).sort(),
35
+ };
36
+ return { manifest, files };
37
+ }
38
+ //# sourceMappingURL=build.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.js","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,qBAAqB,GAGtB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAW5C,SAAS,SAAS,CAAC,CAAS;IAC1B,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACtD,CAAC;AAED,SAAS,SAAS,CAAC,GAAkB;IACnC,MAAM,GAAG,GAAgD,EAAE,CAAC;IAC5D,KAAK,MAAM,IAAI,IAAI,qBAAqB,EAAE,CAAC;QACzC,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC9B,IAAI,KAAK;YAAE,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;IACtC,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,iEAAiE;AACjE,MAAM,UAAU,aAAa,CAAC,KAAkD;IAC9E,OAAO,UAAU,SAAS,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,GAAkB,EAAE,KAAuB;IACrE,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;IAC7B,MAAM,QAAQ,GAAmB;QAC/B,MAAM,EAAE,cAAc;QACtB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,WAAW,EAAE,aAAa,CAAC,KAAK,CAAC;QACjC,GAAG,EAAE,KAAK,CAAC,GAAG;QACd,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,KAAK,EAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAA0B,CAAC,IAAI,EAAE;KAC3D,CAAC;IACF,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Ed25519 glue for BUNDLE signing (#key-3).
3
+ *
4
+ * Deliberately self-contained (not shared with @getvda/witness's record signer) —
5
+ * bundle signing is a different key, a different verifier (agents, offline), and
6
+ * a different lifetime (years). Keeping the crypto local keeps the packages
7
+ * decoupled; it is ~20 lines of node:crypto.
8
+ */
9
+ export interface PublicJwk {
10
+ readonly kty: 'OKP';
11
+ readonly crv: 'Ed25519';
12
+ readonly x: string;
13
+ }
14
+ export declare function publicJwkFromPrivate(privateKeyPemOrJwk: string | object): PublicJwk;
15
+ export declare function ed25519Sign(bytes: string, privateKeyPemOrJwk: string | object): string;
16
+ export declare function ed25519Verify(bytes: string, signatureB64url: string, jwk: PublicJwk): boolean;
17
+ /** Deterministic canonical JSON (sorted keys) — the exact bytes that get hashed
18
+ * and signed. Same input → same bytes, always. */
19
+ export declare function canonicalize(value: unknown): string;
20
+ //# sourceMappingURL=ed25519.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ed25519.d.ts","sourceRoot":"","sources":["../src/ed25519.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC;IACpB,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;IACxB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,oBAAoB,CAAC,kBAAkB,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAcnF;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAMtF;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,GAAG,OAAO,CAO7F;AAED;mDACmD;AACnD,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEnD"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Ed25519 glue for BUNDLE signing (#key-3).
3
+ *
4
+ * Deliberately self-contained (not shared with @getvda/witness's record signer) —
5
+ * bundle signing is a different key, a different verifier (agents, offline), and
6
+ * a different lifetime (years). Keeping the crypto local keeps the packages
7
+ * decoupled; it is ~20 lines of node:crypto.
8
+ */
9
+ import { createPrivateKey, createPublicKey, sign, verify } from 'node:crypto';
10
+ export function publicJwkFromPrivate(privateKeyPemOrJwk) {
11
+ const priv = typeof privateKeyPemOrJwk === 'string'
12
+ ? createPrivateKey(privateKeyPemOrJwk)
13
+ : createPrivateKey({ key: privateKeyPemOrJwk, format: 'jwk' });
14
+ const jwk = createPublicKey(priv).export({ format: 'jwk' });
15
+ if (jwk.kty !== 'OKP' || jwk.crv !== 'Ed25519' || !jwk.x) {
16
+ throw new Error(`bundle signing requires an Ed25519 OKP key (got kty=${jwk.kty})`);
17
+ }
18
+ return { kty: 'OKP', crv: 'Ed25519', x: jwk.x };
19
+ }
20
+ export function ed25519Sign(bytes, privateKeyPemOrJwk) {
21
+ const priv = typeof privateKeyPemOrJwk === 'string'
22
+ ? createPrivateKey(privateKeyPemOrJwk)
23
+ : createPrivateKey({ key: privateKeyPemOrJwk, format: 'jwk' });
24
+ return sign(null, Buffer.from(bytes, 'utf8'), priv).toString('base64url');
25
+ }
26
+ export function ed25519Verify(bytes, signatureB64url, jwk) {
27
+ try {
28
+ const pub = createPublicKey({ key: jwk, format: 'jwk' });
29
+ return verify(null, Buffer.from(bytes, 'utf8'), pub, Buffer.from(signatureB64url, 'base64url'));
30
+ }
31
+ catch {
32
+ return false;
33
+ }
34
+ }
35
+ /** Deterministic canonical JSON (sorted keys) — the exact bytes that get hashed
36
+ * and signed. Same input → same bytes, always. */
37
+ export function canonicalize(value) {
38
+ return JSON.stringify(sortKeys(value));
39
+ }
40
+ function sortKeys(v) {
41
+ if (Array.isArray(v))
42
+ return v.map(sortKeys);
43
+ if (v && typeof v === 'object') {
44
+ return Object.fromEntries(Object.keys(v)
45
+ .sort()
46
+ .map((k) => [k, sortKeys(v[k])]));
47
+ }
48
+ return v;
49
+ }
50
+ //# sourceMappingURL=ed25519.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ed25519.js","sourceRoot":"","sources":["../src/ed25519.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAQ9E,MAAM,UAAU,oBAAoB,CAAC,kBAAmC;IACtE,MAAM,IAAI,GACR,OAAO,kBAAkB,KAAK,QAAQ;QACpC,CAAC,CAAC,gBAAgB,CAAC,kBAAkB,CAAC;QACtC,CAAC,CAAC,gBAAgB,CAAC,EAAE,GAAG,EAAE,kBAA2B,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IAC5E,MAAM,GAAG,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAIzD,CAAC;IACF,IAAI,GAAG,CAAC,GAAG,KAAK,KAAK,IAAI,GAAG,CAAC,GAAG,KAAK,SAAS,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;QACzD,MAAM,IAAI,KAAK,CAAC,uDAAuD,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;IACrF,CAAC;IACD,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAa,EAAE,kBAAmC;IAC5E,MAAM,IAAI,GACR,OAAO,kBAAkB,KAAK,QAAQ;QACpC,CAAC,CAAC,gBAAgB,CAAC,kBAAkB,CAAC;QACtC,CAAC,CAAC,gBAAgB,CAAC,EAAE,GAAG,EAAE,kBAA2B,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IAC5E,OAAO,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AAC5E,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,KAAa,EAAE,eAAuB,EAAE,GAAc;IAClF,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,eAAe,CAAC,EAAE,GAAG,EAAE,GAAY,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;QAClE,OAAO,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC,CAAC;IAClG,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;mDACmD;AACnD,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;AACzC,CAAC;AACD,SAAS,QAAQ,CAAC,CAAU;IAC1B,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QAAE,OAAO,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC7C,IAAI,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;QAC/B,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,IAAI,CAAC,CAA4B,CAAC;aACtC,IAAI,EAAE;aACN,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAE,CAA6B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAChE,CAAC;IACJ,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @getvda/bundle — the signed, versioned, content-hashed governance bundle.
3
+ * The runtime projection of approved git state. Deterministic; signed with #key-3;
4
+ * verified by agents offline against did:web:acp.getvda.ai.
5
+ */
6
+ export type { BundleManifest, BundleSignature, UnsignedBundle, SignedBundle, BundleVerification, } from './types.js';
7
+ export { buildBundle, contentHashOf, type BuildBundleInput } from './build.js';
8
+ export { signBundle, Ed25519BundleSigner, type BundleSigner } from './sign.js';
9
+ export { verifyBundle } from './verify.js';
10
+ export { StaticKeyResolver, DidWebKeyResolver, didWebToUrl, type KeyResolver } from './resolver.js';
11
+ export { ed25519Sign, ed25519Verify, publicJwkFromPrivate, canonicalize, type PublicJwk, } from './ed25519.js';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EACV,cAAc,EACd,eAAe,EACf,cAAc,EACd,YAAY,EACZ,kBAAkB,GACnB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AACpG,OAAO,EACL,WAAW,EACX,aAAa,EACb,oBAAoB,EACpB,YAAY,EACZ,KAAK,SAAS,GACf,MAAM,cAAc,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @getvda/bundle — the signed, versioned, content-hashed governance bundle.
3
+ * The runtime projection of approved git state. Deterministic; signed with #key-3;
4
+ * verified by agents offline against did:web:acp.getvda.ai.
5
+ */
6
+ export { buildBundle, contentHashOf } from './build.js';
7
+ export { signBundle, Ed25519BundleSigner } from './sign.js';
8
+ export { verifyBundle } from './verify.js';
9
+ export { StaticKeyResolver, DidWebKeyResolver, didWebToUrl } from './resolver.js';
10
+ export { ed25519Sign, ed25519Verify, publicJwkFromPrivate, canonicalize, } from './ed25519.js';
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH,OAAO,EAAE,WAAW,EAAE,aAAa,EAAyB,MAAM,YAAY,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAqB,MAAM,WAAW,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,WAAW,EAAoB,MAAM,eAAe,CAAC;AACpG,OAAO,EACL,WAAW,EACX,aAAa,EACb,oBAAoB,EACpB,YAAY,GAEb,MAAM,cAAc,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Key resolution for bundle verification.
3
+ *
4
+ * Agents verify a bundle by resolving its `keyId` to a public key. In production
5
+ * that means resolving `did:web:acp.getvda.ai` to its DID document and reading
6
+ * the #key-3 verification method. Tests / the loop use a StaticKeyResolver.
7
+ */
8
+ import type { PublicJwk } from './ed25519.js';
9
+ export interface KeyResolver {
10
+ resolve(keyId: string): Promise<PublicJwk | null>;
11
+ }
12
+ /** A fixed keyId → public JWK map (tests, offline caches). */
13
+ export declare class StaticKeyResolver implements KeyResolver {
14
+ private readonly keys;
15
+ constructor(keys: Readonly<Record<string, PublicJwk>>);
16
+ resolve(keyId: string): Promise<PublicJwk | null>;
17
+ }
18
+ /**
19
+ * Resolve `did:web:<host>[:<path...>]#<frag>` to the verification method's public
20
+ * JWK. did:web:acp.getvda.ai#key-3 → https://acp.getvda.ai/.well-known/did.json.
21
+ * Iterates `verificationMethod[]` (the array Witness's resolver also matches on).
22
+ */
23
+ export declare class DidWebKeyResolver implements KeyResolver {
24
+ private readonly fetchImpl;
25
+ private cache;
26
+ constructor(fetchImpl?: typeof fetch);
27
+ resolve(keyId: string): Promise<PublicJwk | null>;
28
+ private fetchDoc;
29
+ }
30
+ export declare function didWebToUrl(did: string): string;
31
+ //# sourceMappingURL=resolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../src/resolver.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;CACnD;AAED,8DAA8D;AAC9D,qBAAa,iBAAkB,YAAW,WAAW;IACvC,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAChE,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;CAGxD;AAMD;;;;GAIG;AACH,qBAAa,iBAAkB,YAAW,WAAW;IAEvC,OAAO,CAAC,QAAQ,CAAC,SAAS;IADtC,OAAO,CAAC,KAAK,CAAkC;gBAClB,SAAS,GAAE,OAAO,KAAa;IAEtD,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;YAQzC,QAAQ;CAUvB;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAY/C"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Key resolution for bundle verification.
3
+ *
4
+ * Agents verify a bundle by resolving its `keyId` to a public key. In production
5
+ * that means resolving `did:web:acp.getvda.ai` to its DID document and reading
6
+ * the #key-3 verification method. Tests / the loop use a StaticKeyResolver.
7
+ */
8
+ /** A fixed keyId → public JWK map (tests, offline caches). */
9
+ export class StaticKeyResolver {
10
+ keys;
11
+ constructor(keys) {
12
+ this.keys = keys;
13
+ }
14
+ async resolve(keyId) {
15
+ return this.keys[keyId] ?? null;
16
+ }
17
+ }
18
+ /**
19
+ * Resolve `did:web:<host>[:<path...>]#<frag>` to the verification method's public
20
+ * JWK. did:web:acp.getvda.ai#key-3 → https://acp.getvda.ai/.well-known/did.json.
21
+ * Iterates `verificationMethod[]` (the array Witness's resolver also matches on).
22
+ */
23
+ export class DidWebKeyResolver {
24
+ fetchImpl;
25
+ cache = new Map();
26
+ constructor(fetchImpl = fetch) {
27
+ this.fetchImpl = fetchImpl;
28
+ }
29
+ async resolve(keyId) {
30
+ const [did] = keyId.split('#');
31
+ if (!did || !did.startsWith('did:web:'))
32
+ return null;
33
+ const doc = await this.fetchDoc(did);
34
+ const vm = doc.verificationMethod?.find((m) => m.id === keyId);
35
+ return vm?.publicKeyJwk ?? null;
36
+ }
37
+ async fetchDoc(did) {
38
+ const cached = this.cache.get(did);
39
+ if (cached)
40
+ return cached;
41
+ const url = didWebToUrl(did);
42
+ const res = await this.fetchImpl(url);
43
+ if (!res.ok)
44
+ throw new Error(`did:web resolution failed (${res.status}) at ${url}`);
45
+ const doc = (await res.json());
46
+ this.cache.set(did, doc);
47
+ return doc;
48
+ }
49
+ }
50
+ export function didWebToUrl(did) {
51
+ // did:web:host -> https://host/.well-known/did.json
52
+ // did:web:host:a:b -> https://host/a/b/did.json
53
+ const parts = did
54
+ .replace(/^did:web:/, '')
55
+ .split(':')
56
+ .map(decodeURIComponent);
57
+ const host = parts.shift();
58
+ if (!host)
59
+ throw new Error(`invalid did:web: ${did}`);
60
+ return parts.length === 0
61
+ ? `https://${host}/.well-known/did.json`
62
+ : `https://${host}/${parts.join('/')}/did.json`;
63
+ }
64
+ //# sourceMappingURL=resolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolver.js","sourceRoot":"","sources":["../src/resolver.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAQH,8DAA8D;AAC9D,MAAM,OAAO,iBAAiB;IACC;IAA7B,YAA6B,IAAyC;QAAzC,SAAI,GAAJ,IAAI,CAAqC;IAAG,CAAC;IAC1E,KAAK,CAAC,OAAO,CAAC,KAAa;QACzB,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC;IAClC,CAAC;CACF;AAMD;;;;GAIG;AACH,MAAM,OAAO,iBAAiB;IAEC;IADrB,KAAK,GAAG,IAAI,GAAG,EAAuB,CAAC;IAC/C,YAA6B,YAA0B,KAAK;QAA/B,cAAS,GAAT,SAAS,CAAsB;IAAG,CAAC;IAEhE,KAAK,CAAC,OAAO,CAAC,KAAa;QACzB,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC/B,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC;YAAE,OAAO,IAAI,CAAC;QACrD,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QACrC,MAAM,EAAE,GAAG,GAAG,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC;QAC/D,OAAO,EAAE,EAAE,YAAY,IAAI,IAAI,CAAC;IAClC,CAAC;IAEO,KAAK,CAAC,QAAQ,CAAC,GAAW;QAChC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACnC,IAAI,MAAM;YAAE,OAAO,MAAM,CAAC;QAC1B,MAAM,GAAG,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;QAC7B,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QACtC,IAAI,CAAC,GAAG,CAAC,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,GAAG,CAAC,MAAM,QAAQ,GAAG,EAAE,CAAC,CAAC;QACpF,MAAM,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAgB,CAAC;QAC9C,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QACzB,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AAED,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,sDAAsD;IACtD,gDAAgD;IAChD,MAAM,KAAK,GAAG,GAAG;SACd,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;SACxB,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAC3B,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC;IAC3B,IAAI,CAAC,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,oBAAoB,GAAG,EAAE,CAAC,CAAC;IACtD,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;QACvB,CAAC,CAAC,WAAW,IAAI,uBAAuB;QACxC,CAAC,CAAC,WAAW,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC;AACpD,CAAC"}
package/dist/sign.d.ts ADDED
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Sign a bundle with the dedicated bundle-signing key (#key-3).
3
+ *
4
+ * The signature is over the CANONICAL MANIFEST, which itself carries the
5
+ * contentHash of the files — so the one signature binds manifest → files. A real
6
+ * signer wraps Mike's #key-3 private key (from Secret Manager); tests use an
7
+ * ephemeral Ed25519 key + a StaticKeyResolver.
8
+ */
9
+ import { type PublicJwk } from './ed25519.js';
10
+ import type { SignedBundle, UnsignedBundle } from './types.js';
11
+ export interface BundleSigner {
12
+ readonly keyId: string;
13
+ sign(bytes: string): string;
14
+ }
15
+ export declare class Ed25519BundleSigner implements BundleSigner {
16
+ readonly keyId: string;
17
+ private readonly privateKey;
18
+ constructor(privateKeyPemOrJwk: string | object, keyId: string);
19
+ sign(bytes: string): string;
20
+ /** The public half — publish this in the DID doc as #key-3. */
21
+ get publicKeyJwk(): PublicJwk;
22
+ }
23
+ export declare function signBundle(unsigned: UnsignedBundle, signer: BundleSigner): SignedBundle;
24
+ //# sourceMappingURL=sign.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sign.d.ts","sourceRoot":"","sources":["../src/sign.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAmD,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAC/F,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE/D,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CAC7B;AAED,qBAAa,mBAAoB,YAAW,YAAY;IACtD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAkB;gBAEjC,kBAAkB,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,EAAE,MAAM;IAK9D,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAI3B,+DAA+D;IAC/D,IAAI,YAAY,IAAI,SAAS,CAE5B;CACF;AAED,wBAAgB,UAAU,CAAC,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,GAAG,YAAY,CAQvF"}
package/dist/sign.js ADDED
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Sign a bundle with the dedicated bundle-signing key (#key-3).
3
+ *
4
+ * The signature is over the CANONICAL MANIFEST, which itself carries the
5
+ * contentHash of the files — so the one signature binds manifest → files. A real
6
+ * signer wraps Mike's #key-3 private key (from Secret Manager); tests use an
7
+ * ephemeral Ed25519 key + a StaticKeyResolver.
8
+ */
9
+ import { canonicalize, ed25519Sign, publicJwkFromPrivate } from './ed25519.js';
10
+ export class Ed25519BundleSigner {
11
+ keyId;
12
+ privateKey;
13
+ constructor(privateKeyPemOrJwk, keyId) {
14
+ this.privateKey = privateKeyPemOrJwk;
15
+ this.keyId = keyId;
16
+ }
17
+ sign(bytes) {
18
+ return ed25519Sign(bytes, this.privateKey);
19
+ }
20
+ /** The public half — publish this in the DID doc as #key-3. */
21
+ get publicKeyJwk() {
22
+ return publicJwkFromPrivate(this.privateKey);
23
+ }
24
+ }
25
+ export function signBundle(unsigned, signer) {
26
+ if (unsigned.manifest.keyId !== signer.keyId) {
27
+ throw new Error(`manifest keyId (${unsigned.manifest.keyId}) does not match signer keyId (${signer.keyId})`);
28
+ }
29
+ const value = signer.sign(canonicalize(unsigned.manifest));
30
+ return { ...unsigned, signature: { algorithm: 'Ed25519', value, keyId: signer.keyId } };
31
+ }
32
+ //# sourceMappingURL=sign.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sign.js","sourceRoot":"","sources":["../src/sign.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,oBAAoB,EAAkB,MAAM,cAAc,CAAC;AAQ/F,MAAM,OAAO,mBAAmB;IACrB,KAAK,CAAS;IACN,UAAU,CAAkB;IAE7C,YAAY,kBAAmC,EAAE,KAAa;QAC5D,IAAI,CAAC,UAAU,GAAG,kBAAkB,CAAC;QACrC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,IAAI,CAAC,KAAa;QAChB,OAAO,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IAC7C,CAAC;IAED,+DAA+D;IAC/D,IAAI,YAAY;QACd,OAAO,oBAAoB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC/C,CAAC;CACF;AAED,MAAM,UAAU,UAAU,CAAC,QAAwB,EAAE,MAAoB;IACvE,IAAI,QAAQ,CAAC,QAAQ,CAAC,KAAK,KAAK,MAAM,CAAC,KAAK,EAAE,CAAC;QAC7C,MAAM,IAAI,KAAK,CACb,mBAAmB,QAAQ,CAAC,QAAQ,CAAC,KAAK,kCAAkC,MAAM,CAAC,KAAK,GAAG,CAC5F,CAAC;IACJ,CAAC;IACD,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC3D,OAAO,EAAE,GAAG,QAAQ,EAAE,SAAS,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC;AAC1F,CAAC"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * The signed governance bundle — the runtime projection of approved git state.
3
+ *
4
+ * DETERMINISTIC by design: the manifest carries no wall-clock timestamp, so the
5
+ * SAME commit + version always produces the SAME bytes and the SAME signature.
6
+ * (The activation time lives in the Witness attestation's `as_of`, not the
7
+ * bundle.) Agents fetch, verify, cache, and evaluate this locally — they never
8
+ * `git pull`.
9
+ */
10
+ import type { GovernanceFileName } from '@getvda/governance-schema';
11
+ export interface BundleManifest {
12
+ readonly schema: 'acp.bundle/1';
13
+ /** Monotonic version per environment, assigned by the pipeline (not time). */
14
+ readonly version: string;
15
+ readonly environment: string;
16
+ /** The git commit this bundle was built from — the tie to authoring provenance. */
17
+ readonly commitSha: string;
18
+ /** sha256:<hex> of the canonical governance file set. Binds files → manifest. */
19
+ readonly contentHash: string;
20
+ /** ACP's DID; agents resolve it to get the bundle-signing key. */
21
+ readonly did: string;
22
+ /** The verification method that signs bundles, e.g. did:web:acp.getvda.ai#key-3. */
23
+ readonly keyId: string;
24
+ /** File names included, sorted — for a quick manifest read without the bodies. */
25
+ readonly files: readonly GovernanceFileName[];
26
+ }
27
+ export interface BundleSignature {
28
+ readonly algorithm: 'Ed25519';
29
+ /** base64url signature over the canonical manifest bytes. */
30
+ readonly value: string;
31
+ /** The key that produced it (== manifest.keyId). */
32
+ readonly keyId: string;
33
+ }
34
+ /** An unsigned bundle (manifest + the governance sources it hashes). */
35
+ export interface UnsignedBundle {
36
+ readonly manifest: BundleManifest;
37
+ readonly files: Readonly<Partial<Record<GovernanceFileName, string>>>;
38
+ }
39
+ /** A signed, distributable bundle. */
40
+ export interface SignedBundle extends UnsignedBundle {
41
+ readonly signature: BundleSignature;
42
+ }
43
+ export interface BundleVerification {
44
+ readonly valid: boolean;
45
+ readonly reasons: readonly string[];
46
+ readonly commitSha?: string;
47
+ readonly version?: string;
48
+ }
49
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,8EAA8E;IAC9E,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,mFAAmF;IACnF,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,iFAAiF;IACjF,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,kEAAkE;IAClE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,oFAAoF;IACpF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,kFAAkF;IAClF,QAAQ,CAAC,KAAK,EAAE,SAAS,kBAAkB,EAAE,CAAC;CAC/C;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,6DAA6D;IAC7D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,oDAAoD;IACpD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,wEAAwE;AACxE,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;CACvE;AAED,sCAAsC;AACtC,MAAM,WAAW,YAAa,SAAQ,cAAc;IAClD,QAAQ,CAAC,SAAS,EAAE,eAAe,CAAC;CACrC;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B"}
package/dist/types.js ADDED
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The signed governance bundle — the runtime projection of approved git state.
3
+ *
4
+ * DETERMINISTIC by design: the manifest carries no wall-clock timestamp, so the
5
+ * SAME commit + version always produces the SAME bytes and the SAME signature.
6
+ * (The activation time lives in the Witness attestation's `as_of`, not the
7
+ * bundle.) Agents fetch, verify, cache, and evaluate this locally — they never
8
+ * `git pull`.
9
+ */
10
+ export {};
11
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Verify a signed bundle (agent-side, offline against the resolved key).
3
+ *
4
+ * Checks, in order:
5
+ * 1. the files still hash to the manifest's contentHash (no tampering),
6
+ * 2. the signature's keyId matches the manifest,
7
+ * 3. the signature verifies over the canonical manifest against the resolved
8
+ * #key-3 public key.
9
+ * All three must hold for the bundle to be trusted.
10
+ */
11
+ import type { KeyResolver } from './resolver.js';
12
+ import type { BundleVerification, SignedBundle } from './types.js';
13
+ export declare function verifyBundle(bundle: SignedBundle, resolver: KeyResolver): Promise<BundleVerification>;
14
+ //# sourceMappingURL=verify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../src/verify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAEnE,wBAAsB,YAAY,CAChC,MAAM,EAAE,YAAY,EACpB,QAAQ,EAAE,WAAW,GACpB,OAAO,CAAC,kBAAkB,CAAC,CAyB7B"}
package/dist/verify.js ADDED
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Verify a signed bundle (agent-side, offline against the resolved key).
3
+ *
4
+ * Checks, in order:
5
+ * 1. the files still hash to the manifest's contentHash (no tampering),
6
+ * 2. the signature's keyId matches the manifest,
7
+ * 3. the signature verifies over the canonical manifest against the resolved
8
+ * #key-3 public key.
9
+ * All three must hold for the bundle to be trusted.
10
+ */
11
+ import { canonicalize, ed25519Verify } from './ed25519.js';
12
+ import { contentHashOf } from './build.js';
13
+ export async function verifyBundle(bundle, resolver) {
14
+ const reasons = [];
15
+ const recomputed = contentHashOf(bundle.files);
16
+ if (recomputed !== bundle.manifest.contentHash) {
17
+ reasons.push('content hash mismatch — files do not match the manifest (tampered)');
18
+ }
19
+ if (bundle.signature.keyId !== bundle.manifest.keyId) {
20
+ reasons.push('signature keyId does not match the manifest keyId');
21
+ }
22
+ const jwk = await resolver.resolve(bundle.manifest.keyId);
23
+ if (!jwk) {
24
+ reasons.push(`cannot resolve signing key ${bundle.manifest.keyId}`);
25
+ }
26
+ else if (!ed25519Verify(canonicalize(bundle.manifest), bundle.signature.value, jwk)) {
27
+ reasons.push('signature does not verify against the resolved key');
28
+ }
29
+ return {
30
+ valid: reasons.length === 0,
31
+ reasons,
32
+ commitSha: bundle.manifest.commitSha,
33
+ version: bundle.manifest.version,
34
+ };
35
+ }
36
+ //# sourceMappingURL=verify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify.js","sourceRoot":"","sources":["../src/verify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAI3C,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAAoB,EACpB,QAAqB;IAErB,MAAM,OAAO,GAAa,EAAE,CAAC;IAE7B,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC/C,IAAI,UAAU,KAAK,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;QAC/C,OAAO,CAAC,IAAI,CAAC,oEAAoE,CAAC,CAAC;IACrF,CAAC;IAED,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,KAAK,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QACrD,OAAO,CAAC,IAAI,CAAC,mDAAmD,CAAC,CAAC;IACpE,CAAC;IAED,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC1D,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,CAAC,IAAI,CAAC,8BAA8B,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IACtE,CAAC;SAAM,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC;QACtF,OAAO,CAAC,IAAI,CAAC,oDAAoD,CAAC,CAAC;IACrE,CAAC;IAED,OAAO;QACL,KAAK,EAAE,OAAO,CAAC,MAAM,KAAK,CAAC;QAC3B,OAAO;QACP,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC,SAAS;QACpC,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,OAAO;KACjC,CAAC;AACJ,CAAC"}
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@getvda/bundle",
3
+ "version": "0.1.0",
4
+ "private": false,
5
+ "type": "module",
6
+ "description": "Signed, versioned, content-hashed governance bundle — the runtime projection of approved git state. Deterministic build, Ed25519 signing (#key-3), verification against did:web:acp.getvda.ai.",
7
+ "main": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "scripts": {
10
+ "build": "tsc --build",
11
+ "typecheck": "tsc --noEmit",
12
+ "test": "vitest run"
13
+ },
14
+ "dependencies": {
15
+ "@getvda/governance-schema": "^0.2.0"
16
+ },
17
+ "license": "Apache-2.0",
18
+ "publishConfig": {
19
+ "access": "public"
20
+ },
21
+ "files": [
22
+ "dist",
23
+ "README.md",
24
+ "LICENSE",
25
+ "NOTICE"
26
+ ],
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "git+https://github.com/getvda-ai/acp-agent.git",
30
+ "directory": "packages/bundle"
31
+ },
32
+ "homepage": "https://getvda.ai"
33
+ }