tersign 0.5.0 → 0.6.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/LICENSE +202 -21
- package/NOTICE +4 -0
- package/README.md +22 -9
- package/dist/adapter/x402.d.ts +59 -3
- package/dist/adapter/x402.js +168 -34
- package/dist/assure.d.ts +69 -7
- package/dist/assure.js +74 -16
- package/dist/compliance/record.d.ts +11 -5
- package/dist/compliance/record.js +10 -4
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -2
- package/dist/ledgerClient.d.ts +3 -0
- package/dist/ledgerClient.js +2 -0
- package/dist/mcp/server.d.ts +1 -1
- package/dist/mcp/server.js +8 -8
- package/dist/mcp/tools.d.ts +3 -2
- package/dist/mcp/tools.js +2 -2
- package/dist/receipt/binding.d.ts +4 -1
- package/dist/receipt/binding.js +4 -1
- package/dist/receipt/network.d.ts +31 -0
- package/dist/receipt/network.js +71 -0
- package/dist/types.d.ts +25 -12
- package/dist/types.js +3 -3
- package/package.json +4 -3
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** Wire types for the merged x402 `offer-receipt` extension (spec: x402-foundation/x402
|
|
2
|
-
* specs/extensions/extension-offer-and-receipt.md, fetched 2026-07-07
|
|
3
|
-
*
|
|
4
|
-
* the codec functions, so upstream churn lands here only. */
|
|
2
|
+
* specs/extensions/extension-offer-and-receipt.md, fetched 2026-07-07; receipt payload fields
|
|
3
|
+
* and response placement re-read 2026-09-29 at main 5eee1e3c35). Everything outside this module
|
|
4
|
+
* treats these as opaque via the codec functions, so upstream churn lands here only. */
|
|
5
5
|
export interface ReceiptPayload {
|
|
6
6
|
version: 1;
|
|
7
7
|
/** CAIP-2, e.g. "eip155:8453" */
|
|
@@ -36,9 +36,10 @@ export type SignedArtifact<P> = {
|
|
|
36
36
|
};
|
|
37
37
|
export type SignedReceipt = SignedArtifact<ReceiptPayload>;
|
|
38
38
|
export type SignedOffer = SignedArtifact<OfferPayload>;
|
|
39
|
-
/**
|
|
40
|
-
*
|
|
41
|
-
|
|
39
|
+
/** Adjustment vocabulary as the proposed compliance-fields extension takes it from UCP: `type` is
|
|
40
|
+
* an OPEN string whose typical values are listed here, and only `status` is a fixed enum — so any
|
|
41
|
+
* other `type` string is accepted. */
|
|
42
|
+
export type AdjustmentType = 'refund' | 'return' | 'credit' | 'price_adjustment' | 'dispute' | 'cancellation' | (string & {});
|
|
42
43
|
export type AdjustmentStatus = 'pending' | 'completed' | 'failed';
|
|
43
44
|
export interface Adjustment {
|
|
44
45
|
type: AdjustmentType;
|
|
@@ -50,15 +51,24 @@ export interface Adjustment {
|
|
|
50
51
|
/** digest of the receipt/record this adjusts — the hash-chain link */
|
|
51
52
|
adjusts: `0x${string}`;
|
|
52
53
|
}
|
|
53
|
-
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
54
|
+
/** Compliance record v1 in the shape the `compliance-fields` extension proposes
|
|
55
|
+
* (x402-foundation/x402#2853, open — not settled spec) — a SEPARATE artifact bound to the base
|
|
56
|
+
* receipt by digest. The base receipt's EIP-712 schema is fixed upstream; extending it would
|
|
57
|
+
* break signatures, so compliance data composes by reference. The MINIMAL tier is isomorphic to
|
|
58
|
+
* the EU VAT Art 226b simplified-invoice content; whether a MINIMAL record suffices as an invoice
|
|
59
|
+
* is decided by the invoicing rules that apply to the supply (Art 219a), not by this record.
|
|
60
|
+
* FULL adds EN 16931-aligned fields. */
|
|
57
61
|
export interface ComplianceRecordV1 {
|
|
58
62
|
version: 1;
|
|
63
|
+
/** 1 = RFC 8785 (JCS) serialization, recordDigest = keccak256(utf8(canonical(record))).
|
|
64
|
+
* A MINIMAL member of the proposed extension; `buildMinimalRecord` sets it. Records built by
|
|
65
|
+
* tersign ≤0.5 omit it — readers accept both. */
|
|
66
|
+
canonicalizationVersion?: 1;
|
|
59
67
|
/** keccak256 of the canonicalized base receipt artifact */
|
|
60
68
|
receiptDigest: `0x${string}`;
|
|
61
|
-
/** sequential per issuer (Art 226(2))
|
|
69
|
+
/** sequential number per issuer series (Art 226(2)), assigned by the ISSUER before the record
|
|
70
|
+
* is attested. A sequence attested only by its issuer evidences ordering only — never that no
|
|
71
|
+
* record was omitted. `buildMinimalRecord` does not set it. */
|
|
62
72
|
seq?: number;
|
|
63
73
|
issuedAt: number;
|
|
64
74
|
issuer: {
|
|
@@ -109,7 +119,10 @@ export interface ComplianceRecordV1 {
|
|
|
109
119
|
/** hash-chain to the record this corrects/refunds (Art 226b(e); ViDA corrective-invoice ref) */
|
|
110
120
|
refundOf?: `0x${string}`;
|
|
111
121
|
adjustment?: Adjustment;
|
|
112
|
-
/** retention floor in years;
|
|
122
|
+
/** retention floor in years the issuer commits to; set it to at least the longest period
|
|
123
|
+
* that applies to the issuer (Art 247(1) leaves it to each Member State — e.g. DE § 14b UStG:
|
|
124
|
+
* eight years). 7 is the default where no longer period applies (HK IRO s.51C, MiCA 5+2), not
|
|
125
|
+
* a statement that 7 suffices. */
|
|
113
126
|
retentionYears: number;
|
|
114
127
|
}
|
|
115
128
|
/** EIP-712-signed attestation over a compliance record. The record itself is JSON (schema may
|
package/dist/types.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Wire types for the merged x402 `offer-receipt` extension (spec: x402-foundation/x402
|
|
2
|
-
* specs/extensions/extension-offer-and-receipt.md, fetched 2026-07-07
|
|
3
|
-
*
|
|
4
|
-
* the codec functions, so upstream churn lands here only. */
|
|
2
|
+
* specs/extensions/extension-offer-and-receipt.md, fetched 2026-07-07; receipt payload fields
|
|
3
|
+
* and response placement re-read 2026-09-29 at main 5eee1e3c35). Everything outside this module
|
|
4
|
+
* treats these as opaque via the codec functions, so upstream churn lands here only. */
|
|
5
5
|
export {};
|
package/package.json
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tersign",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
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
|
-
"license": "
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"files": [
|
|
10
10
|
"dist",
|
|
11
11
|
"README.md",
|
|
12
|
-
"LICENSE"
|
|
12
|
+
"LICENSE",
|
|
13
|
+
"NOTICE"
|
|
13
14
|
],
|
|
14
15
|
"scripts": {
|
|
15
16
|
"build": "tsc -p tsconfig.build.json",
|