@treeship/verify 0.31.10 → 0.31.12
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 +12 -6
- package/dist/index.d.ts +7 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -32,23 +32,27 @@ if (result.outcome === 'pass') {
|
|
|
32
32
|
}
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
### `verifyCertificate(target, now?)`
|
|
35
|
+
### `verifyCertificate(target, now?, trustRoots?)`
|
|
36
36
|
|
|
37
|
-
Verifies the Ed25519 signature on an Agent Certificate against the public key
|
|
37
|
+
Verifies the Ed25519 signature on an Agent Certificate against a trust root the caller pins via `trustRoots` -- as of the v0.10.3 trust-root audit fix, the certificate's own embedded public key is never trusted on its own; that would make every certificate self-signed. `trustRoots` is required for the signature to be accepted; omit it to get a deliberate fail-closed result for diagnostic UIs. With `now` supplied (Date or RFC 3339 string), also classifies the validity window.
|
|
38
38
|
|
|
39
39
|
```typescript
|
|
40
40
|
import { verifyCertificate } from '@treeship/verify';
|
|
41
41
|
|
|
42
|
-
const result = await verifyCertificate(
|
|
42
|
+
const result = await verifyCertificate(
|
|
43
|
+
'./researcher.agent/certificate.json',
|
|
44
|
+
new Date(),
|
|
45
|
+
trustRootsJson, // e.g. the contents of ~/.treeship/trust_roots.json
|
|
46
|
+
);
|
|
43
47
|
|
|
44
48
|
if (result.outcome === 'pass' && result.validity === 'valid') {
|
|
45
49
|
console.log(`certificate valid for ${result.certificate.agent_name}`);
|
|
46
50
|
}
|
|
47
51
|
```
|
|
48
52
|
|
|
49
|
-
### `crossVerify(receipt, certificate, now?)`
|
|
53
|
+
### `crossVerify(receipt, certificate, now?, trustRoots?)`
|
|
50
54
|
|
|
51
|
-
Answers three questions: do the receipt and certificate reference the same ship, was the certificate valid at `now`, was every tool the session called authorized by the certificate. The `ok` field is the roll-up.
|
|
55
|
+
Answers three questions: do the receipt and certificate reference the same ship, was the certificate valid at `now`, was every tool the session called authorized by the certificate. The `ok` field is the roll-up. Like `verifyCertificate`, the certificate's signature is only accepted against a pinned `trustRoots` set -- omit it for a deliberate fail-closed result.
|
|
52
56
|
|
|
53
57
|
```typescript
|
|
54
58
|
import { crossVerify } from '@treeship/verify';
|
|
@@ -56,6 +60,8 @@ import { crossVerify } from '@treeship/verify';
|
|
|
56
60
|
const result = await crossVerify(
|
|
57
61
|
'https://treeship.dev/receipt/ssn_abc',
|
|
58
62
|
'https://example.com/researcher.agent.json',
|
|
63
|
+
new Date(),
|
|
64
|
+
trustRootsJson,
|
|
59
65
|
);
|
|
60
66
|
|
|
61
67
|
if (result.ok) {
|
|
@@ -166,7 +172,7 @@ renderChecks(result.checks);
|
|
|
166
172
|
## What this package is NOT
|
|
167
173
|
|
|
168
174
|
- **Not an attestation SDK.** For signing artifacts, session management, Hub push/pull, or agent registration, use [`@treeship/sdk`](../sdk-ts/) which shells out to the `treeship` CLI.
|
|
169
|
-
- **Not a trust anchor.**
|
|
175
|
+
- **Not a trust anchor.** `verifyCertificate` checks the embedded Ed25519 signature against a `trustRoots` set the caller pins and passes in -- not against the certificate's own embedded key, which would make every certificate self-signed. Deciding *which* roots to trust, and chaining further to an issuer, is the caller's responsibility.
|
|
170
176
|
- **Not a drop-in for local-chain verification.** Some signature verification needs the original envelope bytes, which a URL-fetched receipt does not carry. Use `treeship verify <artifact-id>` on the CLI for that.
|
|
171
177
|
|
|
172
178
|
## License
|
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ export interface TrustRootInput {
|
|
|
14
14
|
* not offered here. See TrustRootKind in packages/core/src/trust/mod.rs.
|
|
15
15
|
*/
|
|
16
16
|
kind: 'hub_checkpoint' | 'hub_org' | 'cert_issuer' | 'revoker' | 'agent_cert' | 'session_host';
|
|
17
|
+
/** For `agent_cert`: the agent URI this key is pinned as. A card is key-bound only to that agent. */
|
|
18
|
+
agent?: string;
|
|
17
19
|
label?: string;
|
|
18
20
|
added_at?: string;
|
|
19
21
|
}
|
|
@@ -177,8 +179,10 @@ export interface ResolutionBundleInput {
|
|
|
177
179
|
export interface ResolutionVerdict {
|
|
178
180
|
/** Card signature verified against your roots (directly or via the chain). */
|
|
179
181
|
sig_ok: boolean;
|
|
180
|
-
/** Card is key-bound: signer pinned under AgentCert, or chain-certified. */
|
|
182
|
+
/** Card is key-bound: signer pinned under AgentCert as the card's agent, or chain-certified. */
|
|
181
183
|
key_bound: boolean;
|
|
184
|
+
/** Why not key-bound: `key_not_verified` | `not_pinned` | `pin_unscoped` | `pin_scoped_to_other`; null when bound. */
|
|
185
|
+
key_bound_reason?: string | null;
|
|
182
186
|
/** If verified via the certificate chain, the cert artifact that vouched. */
|
|
183
187
|
chain_cert_id: string | null;
|
|
184
188
|
/** An authorized, verifying revocation was found. */
|
|
@@ -220,6 +224,8 @@ export interface PresentationVerdict {
|
|
|
220
224
|
/** Card signature verified against your roots (directly or via the chain). */
|
|
221
225
|
sig_ok: boolean;
|
|
222
226
|
key_bound: boolean;
|
|
227
|
+
/** Why not key-bound: `key_not_verified` | `not_pinned` | `pin_unscoped` | `pin_scoped_to_other`; null when bound. */
|
|
228
|
+
key_bound_reason?: string | null;
|
|
223
229
|
via_chain: boolean;
|
|
224
230
|
revoked: string | null;
|
|
225
231
|
challenge: PresentationChallenge;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@treeship/verify",
|
|
3
|
-
"version": "0.31.
|
|
3
|
+
"version": "0.31.12",
|
|
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,11 +40,11 @@
|
|
|
40
40
|
"test": "vitest run"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@treeship/core-wasm": "0.31.
|
|
43
|
+
"@treeship/core-wasm": "0.31.12"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/node": "^25.5.0",
|
|
47
47
|
"typescript": "^5.7.0",
|
|
48
|
-
"vitest": "^
|
|
48
|
+
"vitest": "^4.1.11"
|
|
49
49
|
}
|
|
50
50
|
}
|