@peac/schema 0.11.2 → 0.11.3

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
@@ -1,6 +1,6 @@
1
1
  # @peac/schema
2
2
 
3
- PEAC Protocol JSON schemas, OpenAPI specs, and TypeScript types
3
+ PEAC protocol schemas: Zod validators, TypeScript types, and pure validation functions. No I/O.
4
4
 
5
5
  ## Installation
6
6
 
@@ -8,9 +8,70 @@ PEAC Protocol JSON schemas, OpenAPI specs, and TypeScript types
8
8
  pnpm add @peac/schema
9
9
  ```
10
10
 
11
- ## Documentation
11
+ ## What It Does
12
12
 
13
- See [peacprotocol.org](https://www.peacprotocol.org) for full documentation.
13
+ `@peac/schema` is Layer 1 of the PEAC stack. It provides Zod schemas for all PEAC receipt types, validation functions, and utility functions like `computeReceiptRef()`. It contains only schemas and pure functions: no I/O, no network calls, no side effects.
14
+
15
+ ## How Do I Validate a Receipt?
16
+
17
+ ```typescript
18
+ import { parseReceiptClaims } from '@peac/schema';
19
+
20
+ const result = parseReceiptClaims(decodedPayload);
21
+
22
+ if (result.ok) {
23
+ console.log(result.variant); // 'commerce' or 'attestation'
24
+ console.log(result.claims.iss); // validated issuer
25
+ }
26
+ ```
27
+
28
+ ## How Do I Compute a Receipt Reference?
29
+
30
+ ```typescript
31
+ import { computeReceiptRef } from '@peac/schema';
32
+
33
+ const ref = await computeReceiptRef(jws);
34
+ // 'sha256:a1b2c3...' (content-addressed, deterministic)
35
+ ```
36
+
37
+ ## How Do I Validate Evidence Before Signing?
38
+
39
+ ```typescript
40
+ import { assertJsonSafeIterative } from '@peac/schema';
41
+
42
+ const result = assertJsonSafeIterative(evidence);
43
+ if (!result.safe) {
44
+ throw new Error(result.violations.join(', '));
45
+ }
46
+ ```
47
+
48
+ ## How Do I Validate an Evidence Carrier?
49
+
50
+ ```typescript
51
+ import { validateCarrierConstraints, CARRIER_TRANSPORT_LIMITS } from '@peac/schema';
52
+ import type { PeacEvidenceCarrier, CarrierMeta } from '@peac/kernel';
53
+
54
+ const carrier: PeacEvidenceCarrier = {
55
+ receipt_jws: jws,
56
+ receipt_ref: ref,
57
+ };
58
+
59
+ const meta: CarrierMeta = {
60
+ transport: 'mcp',
61
+ format: 'embed',
62
+ max_size: CARRIER_TRANSPORT_LIMITS.mcp,
63
+ };
64
+
65
+ const result = validateCarrierConstraints(carrier, meta);
66
+ // result.valid: boolean, result.violations: string[]
67
+ ```
68
+
69
+ ## Integrates With
70
+
71
+ - `@peac/kernel` (Layer 0): Types that schemas validate
72
+ - `@peac/protocol` (Layer 3): Uses schemas for issuance and verification
73
+ - `@peac/mappings-*` (Layer 4): Transport-specific carrier validation
74
+ - All packages that handle receipt data
14
75
 
15
76
  ## License
16
77
 
@@ -0,0 +1,148 @@
1
+ /**
2
+ * ActorBinding and MVIS (Minimum Viable Identity Set) Schemas (v0.11.3+)
3
+ *
4
+ * Implements DD-142 (ActorBinding), DD-143 (Multi-Root Proof Types),
5
+ * and DD-144 (MVIS) for the Agent Identity Profile.
6
+ *
7
+ * ActorBinding lives in ext["org.peacprotocol/actor_binding"] in Wire 0.1.
8
+ * ProofTypeSchema is SEPARATE from ProofMethodSchema (agent-identity.ts)
9
+ * to avoid breaking the v0.9.25+ API. Unification deferred to v0.12.0.
10
+ *
11
+ * @see docs/specs/AGENT-IDENTITY-PROFILE.md for normative specification
12
+ */
13
+ import { z } from 'zod';
14
+ /**
15
+ * Proof types for ActorBinding (DD-143).
16
+ *
17
+ * 8 methods covering attestation chains, RATS, keyless signing,
18
+ * decentralized identity, workload identity, PKI, and vendor-defined.
19
+ *
20
+ * SEPARATE from ProofMethodSchema (4 transport-level methods in agent-identity.ts).
21
+ * ProofMethodSchema covers how proof is transported (HTTP sig, DPoP, mTLS, JWK thumbprint).
22
+ * ProofTypeSchema covers the trust root model used to establish identity.
23
+ *
24
+ * The 'custom' type: implementers MUST document their proof semantics externally.
25
+ * proof_ref SHOULD use a reverse-DNS namespace (e.g., 'com.example.vendor/proof-type-v1').
26
+ */
27
+ export declare const PROOF_TYPES: readonly ["ed25519-cert-chain", "eat-passport", "eat-background-check", "sigstore-oidc", "did", "spiffe", "x509-pki", "custom"];
28
+ export declare const ProofTypeSchema: z.ZodEnum<{
29
+ "ed25519-cert-chain": "ed25519-cert-chain";
30
+ "eat-passport": "eat-passport";
31
+ "eat-background-check": "eat-background-check";
32
+ "sigstore-oidc": "sigstore-oidc";
33
+ did: "did";
34
+ spiffe: "spiffe";
35
+ "x509-pki": "x509-pki";
36
+ custom: "custom";
37
+ }>;
38
+ export type ProofType = z.infer<typeof ProofTypeSchema>;
39
+ /**
40
+ * Validate that a string is an origin-only URL (scheme + host + optional port).
41
+ * Rejects URLs with path (other than '/'), query, or fragment components.
42
+ * This prevents correlation leakage and ambiguity in ActorBinding.
43
+ *
44
+ * Valid: "https://example.com", "https://example.com:8443"
45
+ * Invalid: "https://example.com/api/v1", "https://example.com?q=1", "https://example.com#frag"
46
+ */
47
+ export declare function isOriginOnly(value: string): boolean;
48
+ /**
49
+ * Extension key for ActorBinding in Wire 0.1 ext[].
50
+ */
51
+ export declare const ACTOR_BINDING_EXTENSION_KEY: "org.peacprotocol/actor_binding";
52
+ /**
53
+ * ActorBinding schema (DD-142).
54
+ *
55
+ * Binds an actor identity to a receipt via ext["org.peacprotocol/actor_binding"].
56
+ * Wire 0.2 moves this to a kernel field.
57
+ *
58
+ * - id: Stable actor identifier (opaque, no PII)
59
+ * - proof_type: Trust root model from DD-143 vocabulary
60
+ * - proof_ref: Optional URI or hash of external proof artifact
61
+ * - origin: Origin-only URL (scheme + host + optional port; no path/query/fragment)
62
+ * - intent_hash: Optional SHA-256 hash of the intent (hash-first per DD-138)
63
+ */
64
+ export declare const ActorBindingSchema: z.ZodObject<{
65
+ id: z.ZodString;
66
+ proof_type: z.ZodEnum<{
67
+ "ed25519-cert-chain": "ed25519-cert-chain";
68
+ "eat-passport": "eat-passport";
69
+ "eat-background-check": "eat-background-check";
70
+ "sigstore-oidc": "sigstore-oidc";
71
+ did: "did";
72
+ spiffe: "spiffe";
73
+ "x509-pki": "x509-pki";
74
+ custom: "custom";
75
+ }>;
76
+ proof_ref: z.ZodOptional<z.ZodString>;
77
+ origin: z.ZodString;
78
+ intent_hash: z.ZodOptional<z.ZodString>;
79
+ }, z.core.$strict>;
80
+ export type ActorBinding = z.infer<typeof ActorBindingSchema>;
81
+ /**
82
+ * MVIS (Minimum Viable Identity Set) fields (DD-144).
83
+ *
84
+ * 5 required fields for any identity receipt to be considered complete.
85
+ * validateMVIS() is a pure validation function with zero I/O (DD-141).
86
+ *
87
+ * Fields:
88
+ * - issuer: Who issued the identity assertion
89
+ * - subject: Who the identity is about (opaque identifier)
90
+ * - key_binding: Cryptographic binding to a key (kid or thumbprint)
91
+ * - time_bounds: Validity period with not_before and not_after
92
+ * - replay_protection: Unique token ID (jti) and optional nonce
93
+ */
94
+ export declare const MVISTimeBoundsSchema: z.ZodObject<{
95
+ not_before: z.ZodString;
96
+ not_after: z.ZodString;
97
+ }, z.core.$strict>;
98
+ export type MVISTimeBounds = z.infer<typeof MVISTimeBoundsSchema>;
99
+ export declare const MVISReplayProtectionSchema: z.ZodObject<{
100
+ jti: z.ZodString;
101
+ nonce: z.ZodOptional<z.ZodString>;
102
+ }, z.core.$strict>;
103
+ export type MVISReplayProtection = z.infer<typeof MVISReplayProtectionSchema>;
104
+ export declare const MVISFieldsSchema: z.ZodObject<{
105
+ issuer: z.ZodString;
106
+ subject: z.ZodString;
107
+ key_binding: z.ZodString;
108
+ time_bounds: z.ZodObject<{
109
+ not_before: z.ZodString;
110
+ not_after: z.ZodString;
111
+ }, z.core.$strict>;
112
+ replay_protection: z.ZodObject<{
113
+ jti: z.ZodString;
114
+ nonce: z.ZodOptional<z.ZodString>;
115
+ }, z.core.$strict>;
116
+ }, z.core.$strict>;
117
+ export type MVISFields = z.infer<typeof MVISFieldsSchema>;
118
+ /**
119
+ * Validate an ActorBinding object.
120
+ *
121
+ * @param data - Unknown data to validate
122
+ * @returns Result with validated ActorBinding or error message
123
+ */
124
+ export declare function validateActorBinding(data: unknown): {
125
+ ok: true;
126
+ value: ActorBinding;
127
+ } | {
128
+ ok: false;
129
+ error: string;
130
+ };
131
+ /**
132
+ * Validate MVIS fields (DD-144).
133
+ *
134
+ * Pure validation function with zero I/O (DD-141).
135
+ * Checks that all 5 required fields are present and valid.
136
+ * Also validates that time_bounds.not_before < time_bounds.not_after.
137
+ *
138
+ * @param data - Unknown data to validate
139
+ * @returns Result with validated MVIS fields or error message
140
+ */
141
+ export declare function validateMVIS(data: unknown): {
142
+ ok: true;
143
+ value: MVISFields;
144
+ } | {
145
+ ok: false;
146
+ error: string;
147
+ };
148
+ //# sourceMappingURL=actor-binding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actor-binding.d.ts","sourceRoot":"","sources":["../src/actor-binding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,WAAW,iIASd,CAAC;AAEX,eAAO,MAAM,eAAe;;;;;;;;;EAAsB,CAAC;AACnD,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAMxD;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAyCnD;AAMD;;GAEG;AACH,eAAO,MAAM,2BAA2B,EAAG,gCAAyC,CAAC;AAErF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;kBAyBpB,CAAC;AAEZ,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAM9D;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,oBAAoB;;;kBAOtB,CAAC;AAEZ,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,0BAA0B;;;kBAO5B,CAAC;AAEZ,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E,eAAO,MAAM,gBAAgB;;;;;;;;;;;;kBAiBlB,CAAC;AAEZ,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAM1D;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,OAAO,GACZ;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,YAAY,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAMlE;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,OAAO,GACZ;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,UAAU,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAoBhE"}
package/dist/dispute.d.ts CHANGED
@@ -317,9 +317,9 @@ export type DisputeResolution = z.infer<typeof DisputeResolutionSchema>;
317
317
  * - 'did': Decentralized identifier
318
318
  */
319
319
  export declare const ContactMethodSchema: z.ZodEnum<{
320
+ did: "did";
320
321
  email: "email";
321
322
  url: "url";
322
- did: "did";
323
323
  }>;
324
324
  export type ContactMethod = z.infer<typeof ContactMethodSchema>;
325
325
  /**
@@ -329,9 +329,9 @@ export type ContactMethod = z.infer<typeof ContactMethodSchema>;
329
329
  */
330
330
  export declare const DisputeContactSchema: z.ZodObject<{
331
331
  method: z.ZodEnum<{
332
+ did: "did";
332
333
  email: "email";
333
334
  url: "url";
334
- did: "did";
335
335
  }>;
336
336
  value: z.ZodString;
337
337
  }, z.core.$strict>;
@@ -409,9 +409,9 @@ export declare const DisputeEvidenceSchema: z.ZodObject<{
409
409
  }, z.core.$strict>>>;
410
410
  contact: z.ZodOptional<z.ZodObject<{
411
411
  method: z.ZodEnum<{
412
+ did: "did";
412
413
  email: "email";
413
414
  url: "url";
414
- did: "did";
415
415
  }>;
416
416
  value: z.ZodString;
417
417
  }, z.core.$strict>>;
@@ -540,9 +540,9 @@ export declare const DisputeAttestationSchema: z.ZodObject<{
540
540
  }, z.core.$strict>>>;
541
541
  contact: z.ZodOptional<z.ZodObject<{
542
542
  method: z.ZodEnum<{
543
+ did: "did";
543
544
  email: "email";
544
545
  url: "url";
545
- did: "did";
546
546
  }>;
547
547
  value: z.ZodString;
548
548
  }, z.core.$strict>>;
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Control Action Extension Schema (v0.11.3+, DD-145 ZT Pack)
3
+ *
4
+ * Records access control decisions in ext["org.peacprotocol/control_action"].
5
+ * Actions: grant, deny, escalate, delegate, audit.
6
+ * Triggers: policy_evaluation, manual_review, anomaly_detection, scheduled, event_driven.
7
+ */
8
+ import { z } from 'zod';
9
+ export declare const CONTROL_ACTION_EXTENSION_KEY: "org.peacprotocol/control_action";
10
+ /**
11
+ * Control action types
12
+ */
13
+ export declare const CONTROL_ACTIONS: readonly ["grant", "deny", "escalate", "delegate", "audit"];
14
+ export declare const ControlActionTypeSchema: z.ZodEnum<{
15
+ deny: "deny";
16
+ grant: "grant";
17
+ escalate: "escalate";
18
+ delegate: "delegate";
19
+ audit: "audit";
20
+ }>;
21
+ export type ControlActionType = z.infer<typeof ControlActionTypeSchema>;
22
+ /**
23
+ * Control action triggers
24
+ */
25
+ export declare const CONTROL_TRIGGERS: readonly ["policy_evaluation", "manual_review", "anomaly_detection", "scheduled", "event_driven"];
26
+ export declare const ControlTriggerSchema: z.ZodEnum<{
27
+ policy_evaluation: "policy_evaluation";
28
+ manual_review: "manual_review";
29
+ anomaly_detection: "anomaly_detection";
30
+ scheduled: "scheduled";
31
+ event_driven: "event_driven";
32
+ }>;
33
+ export type ControlTrigger = z.infer<typeof ControlTriggerSchema>;
34
+ /**
35
+ * Control Action extension schema
36
+ */
37
+ export declare const ControlActionSchema: z.ZodObject<{
38
+ action: z.ZodEnum<{
39
+ deny: "deny";
40
+ grant: "grant";
41
+ escalate: "escalate";
42
+ delegate: "delegate";
43
+ audit: "audit";
44
+ }>;
45
+ trigger: z.ZodEnum<{
46
+ policy_evaluation: "policy_evaluation";
47
+ manual_review: "manual_review";
48
+ anomaly_detection: "anomaly_detection";
49
+ scheduled: "scheduled";
50
+ event_driven: "event_driven";
51
+ }>;
52
+ resource: z.ZodOptional<z.ZodString>;
53
+ reason: z.ZodOptional<z.ZodString>;
54
+ policy_ref: z.ZodOptional<z.ZodString>;
55
+ action_at: z.ZodOptional<z.ZodString>;
56
+ }, z.core.$strict>;
57
+ export type ControlAction = z.infer<typeof ControlActionSchema>;
58
+ /**
59
+ * Validate a ControlAction object.
60
+ */
61
+ export declare function validateControlAction(data: unknown): {
62
+ ok: true;
63
+ value: ControlAction;
64
+ } | {
65
+ ok: false;
66
+ error: string;
67
+ };
68
+ //# sourceMappingURL=control-action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"control-action.d.ts","sourceRoot":"","sources":["../../src/extensions/control-action.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,4BAA4B,EAAG,iCAA0C,CAAC;AAEvF;;GAEG;AACH,eAAO,MAAM,eAAe,6DAA8D,CAAC;AAE3F,eAAO,MAAM,uBAAuB;;;;;;EAA0B,CAAC;AAC/D,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE;;GAEG;AACH,eAAO,MAAM,gBAAgB,mGAMnB,CAAC;AAEX,eAAO,MAAM,oBAAoB;;;;;;EAA2B,CAAC;AAC7D,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;kBAoBrB,CAAC;AAEZ,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,OAAO,GACZ;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,aAAa,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAMnE"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Credential Event Extension Schema (v0.11.3+, DD-145 ZT Pack)
3
+ *
4
+ * Records credential lifecycle events in ext["org.peacprotocol/credential_event"].
5
+ * Events: issued, leased, rotated, revoked, expired.
6
+ *
7
+ * credential_ref is an opaque fingerprint reference (DD-146): schema validates
8
+ * format only (prefix + hex). Issuers compute values externally; verifiers
9
+ * MUST NOT assume they can recompute the reference.
10
+ */
11
+ import { z } from 'zod';
12
+ export declare const CREDENTIAL_EVENT_EXTENSION_KEY: "org.peacprotocol/credential_event";
13
+ /**
14
+ * Credential lifecycle events
15
+ */
16
+ export declare const CREDENTIAL_EVENTS: readonly ["issued", "leased", "rotated", "revoked", "expired"];
17
+ export declare const CredentialEventTypeSchema: z.ZodEnum<{
18
+ issued: "issued";
19
+ leased: "leased";
20
+ rotated: "rotated";
21
+ revoked: "revoked";
22
+ expired: "expired";
23
+ }>;
24
+ export type CredentialEventType = z.infer<typeof CredentialEventTypeSchema>;
25
+ export declare const CredentialRefSchema: z.ZodString;
26
+ /**
27
+ * Credential Event extension schema
28
+ */
29
+ export declare const CredentialEventSchema: z.ZodObject<{
30
+ event: z.ZodEnum<{
31
+ issued: "issued";
32
+ leased: "leased";
33
+ rotated: "rotated";
34
+ revoked: "revoked";
35
+ expired: "expired";
36
+ }>;
37
+ credential_ref: z.ZodString;
38
+ authority: z.ZodString;
39
+ expires_at: z.ZodOptional<z.ZodString>;
40
+ previous_ref: z.ZodOptional<z.ZodString>;
41
+ }, z.core.$strict>;
42
+ export type CredentialEvent = z.infer<typeof CredentialEventSchema>;
43
+ /**
44
+ * Validate a CredentialEvent object.
45
+ */
46
+ export declare function validateCredentialEvent(data: unknown): {
47
+ ok: true;
48
+ value: CredentialEvent;
49
+ } | {
50
+ ok: false;
51
+ error: string;
52
+ };
53
+ //# sourceMappingURL=credential-event.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credential-event.d.ts","sourceRoot":"","sources":["../../src/extensions/credential-event.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,8BAA8B,EAAG,mCAA4C,CAAC;AAE3F;;GAEG;AACH,eAAO,MAAM,iBAAiB,gEAAiE,CAAC;AAEhG,eAAO,MAAM,yBAAyB;;;;;;EAA4B,CAAC;AACnE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAS5E,eAAO,MAAM,mBAAmB,aAG9B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;kBAuBvB,CAAC;AAEZ,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,OAAO,GACZ;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,eAAe,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAMrE"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Fingerprint Reference Conversion Functions (v0.11.3+, DD-146)
3
+ *
4
+ * Pure string manipulation functions for converting between Wire 0.1
5
+ * string form ("alg:hex64") and Wire 0.2 object form ({ alg, value, key_id? }).
6
+ *
7
+ * These are opaque references. The schema validates format only.
8
+ * Issuers compute values externally; verifiers MUST NOT assume
9
+ * they can recompute the reference.
10
+ *
11
+ * Lives in Layer 1 (@peac/schema) because it is pure string manipulation,
12
+ * not cryptographic computation. Zero dependencies, zero I/O.
13
+ */
14
+ /**
15
+ * Wire 0.2 object form of a fingerprint reference
16
+ */
17
+ export interface FingerprintRefObject {
18
+ /** Hash algorithm: 'sha256' or 'hmac-sha256' */
19
+ alg: string;
20
+ /** Base64url-encoded value */
21
+ value: string;
22
+ /** Optional key identifier (for hmac-sha256 references) */
23
+ key_id?: string;
24
+ }
25
+ /**
26
+ * Maximum length for fingerprint reference string form.
27
+ * "hmac-sha256:" (12) + 64 hex chars = 76 chars max.
28
+ */
29
+ export declare const MAX_FINGERPRINT_REF_LENGTH = 76;
30
+ /**
31
+ * Parse a Wire 0.1 string form fingerprint reference ("alg:hex64")
32
+ * into a Wire 0.2 object form ({ alg, value }).
33
+ *
34
+ * The hex value is converted to base64url for the object form.
35
+ *
36
+ * @param s - String form: "sha256:<64 hex chars>" or "hmac-sha256:<64 hex chars>"
37
+ * @returns Object form with base64url value, or null if invalid
38
+ */
39
+ export declare function stringToFingerprintRef(s: string): FingerprintRefObject | null;
40
+ /**
41
+ * Convert a Wire 0.2 object form fingerprint reference back to
42
+ * the Wire 0.1 string form ("alg:hex64").
43
+ *
44
+ * The base64url value is converted back to hex for the string form.
45
+ *
46
+ * @param obj - Object form with alg and base64url value
47
+ * @returns String form "alg:<64 hex chars>", or null if invalid
48
+ */
49
+ export declare function fingerprintRefToString(obj: FingerprintRefObject): string | null;
50
+ //# sourceMappingURL=fingerprint-ref.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fingerprint-ref.d.ts","sourceRoot":"","sources":["../../src/extensions/fingerprint-ref.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,gDAAgD;IAChD,GAAG,EAAE,MAAM,CAAC;IACZ,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,2DAA2D;IAC3D,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAuDD;;;GAGG;AACH,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAQ7C;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,MAAM,GAAG,oBAAoB,GAAG,IAAI,CAc7E;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,oBAAoB,GAAG,MAAM,GAAG,IAAI,CAiB/E"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * PEAC Protocol Extension Schemas (v0.11.3+, DD-145 ZT Pack)
3
+ *
4
+ * Zero Trust extension schemas for use in ext[] with reverse-DNS keys.
5
+ */
6
+ export { CredentialEventTypeSchema, CredentialRefSchema, CredentialEventSchema, CREDENTIAL_EVENT_EXTENSION_KEY, CREDENTIAL_EVENTS, validateCredentialEvent, } from './credential-event';
7
+ export type { CredentialEventType, CredentialEvent } from './credential-event';
8
+ export { ToolRegistrySchema, TOOL_REGISTRY_EXTENSION_KEY, validateToolRegistry, } from './tool-registry';
9
+ export type { ToolRegistry } from './tool-registry';
10
+ export { ControlActionTypeSchema, ControlTriggerSchema, ControlActionSchema, CONTROL_ACTION_EXTENSION_KEY, CONTROL_ACTIONS, CONTROL_TRIGGERS, validateControlAction, } from './control-action';
11
+ export type { ControlActionType, ControlTrigger, ControlAction } from './control-action';
12
+ export { CommitmentClassSchema, TreatySchema, TREATY_EXTENSION_KEY, COMMITMENT_CLASSES, validateTreaty, } from './treaty';
13
+ export type { CommitmentClass, Treaty } from './treaty';
14
+ export { stringToFingerprintRef, fingerprintRefToString, MAX_FINGERPRINT_REF_LENGTH, } from './fingerprint-ref';
15
+ export type { FingerprintRefObject } from './fingerprint-ref';
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/extensions/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,qBAAqB,EACrB,8BAA8B,EAC9B,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAG/E,OAAO,EACL,kBAAkB,EAClB,2BAA2B,EAC3B,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGpD,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EACnB,4BAA4B,EAC5B,eAAe,EACf,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGzF,OAAO,EACL,qBAAqB,EACrB,YAAY,EACZ,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,GACf,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGxD,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Tool Registry Extension Schema (v0.11.3+, DD-145 ZT Pack)
3
+ *
4
+ * Records tool registration and capability declarations in
5
+ * ext["org.peacprotocol/tool_registry"].
6
+ *
7
+ * Security: registry_uri validated against URL scheme allowlist
8
+ * (HTTPS + URN only; no file:// or data:// for SSRF prevention).
9
+ */
10
+ import { z } from 'zod';
11
+ export declare const TOOL_REGISTRY_EXTENSION_KEY: "org.peacprotocol/tool_registry";
12
+ /**
13
+ * Tool Registry extension schema
14
+ */
15
+ export declare const ToolRegistrySchema: z.ZodObject<{
16
+ tool_id: z.ZodString;
17
+ registry_uri: z.ZodString;
18
+ version: z.ZodOptional<z.ZodString>;
19
+ capabilities: z.ZodOptional<z.ZodArray<z.ZodString>>;
20
+ }, z.core.$strict>;
21
+ export type ToolRegistry = z.infer<typeof ToolRegistrySchema>;
22
+ /**
23
+ * Validate a ToolRegistry object.
24
+ */
25
+ export declare function validateToolRegistry(data: unknown): {
26
+ ok: true;
27
+ value: ToolRegistry;
28
+ } | {
29
+ ok: false;
30
+ error: string;
31
+ };
32
+ //# sourceMappingURL=tool-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-registry.d.ts","sourceRoot":"","sources":["../../src/extensions/tool-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,2BAA2B,EAAG,gCAAyC,CAAC;AAkBrF;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;kBAgBpB,CAAC;AAEZ,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,OAAO,GACZ;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,YAAY,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAMlE"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Treaty Extension Schema (v0.11.3+, DD-147)
3
+ *
4
+ * Records agreement commitment levels in ext["org.peacprotocol/treaty"].
5
+ * 4-level commitment_class vocabulary: informational, operational, financial, legal.
6
+ *
7
+ * Governance: commitment_class is a CLOSED vocabulary. Adding new levels requires
8
+ * a registry update in registries.json and a minor version bump.
9
+ *
10
+ * Terms pairing: when terms_hash is provided alongside terms_ref, the hash
11
+ * SHOULD correspond to the content at terms_ref. Future enforcement may
12
+ * verify this binding at verification time.
13
+ */
14
+ import { z } from 'zod';
15
+ export declare const TREATY_EXTENSION_KEY: "org.peacprotocol/treaty";
16
+ /**
17
+ * Commitment class vocabulary (DD-147).
18
+ * Ascending levels of binding commitment.
19
+ */
20
+ export declare const COMMITMENT_CLASSES: readonly ["informational", "operational", "financial", "legal"];
21
+ export declare const CommitmentClassSchema: z.ZodEnum<{
22
+ informational: "informational";
23
+ operational: "operational";
24
+ financial: "financial";
25
+ legal: "legal";
26
+ }>;
27
+ export type CommitmentClass = z.infer<typeof CommitmentClassSchema>;
28
+ /**
29
+ * Treaty extension schema
30
+ */
31
+ export declare const TreatySchema: z.ZodObject<{
32
+ commitment_class: z.ZodEnum<{
33
+ informational: "informational";
34
+ operational: "operational";
35
+ financial: "financial";
36
+ legal: "legal";
37
+ }>;
38
+ terms_ref: z.ZodOptional<z.ZodString>;
39
+ terms_hash: z.ZodOptional<z.ZodString>;
40
+ counterparty: z.ZodOptional<z.ZodString>;
41
+ effective_at: z.ZodOptional<z.ZodString>;
42
+ expires_at: z.ZodOptional<z.ZodString>;
43
+ }, z.core.$strict>;
44
+ export type Treaty = z.infer<typeof TreatySchema>;
45
+ /**
46
+ * Validate a Treaty object.
47
+ */
48
+ export declare function validateTreaty(data: unknown): {
49
+ ok: true;
50
+ value: Treaty;
51
+ } | {
52
+ ok: false;
53
+ error: string;
54
+ };
55
+ //# sourceMappingURL=treaty.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"treaty.d.ts","sourceRoot":"","sources":["../../src/extensions/treaty.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,oBAAoB,EAAG,yBAAkC,CAAC;AAEvE;;;GAGG;AACH,eAAO,MAAM,kBAAkB,iEAAkE,CAAC;AAElG,eAAO,MAAM,qBAAqB;;;;;EAA6B,CAAC;AAChE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;kBAyBd,CAAC;AAEZ,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAElD;;GAEG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,OAAO,GACZ;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAgB5D"}