tersign 0.1.5 → 0.1.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.
package/README.md CHANGED
@@ -104,7 +104,9 @@ The agent skill `tersign-evidence` ships at [tersignhq/skills](https://github.co
104
104
  ## The Live Record
105
105
 
106
106
  - **Ledger + dashboard** — public verify page: https://tersign.ai/verify
107
- - **Census** — 1,500+ hash-chained observations across 1,000+ x402 seller endpoints, probed hourly and autonomously. Live counts: https://prober.tersign.ai/v1/prober/stats
107
+ - **Census** — 2,500+ hash-chained observations across 1,100+ x402 seller endpoints, probed hourly and autonomously. Live counts: https://prober.tersign.ai/v1/prober/stats
108
+ - **Conformance** — RFC 8785 (JCS) canonical serialization, keccak256 digests, byte-level cross-implementation vectors published in-repo. Reproduce the bytes and your implementation is conformant — in any language.
109
+ - **Standards** — the `compliance-fields` extension (optional tax/audit records composing with offer-receipt) is proposed upstream: [x402-foundation/x402#2853](https://github.com/x402-foundation/x402/pull/2853)
108
110
 
109
111
  ## Machine Surfaces
110
112
 
@@ -120,6 +122,8 @@ Full URLs, readable without auth. If you are an agent, start here.
120
122
  | Ledger stats | `GET https://tersign.ai/v1/stats` |
121
123
  | Ledger signer | `GET https://tersign.ai/v1/ledger` |
122
124
  | llms.txt | https://raw.githubusercontent.com/tersignhq/tersign-js/main/llms.txt |
125
+ | Conformance vectors (RFC 8785 + keccak256) | https://github.com/tersignhq/tersign-js/blob/main/test/fixtures/canonical-vectors.json |
126
+ | Sample compliance record + digests | https://github.com/tersignhq/tersign-js/blob/main/test/fixtures/compliance-record.json |
123
127
  | Genesis verify | `npx tersign verify 0xe5874f1ffe87f0a6dd9eb157730f67b86ee4538b125fe30fcc4e165213dd3fc4 --ledger https://tersign.ai` |
124
128
 
125
129
  ---
@@ -1,4 +1,11 @@
1
- /** Deterministic JSON: recursively key-sorted, no whitespace. Arrays keep order.
2
- * undefined properties are dropped (matches JSON.stringify semantics). */
1
+ /** Deterministic JSON RFC 8785 (JCS) conformant for JSON-domain inputs: keys sorted by
2
+ * UTF-16 code units, no whitespace, JSON.stringify scalar/escape semantics. Arrays keep
3
+ * order; undefined properties are dropped (matches JSON.stringify semantics).
4
+ *
5
+ * The string is built directly, never via an object rebuild: JS engines hoist integer-like
6
+ * keys ("1","2","10") into numeric order on insertion, which silently defeats a
7
+ * sort-then-stringify round-trip (JCS orders them "1","10","2"). Byte-identical to the old
8
+ * serializer for every shape without integer-like or control-char keys — the genesis receipt
9
+ * digest and all pinned wire vectors are unchanged. */
3
10
  export declare function canonicalStringify(value: unknown): string;
4
11
  export declare function digestOf(value: unknown): `0x${string}`;
package/dist/canonical.js CHANGED
@@ -1,22 +1,34 @@
1
1
  import { keccak256, toBytes } from 'viem';
2
- /** Deterministic JSON: recursively key-sorted, no whitespace. Arrays keep order.
3
- * undefined properties are dropped (matches JSON.stringify semantics). */
2
+ /** Deterministic JSON RFC 8785 (JCS) conformant for JSON-domain inputs: keys sorted by
3
+ * UTF-16 code units, no whitespace, JSON.stringify scalar/escape semantics. Arrays keep
4
+ * order; undefined properties are dropped (matches JSON.stringify semantics).
5
+ *
6
+ * The string is built directly, never via an object rebuild: JS engines hoist integer-like
7
+ * keys ("1","2","10") into numeric order on insertion, which silently defeats a
8
+ * sort-then-stringify round-trip (JCS orders them "1","10","2"). Byte-identical to the old
9
+ * serializer for every shape without integer-like or control-char keys — the genesis receipt
10
+ * digest and all pinned wire vectors are unchanged. */
4
11
  export function canonicalStringify(value) {
5
- return JSON.stringify(sortValue(value));
12
+ return serialize(value);
6
13
  }
7
- function sortValue(value) {
8
- if (Array.isArray(value))
9
- return value.map(sortValue);
10
- if (value !== null && typeof value === 'object') {
11
- const out = {};
12
- for (const key of Object.keys(value).sort()) {
13
- const v = value[key];
14
- if (v !== undefined)
15
- out[key] = sortValue(v);
14
+ function serialize(value) {
15
+ if (value === null)
16
+ return 'null';
17
+ if (Array.isArray(value)) {
18
+ return '[' + Array.from(value, (v) => serialize(v) ?? 'null').join(',') + ']';
19
+ }
20
+ if (typeof value === 'object') {
21
+ const obj = value;
22
+ const parts = [];
23
+ for (const key of Object.keys(obj).sort()) {
24
+ const s = serialize(obj[key]);
25
+ if (s !== undefined)
26
+ parts.push(JSON.stringify(key) + ':' + s);
16
27
  }
17
- return out;
28
+ return '{' + parts.join(',') + '}';
18
29
  }
19
- return value;
30
+ // string/number/boolean serialize per JCS; undefined/function/symbol yield undefined (dropped)
31
+ return JSON.stringify(value);
20
32
  }
21
33
  export function digestOf(value) {
22
34
  return keccak256(toBytes(canonicalStringify(value)));
@@ -8,6 +8,6 @@ export declare function envDeps(env?: Record<string, string | undefined>): McpDe
8
8
  * every client; mcp.test.ts pins it against package.json so a release bump can't drift it. */
9
9
  export declare const MCP_SERVER_IDENTITY: {
10
10
  readonly name: "tersign";
11
- readonly version: "0.1.5";
11
+ readonly version: "0.1.7";
12
12
  };
13
13
  export declare function buildServer(deps: McpDeps): McpServer;
@@ -45,7 +45,7 @@ function json(value) {
45
45
  }
46
46
  /** MUST match package.json name/version — the MCP handshake self-reports this identity to
47
47
  * every client; mcp.test.ts pins it against package.json so a release bump can't drift it. */
48
- export const MCP_SERVER_IDENTITY = { name: 'tersign', version: '0.1.5' };
48
+ export const MCP_SERVER_IDENTITY = { name: 'tersign', version: '0.1.7' };
49
49
  export function buildServer(deps) {
50
50
  const server = new McpServer(MCP_SERVER_IDENTITY);
51
51
  server.registerTool('issue_receipt', {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tersign",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "Tersign \u2014 the evidence layer for the agent economy. Counter-signed receipts, agent action records, idempotency enforcement, refunds, disputes, and jury-ready evidence envelopes for x402/agent-commerce sellers.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -49,14 +49,20 @@
49
49
  "keywords": [
50
50
  "x402",
51
51
  "agent-economy",
52
+ "agentic-commerce",
52
53
  "evidence",
53
54
  "receipts",
54
55
  "eip-712",
56
+ "rfc-8785",
57
+ "hash-chain",
55
58
  "compliance",
59
+ "eu-ai-act",
60
+ "audit-trail",
56
61
  "disputes",
62
+ "refunds",
63
+ "idempotency",
57
64
  "ai-agents",
58
- "mcp",
59
- "audit-trail"
65
+ "mcp"
60
66
  ],
61
67
  "mcpName": "io.github.tersignhq/evidence"
62
68
  }