@treeship/verify 0.12.0 → 0.13.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/dist/index.d.ts +28 -0
- package/dist/index.js +18 -0
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -103,3 +103,31 @@ export declare function verifyCertificate(target: VerifyTarget, now?: Date | str
|
|
|
103
103
|
* be accepted.
|
|
104
104
|
*/
|
|
105
105
|
export declare function crossVerify(receipt: VerifyTarget, certificate: VerifyTarget, now?: Date | string, trustRoots?: TrustRootsBundle | TrustRootInput[]): Promise<CrossVerifyResult>;
|
|
106
|
+
/** Result of {@link verifyCapability}. Mirrors the WASM JSON output. */
|
|
107
|
+
export interface CapabilityVerifyResult {
|
|
108
|
+
outcome: 'pass' | 'fail' | 'error';
|
|
109
|
+
/** The actor the card claims, e.g. `agent://deployer`. */
|
|
110
|
+
agent?: string;
|
|
111
|
+
/** True iff the card's keyid is its signer AND pinned under AgentCert. */
|
|
112
|
+
key_bound?: boolean;
|
|
113
|
+
declared_tools?: string[];
|
|
114
|
+
in_scope?: number;
|
|
115
|
+
out_of_scope?: number;
|
|
116
|
+
violations?: {
|
|
117
|
+
tool: string;
|
|
118
|
+
}[];
|
|
119
|
+
status?: 'verified' | 'self-asserted' | 'violations';
|
|
120
|
+
error_code?: string;
|
|
121
|
+
message?: string;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Verify an agent_card.v1 capability card in the browser, the same check
|
|
125
|
+
* `treeship verify-capability` runs (shared Rust logic via
|
|
126
|
+
* `treeship_core::capability`). Pass the card envelope and the action
|
|
127
|
+
* envelopes to cross-check; `trustRoots` is required for `key_bound` to be
|
|
128
|
+
* true (otherwise the card is reported self-asserted).
|
|
129
|
+
*
|
|
130
|
+
* Honest contract: this is consistency over the actions you provide, not a
|
|
131
|
+
* completeness guarantee. It cannot prove the agent took no off-card action.
|
|
132
|
+
*/
|
|
133
|
+
export declare function verifyCapability(card: VerifyTarget, actions: VerifyTarget[], trustRoots?: TrustRootsBundle | TrustRootInput[]): Promise<CapabilityVerifyResult>;
|
package/dist/index.js
CHANGED
|
@@ -104,3 +104,21 @@ export async function crossVerify(receipt, certificate, now, trustRoots) {
|
|
|
104
104
|
const wasm = await loadWasm();
|
|
105
105
|
return JSON.parse(wasm.cross_verify(receiptJson, certJson, nowStr, serializeTrustRoots(trustRoots)));
|
|
106
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* Verify an agent_card.v1 capability card in the browser, the same check
|
|
109
|
+
* `treeship verify-capability` runs (shared Rust logic via
|
|
110
|
+
* `treeship_core::capability`). Pass the card envelope and the action
|
|
111
|
+
* envelopes to cross-check; `trustRoots` is required for `key_bound` to be
|
|
112
|
+
* true (otherwise the card is reported self-asserted).
|
|
113
|
+
*
|
|
114
|
+
* Honest contract: this is consistency over the actions you provide, not a
|
|
115
|
+
* completeness guarantee. It cannot prove the agent took no off-card action.
|
|
116
|
+
*/
|
|
117
|
+
export async function verifyCapability(card, actions, trustRoots) {
|
|
118
|
+
const cardJson = await normalizeToJson(card);
|
|
119
|
+
const actionJsons = await Promise.all((actions ?? []).map(normalizeToJson));
|
|
120
|
+
// Each normalized action is a JSON object; assemble them into a JSON array.
|
|
121
|
+
const actionsJson = `[${actionJsons.join(',')}]`;
|
|
122
|
+
const wasm = await loadWasm();
|
|
123
|
+
return JSON.parse(wasm.verify_capability(cardJson, actionsJson, serializeTrustRoots(trustRoots)));
|
|
124
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@treeship/verify",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Zero-dependency cryptographic verification for Treeship receipts and certificates. Runs anywhere WASM runs: Node, browser, Vercel Edge, Cloudflare Workers, AWS Lambda.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"test": "vitest run"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@treeship/core-wasm": "0.
|
|
43
|
+
"@treeship/core-wasm": "0.13.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/node": "^25.5.0",
|