hackmyagent 0.16.5 → 0.16.7

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.
Files changed (64) hide show
  1. package/dist/.integrity-manifest.json +1 -1
  2. package/dist/arp/crypto/hybrid-signing.d.ts +107 -0
  3. package/dist/arp/crypto/hybrid-signing.d.ts.map +1 -0
  4. package/dist/arp/crypto/hybrid-signing.js +321 -0
  5. package/dist/arp/crypto/hybrid-signing.js.map +1 -0
  6. package/dist/arp/crypto/index.d.ts +13 -0
  7. package/dist/arp/crypto/index.d.ts.map +1 -0
  8. package/dist/arp/crypto/index.js +33 -0
  9. package/dist/arp/crypto/index.js.map +1 -0
  10. package/dist/arp/crypto/manifest-loader.d.ts +117 -0
  11. package/dist/arp/crypto/manifest-loader.d.ts.map +1 -0
  12. package/dist/arp/crypto/manifest-loader.js +361 -0
  13. package/dist/arp/crypto/manifest-loader.js.map +1 -0
  14. package/dist/arp/crypto/types.d.ts +69 -0
  15. package/dist/arp/crypto/types.d.ts.map +1 -0
  16. package/dist/arp/crypto/types.js +11 -0
  17. package/dist/arp/crypto/types.js.map +1 -0
  18. package/dist/arp/index.d.ts +27 -0
  19. package/dist/arp/index.d.ts.map +1 -1
  20. package/dist/arp/index.js +94 -1
  21. package/dist/arp/index.js.map +1 -1
  22. package/dist/arp/intelligence/behavioral-risk-server.d.ts +82 -0
  23. package/dist/arp/intelligence/behavioral-risk-server.d.ts.map +1 -0
  24. package/dist/arp/intelligence/behavioral-risk-server.js +258 -0
  25. package/dist/arp/intelligence/behavioral-risk-server.js.map +1 -0
  26. package/dist/arp/intelligence/behavioral-risk.d.ts +217 -0
  27. package/dist/arp/intelligence/behavioral-risk.d.ts.map +1 -0
  28. package/dist/arp/intelligence/behavioral-risk.js +429 -0
  29. package/dist/arp/intelligence/behavioral-risk.js.map +1 -0
  30. package/dist/arp/intelligence/coordinator.d.ts +93 -2
  31. package/dist/arp/intelligence/coordinator.d.ts.map +1 -1
  32. package/dist/arp/intelligence/coordinator.js +281 -1
  33. package/dist/arp/intelligence/coordinator.js.map +1 -1
  34. package/dist/arp/intelligence/guard-anomaly.d.ts +349 -0
  35. package/dist/arp/intelligence/guard-anomaly.d.ts.map +1 -0
  36. package/dist/arp/intelligence/guard-anomaly.js +399 -0
  37. package/dist/arp/intelligence/guard-anomaly.js.map +1 -0
  38. package/dist/arp/intelligence/nanomind-l1.d.ts +37 -0
  39. package/dist/arp/intelligence/nanomind-l1.d.ts.map +1 -1
  40. package/dist/arp/intelligence/nanomind-l1.js +78 -0
  41. package/dist/arp/intelligence/nanomind-l1.js.map +1 -1
  42. package/dist/arp/intelligence/verify-classification.d.ts +124 -0
  43. package/dist/arp/intelligence/verify-classification.d.ts.map +1 -0
  44. package/dist/arp/intelligence/verify-classification.js +329 -0
  45. package/dist/arp/intelligence/verify-classification.js.map +1 -0
  46. package/dist/arp/proxy/server.d.ts +38 -8
  47. package/dist/arp/proxy/server.d.ts.map +1 -1
  48. package/dist/arp/proxy/server.js +89 -0
  49. package/dist/arp/proxy/server.js.map +1 -1
  50. package/dist/arp/types.d.ts +228 -1
  51. package/dist/arp/types.d.ts.map +1 -1
  52. package/dist/cli.js +85 -18
  53. package/dist/cli.js.map +1 -1
  54. package/dist/nanomind-core/compiler/semantic-compiler.d.ts.map +1 -1
  55. package/dist/nanomind-core/compiler/semantic-compiler.js +170 -10
  56. package/dist/nanomind-core/compiler/semantic-compiler.js.map +1 -1
  57. package/dist/nanomind-core/compiler/source-code-preprocessor.d.ts +64 -0
  58. package/dist/nanomind-core/compiler/source-code-preprocessor.d.ts.map +1 -0
  59. package/dist/nanomind-core/compiler/source-code-preprocessor.js +656 -0
  60. package/dist/nanomind-core/compiler/source-code-preprocessor.js.map +1 -0
  61. package/dist/nanomind-core/ingestion/artifact-parser.d.ts.map +1 -1
  62. package/dist/nanomind-core/ingestion/artifact-parser.js +15 -6
  63. package/dist/nanomind-core/ingestion/artifact-parser.js.map +1 -1
  64. package/package.json +3 -1
@@ -0,0 +1,321 @@
1
+ "use strict";
2
+ /**
3
+ * Hybrid Ed25519 + ML-DSA signing for ARP (AIComply P1).
4
+ *
5
+ * Defense-in-depth signing: every payload is co-signed by a classical curve
6
+ * (Ed25519, FIPS 186-5) and a post-quantum lattice scheme (ML-DSA, FIPS 204).
7
+ * Verification requires BOTH halves to validate. This matches the wire format
8
+ * used by the AIM SDK (`agent-identity-management/sdk/typescript/src/crypto/pqc.ts`)
9
+ * and the Go backend so hybrid signatures can round trip between the two.
10
+ *
11
+ * Design notes:
12
+ * - Deps are imported statically at module top. Previous scaffolding already
13
+ * proved the CJS resolution works against pinned `@noble/ed25519` v2 and
14
+ * `@noble/post-quantum` v0.2. Lazy loading is not needed and would hide
15
+ * install failures until first call.
16
+ * - `hybridVerify()` evaluates BOTH halves unconditionally. It does not
17
+ * short-circuit on an ed25519 failure. This avoids a side-channel where an
18
+ * attacker could probe which half of a signature is broken by timing the
19
+ * verify call, and it matches the structured `HybridVerifyResult` contract.
20
+ * - Failures inside either half (thrown exceptions, wrong lengths) become a
21
+ * `{valid: false}` result with a `reason`. The caller is expected to fail
22
+ * closed (parse-to-deny) per CR-001.
23
+ * - `KEY_SIZES` is the FIPS 204 table and must match the AIM SDK and Go backend
24
+ * byte for byte. Any size drift between the three is a bug somewhere.
25
+ */
26
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
27
+ if (k2 === undefined) k2 = k;
28
+ var desc = Object.getOwnPropertyDescriptor(m, k);
29
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
30
+ desc = { enumerable: true, get: function() { return m[k]; } };
31
+ }
32
+ Object.defineProperty(o, k2, desc);
33
+ }) : (function(o, m, k, k2) {
34
+ if (k2 === undefined) k2 = k;
35
+ o[k2] = m[k];
36
+ }));
37
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
38
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
39
+ }) : function(o, v) {
40
+ o["default"] = v;
41
+ });
42
+ var __importStar = (this && this.__importStar) || (function () {
43
+ var ownKeys = function(o) {
44
+ ownKeys = Object.getOwnPropertyNames || function (o) {
45
+ var ar = [];
46
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
47
+ return ar;
48
+ };
49
+ return ownKeys(o);
50
+ };
51
+ return function (mod) {
52
+ if (mod && mod.__esModule) return mod;
53
+ var result = {};
54
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
55
+ __setModuleDefault(result, mod);
56
+ return result;
57
+ };
58
+ })();
59
+ Object.defineProperty(exports, "__esModule", { value: true });
60
+ exports.HybridCryptoError = exports.KEY_SIZES = void 0;
61
+ exports.hybridAlgorithmFor = hybridAlgorithmFor;
62
+ exports.validateKeySize = validateKeySize;
63
+ exports.generateHybridKeyPair = generateHybridKeyPair;
64
+ exports.hybridSign = hybridSign;
65
+ exports.hybridVerify = hybridVerify;
66
+ exports.getHybridPublicKey = getHybridPublicKey;
67
+ exports.encodeHybridSignature = encodeHybridSignature;
68
+ exports.decodeHybridSignature = decodeHybridSignature;
69
+ exports.encodeHybridPublicKey = encodeHybridPublicKey;
70
+ exports.decodeHybridPublicKey = decodeHybridPublicKey;
71
+ const crypto_1 = require("crypto");
72
+ const ed25519 = __importStar(require("@noble/ed25519"));
73
+ const ml_dsa_1 = require("@noble/post-quantum/ml-dsa");
74
+ /**
75
+ * FIPS 204 key and signature sizes (in bytes). Used to validate key material
76
+ * and signatures before handing them to the underlying primitives.
77
+ *
78
+ * Source: NIST FIPS 204 (ML-DSA), Table 1. Verified against the current
79
+ * `@noble/post-quantum` v0.2 keygen output.
80
+ */
81
+ exports.KEY_SIZES = {
82
+ Ed25519: { publicKey: 32, privateKey: 32, signature: 64 },
83
+ 'ML-DSA-44': { publicKey: 1312, privateKey: 2560, signature: 2420 },
84
+ 'ML-DSA-65': { publicKey: 1952, privateKey: 4032, signature: 3309 },
85
+ 'ML-DSA-87': { publicKey: 2592, privateKey: 4896, signature: 4627 },
86
+ };
87
+ /**
88
+ * Error raised when a hybrid primitive rejects its input before any crypto
89
+ * runs. Catching code should fail closed (parse-to-deny) per CR-001.
90
+ */
91
+ class HybridCryptoError extends Error {
92
+ constructor(message) {
93
+ super(`[arp/crypto] ${message}`);
94
+ this.name = 'HybridCryptoError';
95
+ }
96
+ }
97
+ exports.HybridCryptoError = HybridCryptoError;
98
+ /**
99
+ * Return the canonical hybrid algorithm identifier for a given ML-DSA variant.
100
+ * Stable helper, safe to use from any layer.
101
+ */
102
+ function hybridAlgorithmFor(variant) {
103
+ switch (variant) {
104
+ case 'ML-DSA-44':
105
+ return 'Ed25519+ML-DSA-44';
106
+ case 'ML-DSA-65':
107
+ return 'Ed25519+ML-DSA-65';
108
+ case 'ML-DSA-87':
109
+ return 'Ed25519+ML-DSA-87';
110
+ }
111
+ }
112
+ /**
113
+ * Resolve an ML-DSA variant string to the `@noble/post-quantum` handle.
114
+ */
115
+ function mldsaFor(variant) {
116
+ switch (variant) {
117
+ case 'ML-DSA-44':
118
+ return ml_dsa_1.ml_dsa44;
119
+ case 'ML-DSA-65':
120
+ return ml_dsa_1.ml_dsa65;
121
+ case 'ML-DSA-87':
122
+ return ml_dsa_1.ml_dsa87;
123
+ }
124
+ }
125
+ /**
126
+ * Validate a byte array against the expected FIPS 204 / Ed25519 size.
127
+ * Returns true if the size matches, false otherwise.
128
+ */
129
+ function validateKeySize(variantOrAlg, kind, data) {
130
+ const variant = variantOrAlg === 'Ed25519'
131
+ ? 'Ed25519'
132
+ : variantOrAlg === 'Ed25519+ML-DSA-44'
133
+ ? 'ML-DSA-44'
134
+ : variantOrAlg === 'Ed25519+ML-DSA-65'
135
+ ? 'ML-DSA-65'
136
+ : variantOrAlg === 'Ed25519+ML-DSA-87'
137
+ ? 'ML-DSA-87'
138
+ : variantOrAlg;
139
+ const sizes = exports.KEY_SIZES[variant];
140
+ if (!sizes)
141
+ return false;
142
+ return data.length === sizes[kind];
143
+ }
144
+ /**
145
+ * Generate a hybrid Ed25519 + ML-DSA key pair. Both halves sign the same
146
+ * payloads; the returned pair carries enough material to produce and verify
147
+ * hybrid signatures.
148
+ *
149
+ * @param variant ML-DSA parameter set. 44 for high-throughput identity signals,
150
+ * 65 for manifests (recommended default), 87 for root keys.
151
+ */
152
+ async function generateHybridKeyPair(variant) {
153
+ const ed25519PrivateKey = ed25519.utils.randomPrivateKey();
154
+ const ed25519PublicKey = await ed25519.getPublicKeyAsync(ed25519PrivateKey);
155
+ // ML-DSA keygen takes a 32-byte seed. Source entropy from Node's
156
+ // `crypto.randomBytes` so the seed is unique per call and does not reuse
157
+ // any secret material from the Ed25519 private key.
158
+ const mldsaSeed = new Uint8Array((0, crypto_1.randomBytes)(32));
159
+ const mldsa = mldsaFor(variant);
160
+ const mldsaKeys = mldsa.keygen(mldsaSeed);
161
+ // Defense in depth: make sure noble handed us the FIPS 204 sizes we expect
162
+ // before anyone can sign with these keys. A size mismatch here means the
163
+ // dep drifted and every downstream assumption is suspect.
164
+ if (!validateKeySize('Ed25519', 'publicKey', ed25519PublicKey)) {
165
+ throw new HybridCryptoError(`Ed25519 public key size mismatch: got ${ed25519PublicKey.length}, expected ${exports.KEY_SIZES.Ed25519.publicKey}`);
166
+ }
167
+ if (!validateKeySize(variant, 'publicKey', mldsaKeys.publicKey)) {
168
+ throw new HybridCryptoError(`${variant} public key size mismatch: got ${mldsaKeys.publicKey.length}, expected ${exports.KEY_SIZES[variant].publicKey}`);
169
+ }
170
+ if (!validateKeySize(variant, 'privateKey', mldsaKeys.secretKey)) {
171
+ throw new HybridCryptoError(`${variant} private key size mismatch: got ${mldsaKeys.secretKey.length}, expected ${exports.KEY_SIZES[variant].privateKey}`);
172
+ }
173
+ return {
174
+ algorithm: hybridAlgorithmFor(variant),
175
+ ed25519: {
176
+ publicKey: ed25519PublicKey,
177
+ privateKey: ed25519PrivateKey,
178
+ },
179
+ mldsa: {
180
+ variant,
181
+ publicKey: mldsaKeys.publicKey,
182
+ privateKey: mldsaKeys.secretKey,
183
+ },
184
+ createdAt: new Date(),
185
+ };
186
+ }
187
+ /**
188
+ * Sign a payload with a hybrid key pair. Both halves (Ed25519 and ML-DSA)
189
+ * sign the SAME payload bytes; the returned signature carries both.
190
+ */
191
+ async function hybridSign(payload, keyPair) {
192
+ if (!(payload instanceof Uint8Array)) {
193
+ throw new HybridCryptoError('hybridSign: payload must be Uint8Array');
194
+ }
195
+ const ed25519Sig = await ed25519.signAsync(payload, keyPair.ed25519.privateKey);
196
+ const mldsa = mldsaFor(keyPair.mldsa.variant);
197
+ const mldsaSig = mldsa.sign(keyPair.mldsa.privateKey, payload);
198
+ return {
199
+ algorithm: keyPair.algorithm,
200
+ ed25519Sig,
201
+ mldsaSig,
202
+ timestamp: Date.now(),
203
+ };
204
+ }
205
+ /**
206
+ * Verify a hybrid signature. BOTH halves must validate for the overall result
207
+ * to be valid. The function intentionally evaluates both halves on every call,
208
+ * even when the first half fails, so that timing cannot reveal which half of
209
+ * a signature is broken. All thrown errors from the underlying primitives are
210
+ * trapped and reported as a structured failure (`valid: false`).
211
+ */
212
+ async function hybridVerify(payload, signature, publicKey) {
213
+ const reasons = [];
214
+ // Structural checks first. These do not leak side-channel information because
215
+ // they do not depend on the signature bytes being compared against a secret.
216
+ if (signature.algorithm !== publicKey.algorithm) {
217
+ return {
218
+ valid: false,
219
+ ed25519Valid: false,
220
+ mldsaValid: false,
221
+ reason: `algorithm mismatch: signature=${signature.algorithm} publicKey=${publicKey.algorithm}`,
222
+ };
223
+ }
224
+ if (!validateKeySize('Ed25519', 'signature', signature.ed25519Sig)) {
225
+ reasons.push(`ed25519 signature size invalid: ${signature.ed25519Sig.length}`);
226
+ }
227
+ if (!validateKeySize(publicKey.mldsaVariant, 'signature', signature.mldsaSig)) {
228
+ reasons.push(`${publicKey.mldsaVariant} signature size invalid: ${signature.mldsaSig.length}`);
229
+ }
230
+ if (!validateKeySize('Ed25519', 'publicKey', publicKey.ed25519PublicKey)) {
231
+ reasons.push(`ed25519 public key size invalid: ${publicKey.ed25519PublicKey.length}`);
232
+ }
233
+ if (!validateKeySize(publicKey.mldsaVariant, 'publicKey', publicKey.mldsaPublicKey)) {
234
+ reasons.push(`${publicKey.mldsaVariant} public key size invalid: ${publicKey.mldsaPublicKey.length}`);
235
+ }
236
+ // Evaluate both halves unconditionally. The non-short-circuit property is a
237
+ // security requirement, not a convenience. Do not refactor this to bail
238
+ // early on ed25519 failure.
239
+ let ed25519Valid = false;
240
+ try {
241
+ ed25519Valid = await ed25519.verifyAsync(signature.ed25519Sig, payload, publicKey.ed25519PublicKey);
242
+ }
243
+ catch (err) {
244
+ reasons.push(`ed25519 verify threw: ${err.message}`);
245
+ }
246
+ let mldsaValid = false;
247
+ try {
248
+ const mldsa = mldsaFor(publicKey.mldsaVariant);
249
+ mldsaValid = mldsa.verify(publicKey.mldsaPublicKey, payload, signature.mldsaSig);
250
+ }
251
+ catch (err) {
252
+ reasons.push(`${publicKey.mldsaVariant} verify threw: ${err.message}`);
253
+ }
254
+ const valid = ed25519Valid && mldsaValid;
255
+ if (!valid && !ed25519Valid)
256
+ reasons.push('ed25519 half rejected');
257
+ if (!valid && !mldsaValid)
258
+ reasons.push(`${publicKey.mldsaVariant} half rejected`);
259
+ return {
260
+ valid,
261
+ ed25519Valid,
262
+ mldsaValid,
263
+ ...(valid ? {} : { reason: reasons.join('; ') }),
264
+ };
265
+ }
266
+ /**
267
+ * Project a `HybridKeyPair` to its `HybridPublicKey` shape, suitable for
268
+ * distributing to verifiers.
269
+ */
270
+ function getHybridPublicKey(keyPair) {
271
+ return {
272
+ algorithm: keyPair.algorithm,
273
+ ed25519PublicKey: keyPair.ed25519.publicKey,
274
+ mldsaPublicKey: keyPair.mldsa.publicKey,
275
+ mldsaVariant: keyPair.mldsa.variant,
276
+ };
277
+ }
278
+ // --- Encoding helpers for YAML/JSON transport ------------------------------
279
+ function toBase64(data) {
280
+ return Buffer.from(data).toString('base64');
281
+ }
282
+ function fromBase64(encoded) {
283
+ return new Uint8Array(Buffer.from(encoded, 'base64'));
284
+ }
285
+ /** Encode a hybrid signature for on-disk or on-wire transport. */
286
+ function encodeHybridSignature(signature) {
287
+ return {
288
+ alg: signature.algorithm,
289
+ ed25519Sig: toBase64(signature.ed25519Sig),
290
+ mldsaSig: toBase64(signature.mldsaSig),
291
+ ts: signature.timestamp,
292
+ };
293
+ }
294
+ /** Decode a hybrid signature from its transport form. */
295
+ function decodeHybridSignature(encoded) {
296
+ return {
297
+ algorithm: encoded.alg,
298
+ ed25519Sig: fromBase64(encoded.ed25519Sig),
299
+ mldsaSig: fromBase64(encoded.mldsaSig),
300
+ timestamp: encoded.ts,
301
+ };
302
+ }
303
+ /** Encode a hybrid public key for on-disk or on-wire transport. */
304
+ function encodeHybridPublicKey(publicKey) {
305
+ return {
306
+ algorithm: publicKey.algorithm,
307
+ ed25519PublicKey: toBase64(publicKey.ed25519PublicKey),
308
+ mldsaPublicKey: toBase64(publicKey.mldsaPublicKey),
309
+ mldsaVariant: publicKey.mldsaVariant,
310
+ };
311
+ }
312
+ /** Decode a hybrid public key from its transport form. */
313
+ function decodeHybridPublicKey(encoded) {
314
+ return {
315
+ algorithm: encoded.algorithm,
316
+ ed25519PublicKey: fromBase64(encoded.ed25519PublicKey),
317
+ mldsaPublicKey: fromBase64(encoded.mldsaPublicKey),
318
+ mldsaVariant: encoded.mldsaVariant,
319
+ };
320
+ }
321
+ //# sourceMappingURL=hybrid-signing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hybrid-signing.js","sourceRoot":"","sources":["../../../src/arp/crypto/hybrid-signing.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CH,gDASC;AAoBD,0CAkBC;AAUD,sDA6CC;AAMD,gCAkBC;AASD,oCA0EC;AAMD,gDAOC;AAaD,sDASC;AA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SAAS,EAAE,SAAS,CAAC,SAAS;QAC9B,gBAAgB,EAAE,QAAQ,CAAC,SAAS,CAAC,gBAAgB,CAAC;QACtD,cAAc,EAAE,QAAQ,CAAC,SAAS,CAAC,cAAc,CAAC;QAClD,YAAY,EAAE,SAAS,CAAC,YAAY;KACrC,CAAC;AACJ,CAAC;AAED,0DAA0D;AAC1D,SAAgB,qBAAqB,CACnC,OAA+B;IAE/B,OAAO;QACL,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,gBAAgB,EAAE,UAAU,CAAC,OAAO,CAAC,gBAAgB,CAAC;QACtD,cAAc,EAAE,UAAU,CAAC,OAAO,CAAC,cAAc,CAAC;QAClD,YAAY,EAAE,OAAO,CAAC,YAAY;KACnC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * ARP crypto module barrel.
3
+ *
4
+ * Public entry point for hybrid Ed25519 + ML-DSA signing primitives used by:
5
+ * - Capability manifest loader (verifies Ed25519+ML-DSA-65 signature before load)
6
+ * - `verifyClassification()` (verifies Ed25519+ML-DSA-44 on NanoMind-Guard output)
7
+ * - AIComply P1 integration (AC-001, AC-002, AC-010, AC-014, AC-015, AC-016)
8
+ */
9
+ export type { EncodedHybridPublicKey, EncodedHybridSignature, HybridAlgorithm, HybridKeyPair, HybridPublicKey, HybridSignature, HybridVerifyResult, MLDsaVariant, } from './types';
10
+ export { HybridCryptoError, KEY_SIZES, decodeHybridPublicKey, decodeHybridSignature, encodeHybridPublicKey, encodeHybridSignature, generateHybridKeyPair, getHybridPublicKey, hybridAlgorithmFor, hybridSign, hybridVerify, validateKeySize, } from './hybrid-signing';
11
+ export { CapabilityManifestError, MANIFEST_SIGNATURE_ALGORITHM, MANIFEST_VERSION, MAX_MANIFEST_SIZE_BYTES, canonicalizeManifestPayload, loadCapabilityManifest, parseCapabilityManifest, } from './manifest-loader';
12
+ export type { CapabilityManifestErrorCode } from './manifest-loader';
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/arp/crypto/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,YAAY,EACV,sBAAsB,EACtB,sBAAsB,EACtB,eAAe,EACf,aAAa,EACb,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,YAAY,GACb,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,UAAU,EACV,YAAY,EACZ,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,uBAAuB,EACvB,4BAA4B,EAC5B,gBAAgB,EAChB,uBAAuB,EACvB,2BAA2B,EAC3B,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,mBAAmB,CAAC;AAE3B,YAAY,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ /**
3
+ * ARP crypto module barrel.
4
+ *
5
+ * Public entry point for hybrid Ed25519 + ML-DSA signing primitives used by:
6
+ * - Capability manifest loader (verifies Ed25519+ML-DSA-65 signature before load)
7
+ * - `verifyClassification()` (verifies Ed25519+ML-DSA-44 on NanoMind-Guard output)
8
+ * - AIComply P1 integration (AC-001, AC-002, AC-010, AC-014, AC-015, AC-016)
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.parseCapabilityManifest = exports.loadCapabilityManifest = exports.canonicalizeManifestPayload = exports.MAX_MANIFEST_SIZE_BYTES = exports.MANIFEST_VERSION = exports.MANIFEST_SIGNATURE_ALGORITHM = exports.CapabilityManifestError = exports.validateKeySize = exports.hybridVerify = exports.hybridSign = exports.hybridAlgorithmFor = exports.getHybridPublicKey = exports.generateHybridKeyPair = exports.encodeHybridSignature = exports.encodeHybridPublicKey = exports.decodeHybridSignature = exports.decodeHybridPublicKey = exports.KEY_SIZES = exports.HybridCryptoError = void 0;
12
+ var hybrid_signing_1 = require("./hybrid-signing");
13
+ Object.defineProperty(exports, "HybridCryptoError", { enumerable: true, get: function () { return hybrid_signing_1.HybridCryptoError; } });
14
+ Object.defineProperty(exports, "KEY_SIZES", { enumerable: true, get: function () { return hybrid_signing_1.KEY_SIZES; } });
15
+ Object.defineProperty(exports, "decodeHybridPublicKey", { enumerable: true, get: function () { return hybrid_signing_1.decodeHybridPublicKey; } });
16
+ Object.defineProperty(exports, "decodeHybridSignature", { enumerable: true, get: function () { return hybrid_signing_1.decodeHybridSignature; } });
17
+ Object.defineProperty(exports, "encodeHybridPublicKey", { enumerable: true, get: function () { return hybrid_signing_1.encodeHybridPublicKey; } });
18
+ Object.defineProperty(exports, "encodeHybridSignature", { enumerable: true, get: function () { return hybrid_signing_1.encodeHybridSignature; } });
19
+ Object.defineProperty(exports, "generateHybridKeyPair", { enumerable: true, get: function () { return hybrid_signing_1.generateHybridKeyPair; } });
20
+ Object.defineProperty(exports, "getHybridPublicKey", { enumerable: true, get: function () { return hybrid_signing_1.getHybridPublicKey; } });
21
+ Object.defineProperty(exports, "hybridAlgorithmFor", { enumerable: true, get: function () { return hybrid_signing_1.hybridAlgorithmFor; } });
22
+ Object.defineProperty(exports, "hybridSign", { enumerable: true, get: function () { return hybrid_signing_1.hybridSign; } });
23
+ Object.defineProperty(exports, "hybridVerify", { enumerable: true, get: function () { return hybrid_signing_1.hybridVerify; } });
24
+ Object.defineProperty(exports, "validateKeySize", { enumerable: true, get: function () { return hybrid_signing_1.validateKeySize; } });
25
+ var manifest_loader_1 = require("./manifest-loader");
26
+ Object.defineProperty(exports, "CapabilityManifestError", { enumerable: true, get: function () { return manifest_loader_1.CapabilityManifestError; } });
27
+ Object.defineProperty(exports, "MANIFEST_SIGNATURE_ALGORITHM", { enumerable: true, get: function () { return manifest_loader_1.MANIFEST_SIGNATURE_ALGORITHM; } });
28
+ Object.defineProperty(exports, "MANIFEST_VERSION", { enumerable: true, get: function () { return manifest_loader_1.MANIFEST_VERSION; } });
29
+ Object.defineProperty(exports, "MAX_MANIFEST_SIZE_BYTES", { enumerable: true, get: function () { return manifest_loader_1.MAX_MANIFEST_SIZE_BYTES; } });
30
+ Object.defineProperty(exports, "canonicalizeManifestPayload", { enumerable: true, get: function () { return manifest_loader_1.canonicalizeManifestPayload; } });
31
+ Object.defineProperty(exports, "loadCapabilityManifest", { enumerable: true, get: function () { return manifest_loader_1.loadCapabilityManifest; } });
32
+ Object.defineProperty(exports, "parseCapabilityManifest", { enumerable: true, get: function () { return manifest_loader_1.parseCapabilityManifest; } });
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/arp/crypto/index.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAaH,mDAa0B;AAZxB,mHAAA,iBAAiB,OAAA;AACjB,2GAAA,SAAS,OAAA;AACT,uHAAA,qBAAqB,OAAA;AACrB,uHAAA,qBAAqB,OAAA;AACrB,uHAAA,qBAAqB,OAAA;AACrB,uHAAA,qBAAqB,OAAA;AACrB,uHAAA,qBAAqB,OAAA;AACrB,oHAAA,kBAAkB,OAAA;AAClB,oHAAA,kBAAkB,OAAA;AAClB,4GAAA,UAAU,OAAA;AACV,8GAAA,YAAY,OAAA;AACZ,iHAAA,eAAe,OAAA;AAGjB,qDAQ2B;AAPzB,0HAAA,uBAAuB,OAAA;AACvB,+HAAA,4BAA4B,OAAA;AAC5B,mHAAA,gBAAgB,OAAA;AAChB,0HAAA,uBAAuB,OAAA;AACvB,8HAAA,2BAA2B,OAAA;AAC3B,yHAAA,sBAAsB,OAAA;AACtB,0HAAA,uBAAuB,OAAA"}
@@ -0,0 +1,117 @@
1
+ /**
2
+ * Capability manifest YAML loader with hybrid Ed25519+ML-DSA-65 signature
3
+ * verification.
4
+ *
5
+ * The loader implements parse-to-deny (CR-001): any failure at any step --
6
+ * I/O, oversized file, YAML parse error, schema mismatch, missing signature,
7
+ * wrong algorithm, malformed public key, signature rejection, or expiry --
8
+ * raises a `CapabilityManifestError`. Callers must treat the thrown error as
9
+ * an authoritative signal to refuse loading the manifest. There is no
10
+ * partial-success path.
11
+ *
12
+ * Wire format (YAML on disk):
13
+ *
14
+ * version: "1.0.0"
15
+ * agentId: "example-agent"
16
+ * tier: "execute"
17
+ * comply:
18
+ * permitted_classes: ["class-a", "class-b"]
19
+ * prohibited_classes: ["class-c"]
20
+ * on_violation: "deny"
21
+ * issuedAt: "2026-04-13T00:00:00.000Z"
22
+ * expiresAt: "2027-04-13T00:00:00.000Z"
23
+ * ed25519PublicKey: "<base64>"
24
+ * mldsa65PublicKey: "<base64>"
25
+ * signature:
26
+ * alg: "Ed25519+ML-DSA-65"
27
+ * ed25519Sig: "<base64>"
28
+ * mldsaSig: "<base64>"
29
+ * ts: 1712880000000
30
+ *
31
+ * The signed payload is the manifest object with the `signature` field
32
+ * stripped, serialized to canonical JSON (sorted keys, no whitespace). Signer
33
+ * and verifier must produce byte-identical canonical output or round-tripping
34
+ * will not work. The closed schema (scalars + string arrays + one nested
35
+ * object) is simple enough that full RFC 8785 JCS is unnecessary; the
36
+ * `stableStringify` helper below is deterministic for the shapes we accept.
37
+ *
38
+ * Integration points (deferred to follow-up sessions, not wired yet):
39
+ * - `src/arp/proxy/server.ts`: load manifest on agent registration, fail
40
+ * closed if verification raises.
41
+ * - `src/arp/intelligence/coordinator.ts`: consult the `comply` envelope
42
+ * when an event's classification lands outside permitted classes.
43
+ */
44
+ import type { CapabilityManifest } from '../types';
45
+ import type { HybridAlgorithm } from './types';
46
+ /** Only wire format version currently accepted. */
47
+ export declare const MANIFEST_VERSION: "1.0.0";
48
+ /**
49
+ * Only hybrid algorithm permitted for capability manifests. ML-DSA-65 is the
50
+ * NIST category 3 parameter set, matching the AIM SDK default for manifests.
51
+ * ML-DSA-44 is reserved for high-throughput identity signals; ML-DSA-87 for
52
+ * root keys. Manifests that claim a different algorithm are refused.
53
+ */
54
+ export declare const MANIFEST_SIGNATURE_ALGORITHM: HybridAlgorithm;
55
+ /**
56
+ * Hard cap on the manifest file size. Anything larger is rejected before
57
+ * YAML parsing to bound worst-case memory and CPU for a malicious file. 64
58
+ * KiB is ample: a realistic manifest with a few hundred permitted classes
59
+ * and base64 public keys sits well under 8 KiB.
60
+ */
61
+ export declare const MAX_MANIFEST_SIZE_BYTES: number;
62
+ /**
63
+ * Discrete error codes so callers can switch on the reason without parsing
64
+ * string messages. Keep this in sync with `CapabilityManifestError.code`.
65
+ */
66
+ export type CapabilityManifestErrorCode = 'IO_ERROR' | 'SIZE_EXCEEDED' | 'PARSE_ERROR' | 'SCHEMA_ERROR' | 'VERSION_UNSUPPORTED' | 'SIGNATURE_MISSING' | 'ALGORITHM_UNSUPPORTED' | 'KEY_FORMAT_ERROR' | 'SIGNATURE_INVALID' | 'EXPIRED';
67
+ /**
68
+ * Error raised on any loader failure. Callers MUST treat a thrown
69
+ * `CapabilityManifestError` as an authoritative parse-to-deny signal. Do not
70
+ * fall through to a "load without verification" path under any circumstance.
71
+ */
72
+ export declare class CapabilityManifestError extends Error {
73
+ readonly code: CapabilityManifestErrorCode;
74
+ readonly details?: {
75
+ reason?: string;
76
+ cause?: unknown;
77
+ } | undefined;
78
+ constructor(code: CapabilityManifestErrorCode, message: string, details?: {
79
+ reason?: string;
80
+ cause?: unknown;
81
+ } | undefined);
82
+ }
83
+ /**
84
+ * Produce canonical signed-payload bytes for a parsed manifest object.
85
+ *
86
+ * Canonicalization:
87
+ * 1. Remove the `signature` field if present.
88
+ * 2. Serialize as JSON with recursively sorted object keys and no
89
+ * whitespace between tokens.
90
+ * 3. Encode the result as UTF-8.
91
+ *
92
+ * Exported because fixture generators and out-of-repo signers need to
93
+ * produce the exact same bytes as the verifier. Duplicating this logic in a
94
+ * signer is a recipe for drift.
95
+ */
96
+ export declare function canonicalizeManifestPayload(payload: Record<string, unknown>): Uint8Array;
97
+ /**
98
+ * Load and verify a capability manifest from a YAML file on disk.
99
+ *
100
+ * On success, returns the verified `CapabilityManifest` shape (without the
101
+ * signature block, which is not part of the runtime type). On any failure
102
+ * throws a `CapabilityManifestError` -- the caller fails closed.
103
+ *
104
+ * The file is read once, size-checked, then parsed and verified. I/O errors
105
+ * are reported with `code: 'IO_ERROR'` and the underlying error exposed via
106
+ * `details.cause` so callers can log the root cause without re-throwing.
107
+ */
108
+ export declare function loadCapabilityManifest(filePath: string): Promise<CapabilityManifest>;
109
+ /**
110
+ * Parse and verify a capability manifest from YAML text.
111
+ *
112
+ * Separated from `loadCapabilityManifest` so callers that already have the
113
+ * text in memory (pulled from a database, stdin, IPC channel) can verify
114
+ * without a filesystem round trip.
115
+ */
116
+ export declare function parseCapabilityManifest(yamlText: string): Promise<CapabilityManifest>;
117
+ //# sourceMappingURL=manifest-loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest-loader.d.ts","sourceRoot":"","sources":["../../../src/arp/crypto/manifest-loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAMH,OAAO,KAAK,EACV,kBAAkB,EAGnB,MAAM,UAAU,CAAC;AAOlB,OAAO,KAAK,EAGV,eAAe,EAChB,MAAM,SAAS,CAAC;AAEjB,mDAAmD;AACnD,eAAO,MAAM,gBAAgB,EAAG,OAAgB,CAAC;AAEjD;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,EAAE,eACtB,CAAC;AAEtB;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,QAAY,CAAC;AAejD;;;GAGG;AACH,MAAM,MAAM,2BAA2B,GACnC,UAAU,GACV,eAAe,GACf,aAAa,GACb,cAAc,GACd,qBAAqB,GACrB,mBAAmB,GACnB,uBAAuB,GACvB,kBAAkB,GAClB,mBAAmB,GACnB,SAAS,CAAC;AAEd;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,KAAK;aAE9B,IAAI,EAA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