@zanii/core 0.3.0 → 0.4.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/README.md +73 -72
- package/dist/receipt.d.ts +5 -0
- package/dist/receipt.d.ts.map +1 -1
- package/dist/receipt.js +1 -0
- package/dist/receipt.js.map +1 -1
- package/package.json +1 -1
- package/src/receipt.ts +6 -0
package/README.md
CHANGED
|
@@ -1,72 +1,73 @@
|
|
|
1
|
-
# @zanii/core
|
|
2
|
-
|
|
3
|
-
The Zanii protocol as pure functions — **no I/O, no network, no trusted party.**
|
|
4
|
-
Agent identities (`did:key`), scoped delegation certificates, signed action
|
|
5
|
-
receipts, RFC 6962 Merkle transparency-log proofs, and self-contained audit
|
|
6
|
-
bundles. Everything here is deterministic; use it to build proofs, or to
|
|
7
|
-
**verify** them independently of any Zanii server.
|
|
8
|
-
|
|
9
|
-
If you want to instrument a live agent (batching, HTTP ingest, tool wrapping),
|
|
10
|
-
use [`@zanii/sdk`](https://www.npmjs.com/package/@zanii/sdk), which builds on
|
|
11
|
-
this.
|
|
12
|
-
|
|
13
|
-
```sh
|
|
14
|
-
npm install @zanii/core
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## Verify a receipt, offline
|
|
18
|
-
|
|
19
|
-
```ts
|
|
20
|
-
import {
|
|
21
|
-
generateKeypair,
|
|
22
|
-
createCert,
|
|
23
|
-
createReceipt,
|
|
24
|
-
hashPayload,
|
|
25
|
-
verifyReceipt,
|
|
26
|
-
} from '@zanii/core';
|
|
27
|
-
|
|
28
|
-
const owner = generateKeypair();
|
|
29
|
-
const agent = generateKeypair();
|
|
30
|
-
const cert = createCert(
|
|
31
|
-
{ issuer: owner.did, subject: agent.did, scopes: ['crm.*'], exp: '2027-01-01T00:00:00Z' },
|
|
32
|
-
owner.privateKey,
|
|
33
|
-
);
|
|
34
|
-
const receipt = createReceipt(
|
|
35
|
-
{
|
|
36
|
-
agentId: agent.did,
|
|
37
|
-
delegation: [cert],
|
|
38
|
-
action: 'tool_call',
|
|
39
|
-
target: 'crm.lookup',
|
|
40
|
-
payloadHash: hashPayload(JSON.stringify({ email: 'a@b.co' })),
|
|
41
|
-
ts: new Date().toISOString(),
|
|
42
|
-
prev: null,
|
|
43
|
-
},
|
|
44
|
-
agent.privateKey,
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
// Checks the signature, the delegation chain, and that the action is in scope —
|
|
48
|
-
// with no server and no trust.
|
|
49
|
-
const result = verifyReceipt(receipt);
|
|
50
|
-
if (!result.ok) throw new Error(result.error);
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
`verifyAuditBundle(bundle)` does the same for a complete exported history at
|
|
54
|
-
once: every receipt's signature and Merkle inclusion, the per-agent hash chain,
|
|
55
|
-
revocations, and on-chain anchor consistency.
|
|
56
|
-
|
|
57
|
-
## Links
|
|
58
|
-
|
|
59
|
-
- **Docs & concepts** — https://ledger.zanii.agency/docs
|
|
60
|
-
- **Live transparency log** — https://ledger.zanii.agency
|
|
61
|
-
|
|
62
|
-
## Changelog
|
|
63
|
-
|
|
64
|
-
- **0.
|
|
65
|
-
- **0.
|
|
66
|
-
- **0.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
1
|
+
# @zanii/core
|
|
2
|
+
|
|
3
|
+
The Zanii protocol as pure functions — **no I/O, no network, no trusted party.**
|
|
4
|
+
Agent identities (`did:key`), scoped delegation certificates, signed action
|
|
5
|
+
receipts, RFC 6962 Merkle transparency-log proofs, and self-contained audit
|
|
6
|
+
bundles. Everything here is deterministic; use it to build proofs, or to
|
|
7
|
+
**verify** them independently of any Zanii server.
|
|
8
|
+
|
|
9
|
+
If you want to instrument a live agent (batching, HTTP ingest, tool wrapping),
|
|
10
|
+
use [`@zanii/sdk`](https://www.npmjs.com/package/@zanii/sdk), which builds on
|
|
11
|
+
this.
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
npm install @zanii/core
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Verify a receipt, offline
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import {
|
|
21
|
+
generateKeypair,
|
|
22
|
+
createCert,
|
|
23
|
+
createReceipt,
|
|
24
|
+
hashPayload,
|
|
25
|
+
verifyReceipt,
|
|
26
|
+
} from '@zanii/core';
|
|
27
|
+
|
|
28
|
+
const owner = generateKeypair();
|
|
29
|
+
const agent = generateKeypair();
|
|
30
|
+
const cert = createCert(
|
|
31
|
+
{ issuer: owner.did, subject: agent.did, scopes: ['crm.*'], exp: '2027-01-01T00:00:00Z' },
|
|
32
|
+
owner.privateKey,
|
|
33
|
+
);
|
|
34
|
+
const receipt = createReceipt(
|
|
35
|
+
{
|
|
36
|
+
agentId: agent.did,
|
|
37
|
+
delegation: [cert],
|
|
38
|
+
action: 'tool_call',
|
|
39
|
+
target: 'crm.lookup',
|
|
40
|
+
payloadHash: hashPayload(JSON.stringify({ email: 'a@b.co' })),
|
|
41
|
+
ts: new Date().toISOString(),
|
|
42
|
+
prev: null,
|
|
43
|
+
},
|
|
44
|
+
agent.privateKey,
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
// Checks the signature, the delegation chain, and that the action is in scope —
|
|
48
|
+
// with no server and no trust.
|
|
49
|
+
const result = verifyReceipt(receipt);
|
|
50
|
+
if (!result.ok) throw new Error(result.error);
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
`verifyAuditBundle(bundle)` does the same for a complete exported history at
|
|
54
|
+
once: every receipt's signature and Merkle inclusion, the per-agent hash chain,
|
|
55
|
+
revocations, and on-chain anchor consistency.
|
|
56
|
+
|
|
57
|
+
## Links
|
|
58
|
+
|
|
59
|
+
- **Docs & concepts** — https://ledger.zanii.agency/docs
|
|
60
|
+
- **Live transparency log** — https://ledger.zanii.agency
|
|
61
|
+
|
|
62
|
+
## Changelog
|
|
63
|
+
|
|
64
|
+
- **0.4.0** — optional signature-covered `subject_tag` receipt field (per-subject auditability, `@zanii/subject`).
|
|
65
|
+
- **0.3.0** — `saltedPayloadHash`/`verifyPayload`, `createConfirmation`/`verifyConfirmation`, `createCoSignature`/`verifyCoSignature`, and optional receipt provenance fields (`runtime_hash`/`model_id`/`manifest_hash`).
|
|
66
|
+
- **0.2.0** — version bump in lockstep with the package family (no API changes).
|
|
67
|
+
- **0.1.0** — initial release: `did:key` identity, scoped/expiring delegation, signed
|
|
68
|
+
hash-chained receipts, RFC 6962 Merkle inclusion + consistency proofs, signed tree
|
|
69
|
+
heads, audit-bundle verification, and cross-org (A2A) receipts.
|
|
70
|
+
|
|
71
|
+
## License
|
|
72
|
+
|
|
73
|
+
Apache-2.0.
|
package/dist/receipt.d.ts
CHANGED
|
@@ -13,6 +13,9 @@ export interface Receipt {
|
|
|
13
13
|
model_id?: string;
|
|
14
14
|
/** Hash of the product's tool/scope manifest that governed this action. */
|
|
15
15
|
manifest_hash?: string;
|
|
16
|
+
/** Optional pseudonymous data-subject tag (SPEC §3) — lets the end user the action was
|
|
17
|
+
* about find + audit their own slice (`@zanii/subject`). Covered by the signature. */
|
|
18
|
+
subject_tag?: string;
|
|
16
19
|
sig: string;
|
|
17
20
|
}
|
|
18
21
|
export interface VerifyResult {
|
|
@@ -46,6 +49,8 @@ export declare function createReceipt(fields: {
|
|
|
46
49
|
runtimeHash?: string;
|
|
47
50
|
modelId?: string;
|
|
48
51
|
manifestHash?: string;
|
|
52
|
+
/** Optional pseudonymous data-subject tag — per-subject auditability (`@zanii/subject`). */
|
|
53
|
+
subjectTag?: string;
|
|
49
54
|
}, agentPrivateKey: Uint8Array): Receipt;
|
|
50
55
|
/** Hash of the full receipt (incl. sig) — what the next receipt's `prev` points to. */
|
|
51
56
|
export declare function receiptHash(receipt: Receipt): string;
|
package/dist/receipt.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"receipt.d.ts","sourceRoot":"","sources":["../src/receipt.ts"],"names":[],"mappings":"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@ export function createReceipt(fields, agentPrivateKey) {
|
|
|
49
49
|
...(fields.runtimeHash ? { runtime_hash: fields.runtimeHash } : {}),
|
|
50
50
|
...(fields.modelId ? { model_id: fields.modelId } : {}),
|
|
51
51
|
...(fields.manifestHash ? { manifest_hash: fields.manifestHash } : {}),
|
|
52
|
+
...(fields.subjectTag ? { subject_tag: fields.subjectTag } : {}),
|
|
52
53
|
};
|
|
53
54
|
const sig = ed25519.sign(canonicalBytes(unsigned), agentPrivateKey);
|
|
54
55
|
return { ...unsigned, sig: encodeSig(sig) };
|
package/dist/receipt.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"receipt.js","sourceRoot":"","sources":["../src/receipt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,WAAW,EAAuB,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"receipt.js","sourceRoot":"","sources":["../src/receipt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AA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EAAE,WAAW,CAAC,KAAK,MAAM,CAAC,KAAK,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE,CAAC;QAC7F,YAAY,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;IAChC,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;AACtB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zanii/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Zanii protocol: verifiable identity, signed action receipts, Merkle transparency-log proofs. Pure, no I/O.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://ledger.zanii.agency",
|
package/src/receipt.ts
CHANGED
|
@@ -19,6 +19,9 @@ export interface Receipt {
|
|
|
19
19
|
model_id?: string;
|
|
20
20
|
/** Hash of the product's tool/scope manifest that governed this action. */
|
|
21
21
|
manifest_hash?: string;
|
|
22
|
+
/** Optional pseudonymous data-subject tag (SPEC §3) — lets the end user the action was
|
|
23
|
+
* about find + audit their own slice (`@zanii/subject`). Covered by the signature. */
|
|
24
|
+
subject_tag?: string;
|
|
22
25
|
sig: string;
|
|
23
26
|
}
|
|
24
27
|
|
|
@@ -75,6 +78,8 @@ export function createReceipt(
|
|
|
75
78
|
runtimeHash?: string;
|
|
76
79
|
modelId?: string;
|
|
77
80
|
manifestHash?: string;
|
|
81
|
+
/** Optional pseudonymous data-subject tag — per-subject auditability (`@zanii/subject`). */
|
|
82
|
+
subjectTag?: string;
|
|
78
83
|
},
|
|
79
84
|
agentPrivateKey: Uint8Array,
|
|
80
85
|
): Receipt {
|
|
@@ -91,6 +96,7 @@ export function createReceipt(
|
|
|
91
96
|
...(fields.runtimeHash ? { runtime_hash: fields.runtimeHash } : {}),
|
|
92
97
|
...(fields.modelId ? { model_id: fields.modelId } : {}),
|
|
93
98
|
...(fields.manifestHash ? { manifest_hash: fields.manifestHash } : {}),
|
|
99
|
+
...(fields.subjectTag ? { subject_tag: fields.subjectTag } : {}),
|
|
94
100
|
};
|
|
95
101
|
const sig = ed25519.sign(canonicalBytes(unsigned), agentPrivateKey);
|
|
96
102
|
return { ...unsigned, sig: encodeSig(sig) };
|