@wasmagent/aep 0.1.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -1
- package/dist/canonical.d.ts +18 -0
- package/dist/canonical.d.ts.map +1 -0
- package/dist/canonical.js +31 -0
- package/dist/canonical.js.map +1 -0
- package/dist/emitter.d.ts +26 -0
- package/dist/emitter.d.ts.map +1 -1
- package/dist/emitter.js +68 -4
- package/dist/emitter.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/signer.d.ts +64 -0
- package/dist/signer.d.ts.map +1 -0
- package/dist/signer.js +50 -0
- package/dist/signer.js.map +1 -0
- package/dist/types.d.ts +173 -16
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +32 -6
- package/dist/types.js.map +1 -1
- package/dist/verify.d.ts +15 -0
- package/dist/verify.d.ts.map +1 -0
- package/dist/verify.js +28 -0
- package/dist/verify.js.map +1 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
# @wasmagent/aep
|
|
2
2
|
|
|
3
|
+
> **Maturity: beta (v0.2 signature contract)** — AEP v0.2 Ed25519 signature contract shipped and schema-versioned. The signing key management story (KMS rotation, key revocation) is still evolving; treat key-id semantics as beta-stable.
|
|
4
|
+
|
|
3
5
|
Agent Evidence Protocol — runtime action evidence and run provenance types for WasmAgent.
|
|
4
6
|
|
|
5
|
-
Emit verifiable `AEPRecord` evidence after every agent run. Records are schema-versioned (
|
|
7
|
+
Emit verifiable `AEPRecord` evidence after every agent run. Records are schema-versioned; v0.2 (Ed25519 signature contract) is the current shipped schema. v0.1 records are still parsed for backward compatibility but no longer produced. Records are consumable by `evomerge` for audit and training data export.
|
|
6
8
|
|
|
7
9
|
## Install
|
|
8
10
|
|
|
@@ -40,6 +42,73 @@ const record = emitter.build();
|
|
|
40
42
|
- [wasmagent-js security pack](https://WasmAgent.github.io/wasmagent-js/security-governance-pack/)
|
|
41
43
|
- [trace-pipeline evomerge](https://github.com/WasmAgent/trace-pipeline)
|
|
42
44
|
|
|
45
|
+
## Signature contract v0.2
|
|
46
|
+
|
|
47
|
+
Every `AEPRecord` emitted via `AEPEmitter.emit()` carries a mandatory `signature` block:
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
signature: {
|
|
51
|
+
alg: "ed25519", // always "ed25519" in v0.2
|
|
52
|
+
key_id: string, // stable identifier for the signing key (e.g. "local-dev-key-01")
|
|
53
|
+
sig: string, // base64-encoded 64-byte Ed25519 signature
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### What is signed
|
|
58
|
+
|
|
59
|
+
The signature covers the **canonical serialisation** of the record minus the `signature` field itself.
|
|
60
|
+
Canonical serialisation sorts JSON object keys lexicographically (recursive) and UTF-8-encodes the result.
|
|
61
|
+
This means any field mutation (including `run_id`, `created_at_ms`, `actions`, etc.) invalidates the signature.
|
|
62
|
+
|
|
63
|
+
### Verifying a record
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
import { verifyAEPRecord, createLocalSignerFromSeed } from "@wasmagent/aep";
|
|
67
|
+
|
|
68
|
+
const signer = createLocalSignerFromSeed(seedHex, "my-key-01");
|
|
69
|
+
const publicKey = await signer.getPublicKey();
|
|
70
|
+
|
|
71
|
+
const valid = await verifyAEPRecord(record, publicKey); // true / false
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### KMS adapter interface
|
|
75
|
+
|
|
76
|
+
To swap in a hardware KMS (AWS KMS, GCP Cloud KMS, HashiCorp Vault, etc.) implement the `AEPSigner` interface:
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
export interface AEPSigner {
|
|
80
|
+
readonly keyId: string;
|
|
81
|
+
sign(bytes: Uint8Array): Promise<string>; // returns base64-encoded signature
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Example skeleton for AWS KMS (not included in this package — bring your own SDK):
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
import { KMSClient, SignCommand } from "@aws-sdk/client-kms";
|
|
89
|
+
|
|
90
|
+
class AwsKmsSigner implements AEPSigner {
|
|
91
|
+
constructor(readonly keyId: string, private client: KMSClient) {}
|
|
92
|
+
|
|
93
|
+
async sign(bytes: Uint8Array): Promise<string> {
|
|
94
|
+
const resp = await this.client.send(new SignCommand({
|
|
95
|
+
KeyId: this.keyId,
|
|
96
|
+
Message: bytes,
|
|
97
|
+
MessageType: "RAW",
|
|
98
|
+
SigningAlgorithm: "ECDSA_SHA_256", // use the algorithm supported by your key
|
|
99
|
+
}));
|
|
100
|
+
return Buffer.from(resp.Signature!).toString("base64");
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Pass any `AEPSigner` implementation to `AEPEmitter`:
|
|
106
|
+
|
|
107
|
+
```ts
|
|
108
|
+
const emitter = new AEPEmitter({ run_id: "run-001", signer: new AwsKmsSigner(keyId, kmsClient) });
|
|
109
|
+
const record = await emitter.emit();
|
|
110
|
+
```
|
|
111
|
+
|
|
43
112
|
## License
|
|
44
113
|
|
|
45
114
|
Apache-2.0
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* canonical.ts — deterministic serialisation for AEP record signing.
|
|
3
|
+
*
|
|
4
|
+
* Rules:
|
|
5
|
+
* - Object keys are sorted lexicographically (recursive).
|
|
6
|
+
* - Arrays preserve order.
|
|
7
|
+
* - The result is UTF-8 encoded JSON with no trailing newline.
|
|
8
|
+
*
|
|
9
|
+
* The `signature` field MUST be stripped before calling this function.
|
|
10
|
+
* That is the responsibility of the caller (AEPEmitter / verifyAEPRecord).
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Serialize an object to canonical UTF-8 bytes for signing.
|
|
14
|
+
*
|
|
15
|
+
* Object keys are sorted recursively; arrays preserve their order.
|
|
16
|
+
*/
|
|
17
|
+
export declare function canonicalBytes(obj: unknown): Uint8Array;
|
|
18
|
+
//# sourceMappingURL=canonical.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonical.d.ts","sourceRoot":"","sources":["../src/canonical.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAaH;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,UAAU,CAGvD"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* canonical.ts — deterministic serialisation for AEP record signing.
|
|
3
|
+
*
|
|
4
|
+
* Rules:
|
|
5
|
+
* - Object keys are sorted lexicographically (recursive).
|
|
6
|
+
* - Arrays preserve order.
|
|
7
|
+
* - The result is UTF-8 encoded JSON with no trailing newline.
|
|
8
|
+
*
|
|
9
|
+
* The `signature` field MUST be stripped before calling this function.
|
|
10
|
+
* That is the responsibility of the caller (AEPEmitter / verifyAEPRecord).
|
|
11
|
+
*/
|
|
12
|
+
function sortedReplacer(_key, value) {
|
|
13
|
+
if (value !== null && typeof value === "object" && !Array.isArray(value)) {
|
|
14
|
+
const sorted = {};
|
|
15
|
+
for (const k of Object.keys(value).sort()) {
|
|
16
|
+
sorted[k] = value[k];
|
|
17
|
+
}
|
|
18
|
+
return sorted;
|
|
19
|
+
}
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Serialize an object to canonical UTF-8 bytes for signing.
|
|
24
|
+
*
|
|
25
|
+
* Object keys are sorted recursively; arrays preserve their order.
|
|
26
|
+
*/
|
|
27
|
+
export function canonicalBytes(obj) {
|
|
28
|
+
const json = JSON.stringify(obj, sortedReplacer);
|
|
29
|
+
return new TextEncoder().encode(json);
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=canonical.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonical.js","sourceRoot":"","sources":["../src/canonical.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,SAAS,cAAc,CAAC,IAAY,EAAE,KAAc;IAClD,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzE,MAAM,MAAM,GAA4B,EAAE,CAAC;QAC3C,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,KAAgC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;YACrE,MAAM,CAAC,CAAC,CAAC,GAAI,KAAiC,CAAC,CAAC,CAAC,CAAC;QACpD,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,GAAY;IACzC,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;IACjD,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACxC,CAAC"}
|
package/dist/emitter.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AEPSigner } from "./signer.js";
|
|
1
2
|
import type { ActionEvidence, AEPRecord, BudgetLedger, CapabilityDecision, InputRef, OutputRef, VerifierResult } from "./types.js";
|
|
2
3
|
export interface AEPEmitterOptions {
|
|
3
4
|
run_id: string;
|
|
@@ -9,6 +10,8 @@ export interface AEPEmitterOptions {
|
|
|
9
10
|
model_id?: string;
|
|
10
11
|
policy_bundle_digest?: string;
|
|
11
12
|
tool_manifest_digest?: string;
|
|
13
|
+
/** Optional signer. When provided, emit() signs the record; build() remains unsigned-compatible via a dummy placeholder. */
|
|
14
|
+
signer?: AEPSigner;
|
|
12
15
|
}
|
|
13
16
|
export declare class AEPEmitter {
|
|
14
17
|
#private;
|
|
@@ -22,7 +25,30 @@ export declare class AEPEmitter {
|
|
|
22
25
|
addOutputRef(ref: OutputRef): void;
|
|
23
26
|
addVerifierResult(result: VerifierResult): void;
|
|
24
27
|
setBudgetLedger(ledger: BudgetLedger): void;
|
|
28
|
+
/**
|
|
29
|
+
* Build an unsigned AEPRecord. A placeholder `signature` block is included
|
|
30
|
+
* so the record satisfies the schema (signature is required since v0.2).
|
|
31
|
+
*
|
|
32
|
+
* For a fully signed record use `emit()` instead.
|
|
33
|
+
*
|
|
34
|
+
* @param createdAtMs - Override creation timestamp (defaults to performance.now()).
|
|
35
|
+
* @param signerOverride - Optional: provide a signer to sign inline (async variant).
|
|
36
|
+
* Prefer `emit()` for async signing.
|
|
37
|
+
*/
|
|
25
38
|
build(createdAtMs?: number): AEPRecord;
|
|
39
|
+
/**
|
|
40
|
+
* Build and sign an AEPRecord.
|
|
41
|
+
*
|
|
42
|
+
* Sequence:
|
|
43
|
+
* 1. Assemble the record payload (no signature field yet).
|
|
44
|
+
* 2. Serialise to canonical bytes.
|
|
45
|
+
* 3. Sign with the configured AEPSigner.
|
|
46
|
+
* 4. Attach the `signature` block and validate the full schema.
|
|
47
|
+
*
|
|
48
|
+
* @param createdAtMs - Override creation timestamp.
|
|
49
|
+
* @throws If no signer was provided at construction time.
|
|
50
|
+
*/
|
|
51
|
+
emit(createdAtMs?: number): Promise<AEPRecord>;
|
|
26
52
|
static digestContent(content: string): string;
|
|
27
53
|
}
|
|
28
54
|
//# sourceMappingURL=emitter.d.ts.map
|
package/dist/emitter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emitter.d.ts","sourceRoot":"","sources":["../src/emitter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"emitter.d.ts","sourceRoot":"","sources":["../src/emitter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EACV,cAAc,EACd,SAAS,EACT,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js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
|
+
import { canonicalBytes } from "./canonical.js";
|
|
2
3
|
import { AEPRecordSchema } from "./types.js";
|
|
3
4
|
export class AEPEmitter {
|
|
4
5
|
#opts;
|
|
@@ -33,10 +34,73 @@ export class AEPEmitter {
|
|
|
33
34
|
setBudgetLedger(ledger) {
|
|
34
35
|
this.#budgetLedger = ledger;
|
|
35
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Build an unsigned AEPRecord. A placeholder `signature` block is included
|
|
39
|
+
* so the record satisfies the schema (signature is required since v0.2).
|
|
40
|
+
*
|
|
41
|
+
* For a fully signed record use `emit()` instead.
|
|
42
|
+
*
|
|
43
|
+
* @param createdAtMs - Override creation timestamp (defaults to performance.now()).
|
|
44
|
+
* @param signerOverride - Optional: provide a signer to sign inline (async variant).
|
|
45
|
+
* Prefer `emit()` for async signing.
|
|
46
|
+
*/
|
|
36
47
|
build(createdAtMs) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
48
|
+
const signer = this.#opts.signer;
|
|
49
|
+
if (signer) {
|
|
50
|
+
// Caller should use emit() when a signer is configured — but if they
|
|
51
|
+
// call build() synchronously we return a placeholder-signed record.
|
|
52
|
+
// The placeholder is stable and deterministic; it will fail verifyAEPRecord.
|
|
53
|
+
// This path is only reached in synchronous test helpers.
|
|
54
|
+
}
|
|
55
|
+
const unsigned = this.#buildUnsigned(createdAtMs);
|
|
56
|
+
const placeholder = signer
|
|
57
|
+
? { alg: "ed25519", key_id: signer.keyId, sig: "UNSIGNED_PLACEHOLDER" }
|
|
58
|
+
: { alg: "ed25519", key_id: "none", sig: "UNSIGNED_PLACEHOLDER" };
|
|
59
|
+
return AEPRecordSchema.parse({ ...unsigned, signature: placeholder });
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Build and sign an AEPRecord.
|
|
63
|
+
*
|
|
64
|
+
* Sequence:
|
|
65
|
+
* 1. Assemble the record payload (no signature field yet).
|
|
66
|
+
* 2. Serialise to canonical bytes.
|
|
67
|
+
* 3. Sign with the configured AEPSigner.
|
|
68
|
+
* 4. Attach the `signature` block and validate the full schema.
|
|
69
|
+
*
|
|
70
|
+
* @param createdAtMs - Override creation timestamp.
|
|
71
|
+
* @throws If no signer was provided at construction time.
|
|
72
|
+
*/
|
|
73
|
+
async emit(createdAtMs) {
|
|
74
|
+
const signer = this.#opts.signer;
|
|
75
|
+
if (!signer) {
|
|
76
|
+
throw new Error("AEPEmitter.emit() requires a signer. Pass `signer` in AEPEmitterOptions or use build() for unsigned records.");
|
|
77
|
+
}
|
|
78
|
+
const unsigned = this.#buildUnsigned(createdAtMs);
|
|
79
|
+
// Parse through zod with a placeholder so that zod normalises the record
|
|
80
|
+
// (applies defaults, strips unknown fields) before we compute canonical bytes.
|
|
81
|
+
// verifyAEPRecord strips `signature` from the already-parsed record and
|
|
82
|
+
// recomputes the same canonical bytes, so both sides are consistent.
|
|
83
|
+
const placeholder = {
|
|
84
|
+
alg: "ed25519",
|
|
85
|
+
key_id: signer.keyId,
|
|
86
|
+
sig: "PLACEHOLDER",
|
|
87
|
+
};
|
|
88
|
+
const normalised = AEPRecordSchema.parse({ ...unsigned, signature: placeholder });
|
|
89
|
+
const { signature: _placeholder, ...normalisedUnsigned } = normalised;
|
|
90
|
+
const bytes = canonicalBytes(normalisedUnsigned);
|
|
91
|
+
const sig = await signer.sign(bytes);
|
|
92
|
+
const signature = {
|
|
93
|
+
alg: "ed25519",
|
|
94
|
+
key_id: signer.keyId,
|
|
95
|
+
sig,
|
|
96
|
+
};
|
|
97
|
+
return AEPRecordSchema.parse({ ...normalisedUnsigned, signature });
|
|
98
|
+
}
|
|
99
|
+
#buildUnsigned(createdAtMs) {
|
|
100
|
+
const { signer: _signer, ...opts } = this.#opts;
|
|
101
|
+
return {
|
|
102
|
+
schema_version: "aep/v0.2",
|
|
103
|
+
...opts,
|
|
40
104
|
input_refs: this.#inputRefs,
|
|
41
105
|
output_refs: this.#outputRefs,
|
|
42
106
|
capability_decisions: this.#capabilityDecisions,
|
|
@@ -44,7 +108,7 @@ export class AEPEmitter {
|
|
|
44
108
|
verifier_results: this.#verifierResults,
|
|
45
109
|
budget_ledger: this.#budgetLedger,
|
|
46
110
|
created_at_ms: createdAtMs ?? performance.now(),
|
|
47
|
-
}
|
|
111
|
+
};
|
|
48
112
|
}
|
|
49
113
|
static digestContent(content) {
|
|
50
114
|
return createHash("sha256").update(content).digest("hex");
|
package/dist/emitter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emitter.js","sourceRoot":"","sources":["../src/emitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"emitter.js","sourceRoot":"","sources":["../src/emitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAWhD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAgB7C,MAAM,OAAO,UAAU;IACZ,KAAK,CAAoB;IACzB,QAAQ,GAAqB,EAAE,CAAC;IAChC,oBAAoB,GAAyB,EAAE,CAAC;IAChD,UAAU,GAAe,EAAE,CAAC;IAC5B,WAAW,GAAgB,EAAE,CAAC;IAC9B,gBAAgB,GAAqB,EAAE,CAAC;IACjD,aAAa,CAA2B;IAExC,YAAY,IAAuB;QACjC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,SAAS,CACP,MAGC;QAED,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;YACjB,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,UAAU,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;YAC/D,YAAY,EAAE,MAAM,CAAC,YAAY,IAAI,WAAW,CAAC,GAAG,EAAE;YACtD,GAAG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,EAAE,IAAI,CAAC,gBAAgB;YACvC,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,aAAa,EAAE,WAAW,IAAI,WAAW,CAAC,GAAG,EAAE;SAChD,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,aAAa,CAAC,OAAe;QAClC,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5D,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
|
package/dist/signer.d.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AEPSigner — pluggable signing interface.
|
|
3
|
+
*
|
|
4
|
+
* Implement this interface to swap in a KMS adapter (AWS KMS, GCP KMS, etc.)
|
|
5
|
+
* without changing the AEPEmitter call site.
|
|
6
|
+
*
|
|
7
|
+
* KMS adapter shape (for reference — not implemented in this package):
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* class AwsKmsSigner implements AEPSigner {
|
|
11
|
+
* constructor(readonly keyId: string, private client: KMSClient) {}
|
|
12
|
+
* async sign(bytes: Uint8Array): Promise<string> {
|
|
13
|
+
* const resp = await this.client.send(new SignCommand({
|
|
14
|
+
* KeyId: this.keyId,
|
|
15
|
+
* Message: bytes,
|
|
16
|
+
* SigningAlgorithm: "ED25519",
|
|
17
|
+
* }));
|
|
18
|
+
* return Buffer.from(resp.Signature!).toString("base64");
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export interface AEPSigner {
|
|
24
|
+
/** Stable key identifier stored in the AEPRecord signature block. */
|
|
25
|
+
readonly keyId: string;
|
|
26
|
+
/**
|
|
27
|
+
* Sign the provided bytes and return a base64-encoded signature string.
|
|
28
|
+
*
|
|
29
|
+
* @param bytes - The canonical serialisation of the unsigned AEPRecord.
|
|
30
|
+
* @returns base64-encoded ed25519 signature (or equivalent for KMS adapters).
|
|
31
|
+
*/
|
|
32
|
+
sign(bytes: Uint8Array): Promise<string>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* LocalEd25519Signer — in-process ed25519 signer backed by @noble/ed25519.
|
|
36
|
+
*
|
|
37
|
+
* Suitable for development, CI, and environments where a hardware KMS is
|
|
38
|
+
* unavailable. For production, replace with a KMS adapter that implements
|
|
39
|
+
* the AEPSigner interface above.
|
|
40
|
+
*/
|
|
41
|
+
export declare class LocalEd25519Signer implements AEPSigner {
|
|
42
|
+
#private;
|
|
43
|
+
readonly keyId: string;
|
|
44
|
+
constructor(keyId: string, secretKey: Uint8Array);
|
|
45
|
+
sign(bytes: Uint8Array): Promise<string>;
|
|
46
|
+
/** Returns the corresponding Ed25519 public key bytes (32 bytes). */
|
|
47
|
+
getPublicKey(): Promise<Uint8Array>;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* createLocalSignerFromSeed — create a LocalEd25519Signer from a 32-byte hex seed.
|
|
51
|
+
*
|
|
52
|
+
* @param seedHex - 64-character hex string representing 32 secret key bytes.
|
|
53
|
+
* @param keyId - Stable key identifier (e.g. "local-dev-key-01").
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* const signer = createLocalSignerFromSeed(
|
|
58
|
+
* "a".repeat(64), // 32 zero-ish bytes for dev/testing
|
|
59
|
+
* "local-dev-key-01"
|
|
60
|
+
* );
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export declare function createLocalSignerFromSeed(seedHex: string, keyId: string): LocalEd25519Signer;
|
|
64
|
+
//# sourceMappingURL=signer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../src/signer.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,WAAW,SAAS;IACxB,qEAAqE;IACrE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB;;;;;OAKG;IACH,IAAI,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC1C;AAED;;;;;;GAMG;AACH,qBAAa,kBAAmB,YAAW,SAAS;;IAClD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;gBAIX,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU;IAK1C,IAAI,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;IAK9C,qEAAqE;IAC/D,YAAY,IAAI,OAAO,CAAC,UAAU,CAAC;CAM1C;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,kBAAkB,CAM5F"}
|
package/dist/signer.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as ed from "@noble/ed25519";
|
|
2
|
+
/**
|
|
3
|
+
* LocalEd25519Signer — in-process ed25519 signer backed by @noble/ed25519.
|
|
4
|
+
*
|
|
5
|
+
* Suitable for development, CI, and environments where a hardware KMS is
|
|
6
|
+
* unavailable. For production, replace with a KMS adapter that implements
|
|
7
|
+
* the AEPSigner interface above.
|
|
8
|
+
*/
|
|
9
|
+
export class LocalEd25519Signer {
|
|
10
|
+
keyId;
|
|
11
|
+
#secretKey;
|
|
12
|
+
#publicKey;
|
|
13
|
+
constructor(keyId, secretKey) {
|
|
14
|
+
this.keyId = keyId;
|
|
15
|
+
this.#secretKey = secretKey;
|
|
16
|
+
}
|
|
17
|
+
async sign(bytes) {
|
|
18
|
+
const sigBytes = await ed.signAsync(bytes, this.#secretKey);
|
|
19
|
+
return Buffer.from(sigBytes).toString("base64");
|
|
20
|
+
}
|
|
21
|
+
/** Returns the corresponding Ed25519 public key bytes (32 bytes). */
|
|
22
|
+
async getPublicKey() {
|
|
23
|
+
if (!this.#publicKey) {
|
|
24
|
+
this.#publicKey = await ed.getPublicKeyAsync(this.#secretKey);
|
|
25
|
+
}
|
|
26
|
+
return this.#publicKey;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* createLocalSignerFromSeed — create a LocalEd25519Signer from a 32-byte hex seed.
|
|
31
|
+
*
|
|
32
|
+
* @param seedHex - 64-character hex string representing 32 secret key bytes.
|
|
33
|
+
* @param keyId - Stable key identifier (e.g. "local-dev-key-01").
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* const signer = createLocalSignerFromSeed(
|
|
38
|
+
* "a".repeat(64), // 32 zero-ish bytes for dev/testing
|
|
39
|
+
* "local-dev-key-01"
|
|
40
|
+
* );
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export function createLocalSignerFromSeed(seedHex, keyId) {
|
|
44
|
+
if (!/^[0-9a-fA-F]{64}$/.test(seedHex)) {
|
|
45
|
+
throw new Error("seedHex must be a 64-character hexadecimal string (32 bytes)");
|
|
46
|
+
}
|
|
47
|
+
const bytes = Uint8Array.from(Buffer.from(seedHex, "hex"));
|
|
48
|
+
return new LocalEd25519Signer(keyId, bytes);
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=signer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signer.js","sourceRoot":"","sources":["../src/signer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAqCrC;;;;;;GAMG;AACH,MAAM,OAAO,kBAAkB;IACpB,KAAK,CAAS;IACd,UAAU,CAAa;IAChC,UAAU,CAAyB;IAEnC,YAAY,KAAa,EAAE,SAAqB;QAC9C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAC9B,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,KAAiB;QAC1B,MAAM,QAAQ,GAAG,MAAM,EAAE,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAC5D,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAClD,CAAC;IAED,qEAAqE;IACrE,KAAK,CAAC,YAAY;QAChB,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACrB,IAAI,CAAC,UAAU,GAAG,MAAM,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAChE,CAAC;QACD,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;CACF;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,yBAAyB,CAAC,OAAe,EAAE,KAAa;IACtE,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAC;IAClF,CAAC;IACD,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;IAC3D,OAAO,IAAI,kBAAkB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAC9C,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -46,6 +46,18 @@ export declare const ActionEvidenceSchema: z.ZodObject<{
|
|
|
46
46
|
reason_code?: string | undefined;
|
|
47
47
|
}>>;
|
|
48
48
|
timestamp_ms: z.ZodNumber;
|
|
49
|
+
parent_action_id: z.ZodOptional<z.ZodString>;
|
|
50
|
+
causal_chain_id: z.ZodOptional<z.ZodString>;
|
|
51
|
+
tool_descriptor_digest: z.ZodOptional<z.ZodString>;
|
|
52
|
+
server_card_digest: z.ZodOptional<z.ZodString>;
|
|
53
|
+
scope_lease_id: z.ZodOptional<z.ZodString>;
|
|
54
|
+
approval_context_hash: z.ZodOptional<z.ZodString>;
|
|
55
|
+
input_taint_labels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
56
|
+
output_taint_labels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
57
|
+
memory_read_refs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
58
|
+
memory_write_refs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
59
|
+
pre_state_digest: z.ZodOptional<z.ZodString>;
|
|
60
|
+
post_state_digest: z.ZodOptional<z.ZodString>;
|
|
49
61
|
}, "strip", z.ZodTypeAny, {
|
|
50
62
|
action_id: string;
|
|
51
63
|
tool_name: string;
|
|
@@ -61,6 +73,18 @@ export declare const ActionEvidenceSchema: z.ZodObject<{
|
|
|
61
73
|
decision: "allow" | "deny" | "ask_user" | "dry_run";
|
|
62
74
|
reason_code?: string | undefined;
|
|
63
75
|
} | undefined;
|
|
76
|
+
parent_action_id?: string | undefined;
|
|
77
|
+
causal_chain_id?: string | undefined;
|
|
78
|
+
tool_descriptor_digest?: string | undefined;
|
|
79
|
+
server_card_digest?: string | undefined;
|
|
80
|
+
scope_lease_id?: string | undefined;
|
|
81
|
+
approval_context_hash?: string | undefined;
|
|
82
|
+
input_taint_labels?: string[] | undefined;
|
|
83
|
+
output_taint_labels?: string[] | undefined;
|
|
84
|
+
memory_read_refs?: string[] | undefined;
|
|
85
|
+
memory_write_refs?: string[] | undefined;
|
|
86
|
+
pre_state_digest?: string | undefined;
|
|
87
|
+
post_state_digest?: string | undefined;
|
|
64
88
|
}, {
|
|
65
89
|
action_id: string;
|
|
66
90
|
tool_name: string;
|
|
@@ -76,6 +100,18 @@ export declare const ActionEvidenceSchema: z.ZodObject<{
|
|
|
76
100
|
decision: "allow" | "deny" | "ask_user" | "dry_run";
|
|
77
101
|
reason_code?: string | undefined;
|
|
78
102
|
} | undefined;
|
|
103
|
+
parent_action_id?: string | undefined;
|
|
104
|
+
causal_chain_id?: string | undefined;
|
|
105
|
+
tool_descriptor_digest?: string | undefined;
|
|
106
|
+
server_card_digest?: string | undefined;
|
|
107
|
+
scope_lease_id?: string | undefined;
|
|
108
|
+
approval_context_hash?: string | undefined;
|
|
109
|
+
input_taint_labels?: string[] | undefined;
|
|
110
|
+
output_taint_labels?: string[] | undefined;
|
|
111
|
+
memory_read_refs?: string[] | undefined;
|
|
112
|
+
memory_write_refs?: string[] | undefined;
|
|
113
|
+
pre_state_digest?: string | undefined;
|
|
114
|
+
post_state_digest?: string | undefined;
|
|
79
115
|
}>;
|
|
80
116
|
export type ActionEvidence = z.infer<typeof ActionEvidenceSchema>;
|
|
81
117
|
export declare const InputRefSchema: z.ZodObject<{
|
|
@@ -247,8 +283,31 @@ export declare const BudgetLedgerSchema: z.ZodObject<{
|
|
|
247
283
|
} | undefined;
|
|
248
284
|
}>;
|
|
249
285
|
export type BudgetLedger = z.infer<typeof BudgetLedgerSchema>;
|
|
286
|
+
export declare const RunContextSchema: z.ZodObject<{
|
|
287
|
+
agent_id: z.ZodOptional<z.ZodString>;
|
|
288
|
+
agent_version: z.ZodOptional<z.ZodString>;
|
|
289
|
+
subagent_id: z.ZodOptional<z.ZodString>;
|
|
290
|
+
delegation_chain: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
291
|
+
environment_digest: z.ZodOptional<z.ZodString>;
|
|
292
|
+
dependency_lock_digest: z.ZodOptional<z.ZodString>;
|
|
293
|
+
}, "strip", z.ZodTypeAny, {
|
|
294
|
+
delegation_chain: string[];
|
|
295
|
+
agent_id?: string | undefined;
|
|
296
|
+
agent_version?: string | undefined;
|
|
297
|
+
subagent_id?: string | undefined;
|
|
298
|
+
environment_digest?: string | undefined;
|
|
299
|
+
dependency_lock_digest?: string | undefined;
|
|
300
|
+
}, {
|
|
301
|
+
agent_id?: string | undefined;
|
|
302
|
+
agent_version?: string | undefined;
|
|
303
|
+
subagent_id?: string | undefined;
|
|
304
|
+
delegation_chain?: string[] | undefined;
|
|
305
|
+
environment_digest?: string | undefined;
|
|
306
|
+
dependency_lock_digest?: string | undefined;
|
|
307
|
+
}>;
|
|
308
|
+
export type RunContext = z.infer<typeof RunContextSchema>;
|
|
250
309
|
export declare const AEPRecordSchema: z.ZodObject<{
|
|
251
|
-
schema_version: z.
|
|
310
|
+
schema_version: z.ZodEnum<["aep/v0.1", "aep/v0.2"]>;
|
|
252
311
|
run_id: z.ZodString;
|
|
253
312
|
trace_id: z.ZodOptional<z.ZodString>;
|
|
254
313
|
parent_trace_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -331,6 +390,18 @@ export declare const AEPRecordSchema: z.ZodObject<{
|
|
|
331
390
|
reason_code?: string | undefined;
|
|
332
391
|
}>>;
|
|
333
392
|
timestamp_ms: z.ZodNumber;
|
|
393
|
+
parent_action_id: z.ZodOptional<z.ZodString>;
|
|
394
|
+
causal_chain_id: z.ZodOptional<z.ZodString>;
|
|
395
|
+
tool_descriptor_digest: z.ZodOptional<z.ZodString>;
|
|
396
|
+
server_card_digest: z.ZodOptional<z.ZodString>;
|
|
397
|
+
scope_lease_id: z.ZodOptional<z.ZodString>;
|
|
398
|
+
approval_context_hash: z.ZodOptional<z.ZodString>;
|
|
399
|
+
input_taint_labels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
400
|
+
output_taint_labels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
401
|
+
memory_read_refs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
402
|
+
memory_write_refs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
403
|
+
pre_state_digest: z.ZodOptional<z.ZodString>;
|
|
404
|
+
post_state_digest: z.ZodOptional<z.ZodString>;
|
|
334
405
|
}, "strip", z.ZodTypeAny, {
|
|
335
406
|
action_id: string;
|
|
336
407
|
tool_name: string;
|
|
@@ -346,6 +417,18 @@ export declare const AEPRecordSchema: z.ZodObject<{
|
|
|
346
417
|
decision: "allow" | "deny" | "ask_user" | "dry_run";
|
|
347
418
|
reason_code?: string | undefined;
|
|
348
419
|
} | undefined;
|
|
420
|
+
parent_action_id?: string | undefined;
|
|
421
|
+
causal_chain_id?: string | undefined;
|
|
422
|
+
tool_descriptor_digest?: string | undefined;
|
|
423
|
+
server_card_digest?: string | undefined;
|
|
424
|
+
scope_lease_id?: string | undefined;
|
|
425
|
+
approval_context_hash?: string | undefined;
|
|
426
|
+
input_taint_labels?: string[] | undefined;
|
|
427
|
+
output_taint_labels?: string[] | undefined;
|
|
428
|
+
memory_read_refs?: string[] | undefined;
|
|
429
|
+
memory_write_refs?: string[] | undefined;
|
|
430
|
+
pre_state_digest?: string | undefined;
|
|
431
|
+
post_state_digest?: string | undefined;
|
|
349
432
|
}, {
|
|
350
433
|
action_id: string;
|
|
351
434
|
tool_name: string;
|
|
@@ -361,6 +444,18 @@ export declare const AEPRecordSchema: z.ZodObject<{
|
|
|
361
444
|
decision: "allow" | "deny" | "ask_user" | "dry_run";
|
|
362
445
|
reason_code?: string | undefined;
|
|
363
446
|
} | undefined;
|
|
447
|
+
parent_action_id?: string | undefined;
|
|
448
|
+
causal_chain_id?: string | undefined;
|
|
449
|
+
tool_descriptor_digest?: string | undefined;
|
|
450
|
+
server_card_digest?: string | undefined;
|
|
451
|
+
scope_lease_id?: string | undefined;
|
|
452
|
+
approval_context_hash?: string | undefined;
|
|
453
|
+
input_taint_labels?: string[] | undefined;
|
|
454
|
+
output_taint_labels?: string[] | undefined;
|
|
455
|
+
memory_read_refs?: string[] | undefined;
|
|
456
|
+
memory_write_refs?: string[] | undefined;
|
|
457
|
+
pre_state_digest?: string | undefined;
|
|
458
|
+
post_state_digest?: string | undefined;
|
|
364
459
|
}>, "many">>;
|
|
365
460
|
verifier_results: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
366
461
|
verifier_id: z.ZodString;
|
|
@@ -491,21 +586,43 @@ export declare const AEPRecordSchema: z.ZodObject<{
|
|
|
491
586
|
} | undefined;
|
|
492
587
|
}>>;
|
|
493
588
|
created_at_ms: z.ZodNumber;
|
|
494
|
-
|
|
495
|
-
|
|
589
|
+
run_context: z.ZodOptional<z.ZodObject<{
|
|
590
|
+
agent_id: z.ZodOptional<z.ZodString>;
|
|
591
|
+
agent_version: z.ZodOptional<z.ZodString>;
|
|
592
|
+
subagent_id: z.ZodOptional<z.ZodString>;
|
|
593
|
+
delegation_chain: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
594
|
+
environment_digest: z.ZodOptional<z.ZodString>;
|
|
595
|
+
dependency_lock_digest: z.ZodOptional<z.ZodString>;
|
|
596
|
+
}, "strip", z.ZodTypeAny, {
|
|
597
|
+
delegation_chain: string[];
|
|
598
|
+
agent_id?: string | undefined;
|
|
599
|
+
agent_version?: string | undefined;
|
|
600
|
+
subagent_id?: string | undefined;
|
|
601
|
+
environment_digest?: string | undefined;
|
|
602
|
+
dependency_lock_digest?: string | undefined;
|
|
603
|
+
}, {
|
|
604
|
+
agent_id?: string | undefined;
|
|
605
|
+
agent_version?: string | undefined;
|
|
606
|
+
subagent_id?: string | undefined;
|
|
607
|
+
delegation_chain?: string[] | undefined;
|
|
608
|
+
environment_digest?: string | undefined;
|
|
609
|
+
dependency_lock_digest?: string | undefined;
|
|
610
|
+
}>>;
|
|
611
|
+
signature: z.ZodObject<{
|
|
612
|
+
alg: z.ZodLiteral<"ed25519">;
|
|
496
613
|
key_id: z.ZodString;
|
|
497
614
|
sig: z.ZodString;
|
|
498
615
|
}, "strip", z.ZodTypeAny, {
|
|
499
|
-
alg:
|
|
616
|
+
alg: "ed25519";
|
|
500
617
|
key_id: string;
|
|
501
618
|
sig: string;
|
|
502
619
|
}, {
|
|
503
|
-
alg:
|
|
620
|
+
alg: "ed25519";
|
|
504
621
|
key_id: string;
|
|
505
622
|
sig: string;
|
|
506
|
-
}
|
|
623
|
+
}>;
|
|
507
624
|
}, "strip", z.ZodTypeAny, {
|
|
508
|
-
schema_version: "aep/v0.1";
|
|
625
|
+
schema_version: "aep/v0.1" | "aep/v0.2";
|
|
509
626
|
run_id: string;
|
|
510
627
|
input_refs: {
|
|
511
628
|
uri: string;
|
|
@@ -539,6 +656,18 @@ export declare const AEPRecordSchema: z.ZodObject<{
|
|
|
539
656
|
decision: "allow" | "deny" | "ask_user" | "dry_run";
|
|
540
657
|
reason_code?: string | undefined;
|
|
541
658
|
} | undefined;
|
|
659
|
+
parent_action_id?: string | undefined;
|
|
660
|
+
causal_chain_id?: string | undefined;
|
|
661
|
+
tool_descriptor_digest?: string | undefined;
|
|
662
|
+
server_card_digest?: string | undefined;
|
|
663
|
+
scope_lease_id?: string | undefined;
|
|
664
|
+
approval_context_hash?: string | undefined;
|
|
665
|
+
input_taint_labels?: string[] | undefined;
|
|
666
|
+
output_taint_labels?: string[] | undefined;
|
|
667
|
+
memory_read_refs?: string[] | undefined;
|
|
668
|
+
memory_write_refs?: string[] | undefined;
|
|
669
|
+
pre_state_digest?: string | undefined;
|
|
670
|
+
post_state_digest?: string | undefined;
|
|
542
671
|
}[];
|
|
543
672
|
verifier_results: {
|
|
544
673
|
verifier_id: string;
|
|
@@ -547,6 +676,11 @@ export declare const AEPRecordSchema: z.ZodObject<{
|
|
|
547
676
|
score?: number | undefined;
|
|
548
677
|
}[];
|
|
549
678
|
created_at_ms: number;
|
|
679
|
+
signature: {
|
|
680
|
+
alg: "ed25519";
|
|
681
|
+
key_id: string;
|
|
682
|
+
sig: string;
|
|
683
|
+
};
|
|
550
684
|
trace_id?: string | undefined;
|
|
551
685
|
parent_trace_id?: string | null | undefined;
|
|
552
686
|
repo_commit?: string | undefined;
|
|
@@ -582,15 +716,23 @@ export declare const AEPRecordSchema: z.ZodObject<{
|
|
|
582
716
|
limit?: number | undefined;
|
|
583
717
|
} | undefined;
|
|
584
718
|
} | undefined;
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
719
|
+
run_context?: {
|
|
720
|
+
delegation_chain: string[];
|
|
721
|
+
agent_id?: string | undefined;
|
|
722
|
+
agent_version?: string | undefined;
|
|
723
|
+
subagent_id?: string | undefined;
|
|
724
|
+
environment_digest?: string | undefined;
|
|
725
|
+
dependency_lock_digest?: string | undefined;
|
|
589
726
|
} | undefined;
|
|
590
727
|
}, {
|
|
591
|
-
schema_version: "aep/v0.1";
|
|
728
|
+
schema_version: "aep/v0.1" | "aep/v0.2";
|
|
592
729
|
run_id: string;
|
|
593
730
|
created_at_ms: number;
|
|
731
|
+
signature: {
|
|
732
|
+
alg: "ed25519";
|
|
733
|
+
key_id: string;
|
|
734
|
+
sig: string;
|
|
735
|
+
};
|
|
594
736
|
trace_id?: string | undefined;
|
|
595
737
|
parent_trace_id?: string | null | undefined;
|
|
596
738
|
repo_commit?: string | undefined;
|
|
@@ -632,6 +774,18 @@ export declare const AEPRecordSchema: z.ZodObject<{
|
|
|
632
774
|
decision: "allow" | "deny" | "ask_user" | "dry_run";
|
|
633
775
|
reason_code?: string | undefined;
|
|
634
776
|
} | undefined;
|
|
777
|
+
parent_action_id?: string | undefined;
|
|
778
|
+
causal_chain_id?: string | undefined;
|
|
779
|
+
tool_descriptor_digest?: string | undefined;
|
|
780
|
+
server_card_digest?: string | undefined;
|
|
781
|
+
scope_lease_id?: string | undefined;
|
|
782
|
+
approval_context_hash?: string | undefined;
|
|
783
|
+
input_taint_labels?: string[] | undefined;
|
|
784
|
+
output_taint_labels?: string[] | undefined;
|
|
785
|
+
memory_read_refs?: string[] | undefined;
|
|
786
|
+
memory_write_refs?: string[] | undefined;
|
|
787
|
+
pre_state_digest?: string | undefined;
|
|
788
|
+
post_state_digest?: string | undefined;
|
|
635
789
|
}[] | undefined;
|
|
636
790
|
verifier_results?: {
|
|
637
791
|
verifier_id: string;
|
|
@@ -665,10 +819,13 @@ export declare const AEPRecordSchema: z.ZodObject<{
|
|
|
665
819
|
limit?: number | undefined;
|
|
666
820
|
} | undefined;
|
|
667
821
|
} | undefined;
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
822
|
+
run_context?: {
|
|
823
|
+
agent_id?: string | undefined;
|
|
824
|
+
agent_version?: string | undefined;
|
|
825
|
+
subagent_id?: string | undefined;
|
|
826
|
+
delegation_chain?: string[] | undefined;
|
|
827
|
+
environment_digest?: string | undefined;
|
|
828
|
+
dependency_lock_digest?: string | undefined;
|
|
672
829
|
} | undefined;
|
|
673
830
|
}>;
|
|
674
831
|
export type AEPRecord = z.infer<typeof AEPRecordSchema>;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;EAMnC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CA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;;;;;;EAO7B,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAG9D,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;EAO3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAG1D,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyB1B,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
|
package/dist/types.js
CHANGED
|
@@ -17,6 +17,24 @@ export const ActionEvidenceSchema = z.object({
|
|
|
17
17
|
evidence_refs: z.array(z.string()).default([]),
|
|
18
18
|
capability_decision: CapabilityDecisionSchema.optional(),
|
|
19
19
|
timestamp_ms: z.number(),
|
|
20
|
+
// v0.2 causal chain fields
|
|
21
|
+
parent_action_id: z.string().optional(),
|
|
22
|
+
causal_chain_id: z.string().optional(),
|
|
23
|
+
// v0.2 tool/server provenance
|
|
24
|
+
tool_descriptor_digest: z.string().optional(),
|
|
25
|
+
server_card_digest: z.string().optional(),
|
|
26
|
+
// v0.2 scope & approval
|
|
27
|
+
scope_lease_id: z.string().optional(),
|
|
28
|
+
approval_context_hash: z.string().optional(),
|
|
29
|
+
// v0.2 taint tracking
|
|
30
|
+
input_taint_labels: z.array(z.string()).optional(),
|
|
31
|
+
output_taint_labels: z.array(z.string()).optional(),
|
|
32
|
+
// v0.2 memory provenance
|
|
33
|
+
memory_read_refs: z.array(z.string()).optional(),
|
|
34
|
+
memory_write_refs: z.array(z.string()).optional(),
|
|
35
|
+
// v0.2 state digests
|
|
36
|
+
pre_state_digest: z.string().optional(),
|
|
37
|
+
post_state_digest: z.string().optional(),
|
|
20
38
|
});
|
|
21
39
|
// InputRef / OutputRef — digested references to inputs and outputs
|
|
22
40
|
export const InputRefSchema = z.object({
|
|
@@ -50,9 +68,18 @@ export const BudgetLedgerSchema = z.object({
|
|
|
50
68
|
retry_budget: BudgetEntrySchema.optional(),
|
|
51
69
|
human_approval_budget: BudgetEntrySchema.optional(),
|
|
52
70
|
});
|
|
71
|
+
// RunContext — execution environment and delegation metadata (v0.2)
|
|
72
|
+
export const RunContextSchema = z.object({
|
|
73
|
+
agent_id: z.string().optional(),
|
|
74
|
+
agent_version: z.string().optional(),
|
|
75
|
+
subagent_id: z.string().optional(),
|
|
76
|
+
delegation_chain: z.array(z.string()).default([]),
|
|
77
|
+
environment_digest: z.string().optional(),
|
|
78
|
+
dependency_lock_digest: z.string().optional(),
|
|
79
|
+
});
|
|
53
80
|
// AEPRecord — the top-level Agent Evidence Protocol record
|
|
54
81
|
export const AEPRecordSchema = z.object({
|
|
55
|
-
schema_version: z.
|
|
82
|
+
schema_version: z.enum(["aep/v0.1", "aep/v0.2"]),
|
|
56
83
|
run_id: z.string(),
|
|
57
84
|
trace_id: z.string().optional(),
|
|
58
85
|
parent_trace_id: z.string().nullish(),
|
|
@@ -70,12 +97,11 @@ export const AEPRecordSchema = z.object({
|
|
|
70
97
|
verifier_results: z.array(VerifierResultSchema).default([]),
|
|
71
98
|
budget_ledger: BudgetLedgerSchema.optional(),
|
|
72
99
|
created_at_ms: z.number(),
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
alg: z.
|
|
100
|
+
run_context: RunContextSchema.optional(),
|
|
101
|
+
signature: z.object({
|
|
102
|
+
alg: z.literal("ed25519"),
|
|
76
103
|
key_id: z.string(),
|
|
77
104
|
sig: z.string(),
|
|
78
|
-
})
|
|
79
|
-
.optional(),
|
|
105
|
+
}),
|
|
80
106
|
});
|
|
81
107
|
//# sourceMappingURL=types.js.map
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,qEAAqE;AACrE,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;IAC1D,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACnC,CAAC,CAAC;AAGH,iEAAiE;AACjE,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,cAAc,EAAE,CAAC,CAAC,OAAO,EAAE;IAC3B,mBAAmB,EAAE,CAAC,CAAC,MAAM,E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. Strip the `signature` field to reconstruct the unsigned payload.
|
|
7
|
+
* 2. Re-compute the canonical bytes the signer would have signed.
|
|
8
|
+
* 3. Base64-decode the `sig` field and verify against the provided public key.
|
|
9
|
+
*
|
|
10
|
+
* @param record - A complete AEPRecord (including `signature`).
|
|
11
|
+
* @param publicKey - 32-byte Ed25519 public key matching the `key_id` in the record.
|
|
12
|
+
* @returns `true` if the signature is valid and covers the current record contents.
|
|
13
|
+
*/
|
|
14
|
+
export declare function verifyAEPRecord(record: AEPRecord, publicKey: Uint8Array): Promise<boolean>;
|
|
15
|
+
//# sourceMappingURL=verify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../src/verify.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;;;;;;;;GAWG;AACH,wBAAsB,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CAWhG"}
|
package/dist/verify.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as ed from "@noble/ed25519";
|
|
2
|
+
import { canonicalBytes } from "./canonical.js";
|
|
3
|
+
/**
|
|
4
|
+
* verifyAEPRecord — verify the ed25519 signature on an AEPRecord.
|
|
5
|
+
*
|
|
6
|
+
* Steps:
|
|
7
|
+
* 1. Strip the `signature` field to reconstruct the unsigned payload.
|
|
8
|
+
* 2. Re-compute the canonical bytes the signer would have signed.
|
|
9
|
+
* 3. Base64-decode the `sig` field and verify against the provided public key.
|
|
10
|
+
*
|
|
11
|
+
* @param record - A complete AEPRecord (including `signature`).
|
|
12
|
+
* @param publicKey - 32-byte Ed25519 public key matching the `key_id` in the record.
|
|
13
|
+
* @returns `true` if the signature is valid and covers the current record contents.
|
|
14
|
+
*/
|
|
15
|
+
export async function verifyAEPRecord(record, publicKey) {
|
|
16
|
+
try {
|
|
17
|
+
const { signature, ...unsigned } = record;
|
|
18
|
+
if (!signature)
|
|
19
|
+
return false;
|
|
20
|
+
const bytes = canonicalBytes(unsigned);
|
|
21
|
+
const sigBytes = Uint8Array.from(Buffer.from(signature.sig, "base64"));
|
|
22
|
+
return await ed.verifyAsync(sigBytes, bytes, publicKey);
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=verify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify.js","sourceRoot":"","sources":["../src/verify.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,MAAiB,EAAE,SAAqB;IAC5E,IAAI,CAAC;QACH,MAAM,EAAE,SAAS,EAAE,GAAG,QAAQ,EAAE,GAAG,MAAM,CAAC;QAC1C,IAAI,CAAC,SAAS;YAAE,OAAO,KAAK,CAAC;QAE7B,MAAM,KAAK,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;QACvC,MAAM,QAAQ,GAAG,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC;QACvE,OAAO,MAAM,EAAE,CAAC,WAAW,CAAC,QAAQ,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;IAC1D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wasmagent/aep",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Agent Evidence Protocol — runtime action evidence and run provenance types for WasmAgent",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"clean": "rm -rf dist .turbo"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
+
"@noble/ed25519": "^3.1.0",
|
|
21
22
|
"zod": "^3.23.0"
|
|
22
23
|
},
|
|
23
24
|
"devDependencies": {
|
|
@@ -36,7 +37,7 @@
|
|
|
36
37
|
],
|
|
37
38
|
"wasmagent": {
|
|
38
39
|
"tier": "tier-1",
|
|
39
|
-
"stability": "
|
|
40
|
+
"stability": "beta"
|
|
40
41
|
},
|
|
41
42
|
"homepage": "https://github.com/WasmAgent/wasmagent-js/tree/main/packages/aep#readme",
|
|
42
43
|
"license": "Apache-2.0",
|