@peac/schema 0.12.1 → 0.12.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.
Files changed (76) hide show
  1. package/dist/actor-binding.d.ts +10 -10
  2. package/dist/agent-identity.d.ts +8 -6
  3. package/dist/agent-identity.d.ts.map +1 -1
  4. package/dist/carrier.d.ts +7 -7
  5. package/dist/carrier.d.ts.map +1 -1
  6. package/dist/constraints.d.ts +4 -4
  7. package/dist/constraints.d.ts.map +1 -1
  8. package/dist/extensions/control-action.d.ts +1 -1
  9. package/dist/extensions/credential-event.d.ts +4 -4
  10. package/dist/extensions/fingerprint-ref.d.ts +1 -1
  11. package/dist/extensions/index.d.ts +1 -1
  12. package/dist/extensions/tool-registry.d.ts +1 -1
  13. package/dist/extensions/treaty.d.ts +2 -2
  14. package/dist/index.cjs +733 -44
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.ts +3 -3
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.mjs +684 -46
  19. package/dist/index.mjs.map +1 -1
  20. package/dist/issuer-config.d.ts +1 -1
  21. package/dist/policy-binding.d.ts +2 -2
  22. package/dist/receipt-parser.cjs +626 -14
  23. package/dist/receipt-parser.cjs.map +1 -1
  24. package/dist/receipt-parser.mjs +627 -15
  25. package/dist/receipt-parser.mjs.map +1 -1
  26. package/dist/subject.d.ts +33 -12
  27. package/dist/subject.d.ts.map +1 -1
  28. package/dist/types.d.ts +1 -1
  29. package/dist/types.d.ts.map +1 -1
  30. package/dist/wire-02-envelope.d.ts +2 -2
  31. package/dist/wire-02-extensions/access.d.ts +19 -0
  32. package/dist/wire-02-extensions/access.d.ts.map +1 -0
  33. package/dist/wire-02-extensions/accessors.d.ts +44 -0
  34. package/dist/wire-02-extensions/accessors.d.ts.map +1 -0
  35. package/dist/wire-02-extensions/attribution.d.ts +44 -0
  36. package/dist/wire-02-extensions/attribution.d.ts.map +1 -0
  37. package/dist/wire-02-extensions/challenge.d.ts +60 -0
  38. package/dist/wire-02-extensions/challenge.d.ts.map +1 -0
  39. package/dist/wire-02-extensions/commerce.d.ts +29 -0
  40. package/dist/wire-02-extensions/commerce.d.ts.map +1 -0
  41. package/dist/wire-02-extensions/compliance.d.ts +49 -0
  42. package/dist/wire-02-extensions/compliance.d.ts.map +1 -0
  43. package/dist/wire-02-extensions/consent.d.ts +48 -0
  44. package/dist/wire-02-extensions/consent.d.ts.map +1 -0
  45. package/dist/wire-02-extensions/correlation.d.ts +18 -0
  46. package/dist/wire-02-extensions/correlation.d.ts.map +1 -0
  47. package/dist/wire-02-extensions/grammar.d.ts +40 -0
  48. package/dist/wire-02-extensions/grammar.d.ts.map +1 -0
  49. package/dist/wire-02-extensions/identity.d.ts +13 -0
  50. package/dist/wire-02-extensions/identity.d.ts.map +1 -0
  51. package/dist/wire-02-extensions/index.d.ts +40 -0
  52. package/dist/wire-02-extensions/index.d.ts.map +1 -0
  53. package/dist/wire-02-extensions/limits.d.ts +80 -0
  54. package/dist/wire-02-extensions/limits.d.ts.map +1 -0
  55. package/dist/wire-02-extensions/privacy.d.ts +64 -0
  56. package/dist/wire-02-extensions/privacy.d.ts.map +1 -0
  57. package/dist/wire-02-extensions/provenance.d.ts +58 -0
  58. package/dist/wire-02-extensions/provenance.d.ts.map +1 -0
  59. package/dist/wire-02-extensions/purpose-extension.d.ts +26 -0
  60. package/dist/wire-02-extensions/purpose-extension.d.ts.map +1 -0
  61. package/dist/wire-02-extensions/safety.d.ts +65 -0
  62. package/dist/wire-02-extensions/safety.d.ts.map +1 -0
  63. package/dist/wire-02-extensions/schema-map.d.ts +13 -0
  64. package/dist/wire-02-extensions/schema-map.d.ts.map +1 -0
  65. package/dist/wire-02-extensions/shared-validators.d.ts +192 -0
  66. package/dist/wire-02-extensions/shared-validators.d.ts.map +1 -0
  67. package/dist/wire-02-extensions/validation.d.ts +57 -0
  68. package/dist/wire-02-extensions/validation.d.ts.map +1 -0
  69. package/dist/wire-02-extensions.d.ts +7 -211
  70. package/dist/wire-02-extensions.d.ts.map +1 -1
  71. package/dist/wire-02-registries.d.ts +5 -2
  72. package/dist/wire-02-registries.d.ts.map +1 -1
  73. package/dist/wire-02-representation.d.ts +3 -3
  74. package/dist/wire-02-warnings.d.ts +5 -1
  75. package/dist/wire-02-warnings.d.ts.map +1 -1
  76. package/package.json +2 -2
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Wire 0.2 Extension Group Limits
3
+ *
4
+ * Centralized per-field bounds for all Wire 0.2 extension group fields.
5
+ * Prevents magic numbers and allows external reference.
6
+ * Follows repo _LIMITS convention.
7
+ *
8
+ * Byte-budget constants are normative and live in @peac/kernel
9
+ * (EXTENSION_BUDGET). Re-exported here for schema-layer convenience.
10
+ */
11
+ export { EXTENSION_BUDGET } from '@peac/kernel';
12
+ /**
13
+ * Normative per-field bounds for Wire 0.2 extension group fields.
14
+ */
15
+ export declare const EXTENSION_LIMITS: {
16
+ readonly maxExtensionKeyLength: 512;
17
+ readonly maxDnsLabelLength: 63;
18
+ readonly maxDnsDomainLength: 253;
19
+ readonly maxPaymentRailLength: 128;
20
+ readonly maxCurrencyLength: 16;
21
+ readonly maxAmountMinorLength: 64;
22
+ readonly maxReferenceLength: 256;
23
+ readonly maxAssetLength: 256;
24
+ readonly maxCommerceEventLength: 64;
25
+ readonly maxResourceLength: 2048;
26
+ readonly maxActionLength: 256;
27
+ readonly maxProblemTypeLength: 2048;
28
+ readonly maxProblemTitleLength: 256;
29
+ readonly maxProblemDetailLength: 4096;
30
+ readonly maxProblemInstanceLength: 2048;
31
+ readonly maxProofRefLength: 256;
32
+ readonly maxTraceIdLength: 32;
33
+ readonly maxSpanIdLength: 16;
34
+ readonly maxWorkflowIdLength: 256;
35
+ readonly maxParentJtiLength: 256;
36
+ readonly maxDependsOnLength: 64;
37
+ readonly maxConsentBasisLength: 128;
38
+ readonly maxConsentMethodLength: 128;
39
+ readonly maxDataCategoriesCount: 64;
40
+ readonly maxDataCategoryLength: 128;
41
+ readonly maxConsentScopeLength: 256;
42
+ readonly maxJurisdictionLength: 16;
43
+ readonly maxFrameworkLength: 256;
44
+ readonly maxAuditRefLength: 256;
45
+ readonly maxAuditorLength: 256;
46
+ readonly maxComplianceScopeLength: 512;
47
+ readonly maxDataClassificationLength: 128;
48
+ readonly maxProcessingBasisLength: 128;
49
+ readonly maxAnonymizationMethodLength: 128;
50
+ readonly maxDataSubjectCategoryLength: 128;
51
+ readonly maxTransferMechanismLength: 128;
52
+ readonly maxAssessmentMethodLength: 256;
53
+ readonly maxSafetyMeasuresCount: 32;
54
+ readonly maxSafetyMeasureLength: 256;
55
+ readonly maxIncidentRefLength: 256;
56
+ readonly maxModelRefLength: 256;
57
+ readonly maxSafetyCategoryLength: 128;
58
+ readonly maxSourceTypeLength: 128;
59
+ readonly maxSourceRefLength: 256;
60
+ readonly maxVerificationMethodLength: 128;
61
+ readonly maxCustodyChainCount: 16;
62
+ readonly maxCustodianLength: 256;
63
+ readonly maxCustodyActionLength: 128;
64
+ readonly maxSlsaTrackLength: 64;
65
+ readonly maxSlsaVersionLength: 16;
66
+ readonly maxCreatorRefLength: 256;
67
+ readonly maxObligationTypeLength: 128;
68
+ readonly maxAttributionTextLength: 1024;
69
+ readonly maxContentSignalSourceLength: 128;
70
+ readonly maxExternalPurposesCount: 32;
71
+ readonly maxExternalPurposeLength: 128;
72
+ readonly maxPurposeBasisLength: 128;
73
+ readonly maxCompatiblePurposesCount: 32;
74
+ readonly maxHttpsUriLength: 2048;
75
+ readonly maxSha256DigestLength: 71;
76
+ readonly maxIso8601DurationLength: 64;
77
+ readonly maxIso8601DateLength: 10;
78
+ readonly maxSpdxExpressionLength: 128;
79
+ };
80
+ //# sourceMappingURL=limits.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"limits.d.ts","sourceRoot":"","sources":["../../src/wire-02-extensions/limits.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2FnB,CAAC"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Privacy Extension Group (org.peacprotocol/privacy)
3
+ *
4
+ * Records data classification and handling observations.
5
+ * Aligned with ISO/IEC 27701 concepts.
6
+ *
7
+ * Design:
8
+ * - Open taxonomy for data_classification, processing_basis, methods
9
+ * - Closed enums for retention_mode, recipient_scope (universal categories)
10
+ * - retention_period (ISO 8601 duration) and retention_mode are separate fields
11
+ * to keep duration grammar and non-duration semantics distinct
12
+ * - Observation-only semantics: records events, never enforces policy
13
+ *
14
+ * @see docs/specs/WIRE-0.2.md Section 12.11
15
+ */
16
+ import { z } from 'zod';
17
+ export declare const PRIVACY_EXTENSION_KEY: "org.peacprotocol/privacy";
18
+ /**
19
+ * Retention mode: non-duration retention semantics.
20
+ * Separate from retention_period to keep duration grammar distinct.
21
+ *
22
+ * Closed enum: 3 values cover all non-duration retention patterns.
23
+ */
24
+ export declare const RETENTION_MODES: readonly ["time_bound", "indefinite", "session_only"];
25
+ export declare const RetentionModeSchema: z.ZodEnum<{
26
+ time_bound: "time_bound";
27
+ indefinite: "indefinite";
28
+ session_only: "session_only";
29
+ }>;
30
+ export type RetentionMode = z.infer<typeof RetentionModeSchema>;
31
+ /**
32
+ * Recipient scope: aligned with GDPR Art 13-14 disclosure categories.
33
+ *
34
+ * Closed enum: 4 values cover standard data recipient classifications.
35
+ */
36
+ export declare const RECIPIENT_SCOPES: readonly ["internal", "processor", "third_party", "public"];
37
+ export declare const RecipientScopeSchema: z.ZodEnum<{
38
+ internal: "internal";
39
+ processor: "processor";
40
+ third_party: "third_party";
41
+ public: "public";
42
+ }>;
43
+ export type RecipientScope = z.infer<typeof RecipientScopeSchema>;
44
+ export declare const PrivacyExtensionSchema: z.ZodObject<{
45
+ data_classification: z.ZodString;
46
+ processing_basis: z.ZodOptional<z.ZodString>;
47
+ retention_period: z.ZodOptional<z.ZodString>;
48
+ retention_mode: z.ZodOptional<z.ZodEnum<{
49
+ time_bound: "time_bound";
50
+ indefinite: "indefinite";
51
+ session_only: "session_only";
52
+ }>>;
53
+ recipient_scope: z.ZodOptional<z.ZodEnum<{
54
+ internal: "internal";
55
+ processor: "processor";
56
+ third_party: "third_party";
57
+ public: "public";
58
+ }>>;
59
+ anonymization_method: z.ZodOptional<z.ZodString>;
60
+ data_subject_category: z.ZodOptional<z.ZodString>;
61
+ transfer_mechanism: z.ZodOptional<z.ZodString>;
62
+ }, z.core.$strict>;
63
+ export type PrivacyExtension = z.infer<typeof PrivacyExtensionSchema>;
64
+ //# sourceMappingURL=privacy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"privacy.d.ts","sourceRoot":"","sources":["../../src/wire-02-extensions/privacy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,qBAAqB,EAAG,0BAAmC,CAAC;AAEzE;;;;;GAKG;AACH,eAAO,MAAM,eAAe,uDAAwD,CAAC;AACrF,eAAO,MAAM,mBAAmB;;;;EAA0B,CAAC;AAC3D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,6DAA8D,CAAC;AAC5F,eAAO,MAAM,oBAAoB;;;;;EAA2B,CAAC;AAC7D,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;kBAgExB,CAAC;AAEZ,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Provenance Extension Group (org.peacprotocol/provenance)
3
+ *
4
+ * Records origin tracking and chain of custody as observations.
5
+ *
6
+ * Design:
7
+ * - source_type required, open vocabulary for derivation categories
8
+ * - custody_chain: ordered array of strict nested entries
9
+ * - slsa: structured object recording SLSA-aligned metadata
10
+ * (track-based model; does not certify SLSA compliance)
11
+ * - URI fields are locator hints only; callers MUST NOT auto-fetch
12
+ * - Observation-only semantics: records events, never enforces policy
13
+ */
14
+ import { z } from 'zod';
15
+ export declare const PROVENANCE_EXTENSION_KEY: "org.peacprotocol/provenance";
16
+ /**
17
+ * A single entry in the custody chain.
18
+ *
19
+ * Records one transfer-of-custody event: who held it, what action
20
+ * occurred, and when. Ordered within the custody_chain array.
21
+ */
22
+ export declare const CustodyEntrySchema: z.ZodObject<{
23
+ custodian: z.ZodString;
24
+ action: z.ZodString;
25
+ timestamp: z.ZodISODateTime;
26
+ }, z.core.$strict>;
27
+ export type CustodyEntry = z.infer<typeof CustodyEntrySchema>;
28
+ /**
29
+ * Structured SLSA-aligned provenance metadata.
30
+ *
31
+ * Uses a track-based model rather than a flat scalar.
32
+ * Records metadata; does not certify compliance.
33
+ */
34
+ export declare const SlsaLevelSchema: z.ZodObject<{
35
+ track: z.ZodString;
36
+ level: z.ZodNumber;
37
+ version: z.ZodString;
38
+ }, z.core.$strict>;
39
+ export type SlsaLevel = z.infer<typeof SlsaLevelSchema>;
40
+ export declare const ProvenanceExtensionSchema: z.ZodObject<{
41
+ source_type: z.ZodString;
42
+ source_ref: z.ZodOptional<z.ZodString>;
43
+ source_uri: z.ZodOptional<z.ZodString>;
44
+ build_provenance_uri: z.ZodOptional<z.ZodString>;
45
+ verification_method: z.ZodOptional<z.ZodString>;
46
+ custody_chain: z.ZodOptional<z.ZodArray<z.ZodObject<{
47
+ custodian: z.ZodString;
48
+ action: z.ZodString;
49
+ timestamp: z.ZodISODateTime;
50
+ }, z.core.$strict>>>;
51
+ slsa: z.ZodOptional<z.ZodObject<{
52
+ track: z.ZodString;
53
+ level: z.ZodNumber;
54
+ version: z.ZodString;
55
+ }, z.core.$strict>>;
56
+ }, z.core.$strict>;
57
+ export type ProvenanceExtension = z.infer<typeof ProvenanceExtensionSchema>;
58
+ //# sourceMappingURL=provenance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provenance.d.ts","sourceRoot":"","sources":["../../src/wire-02-extensions/provenance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,wBAAwB,EAAG,6BAAsC,CAAC;AAM/E;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB;;;;kBAWpB,CAAC;AAEZ,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D;;;;;GAKG;AACH,eAAO,MAAM,eAAe;;;;kBAWjB,CAAC;AAEZ,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAMxD,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;kBAiD3B,CAAC;AAEZ,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Purpose Extension Group (org.peacprotocol/purpose)
3
+ *
4
+ * Records external/legal/business purpose declarations as observations.
5
+ * Explicitly separated from PEAC operational purpose tokens
6
+ * (CanonicalPurpose in purpose.ts).
7
+ *
8
+ * Design:
9
+ * - external_purposes: token-based array (machine-safe, bounded, unique)
10
+ * - peac_purpose_mapping: optional bridge to PEAC operational tokens
11
+ * via PURPOSE_TOKEN_REGEX
12
+ * - No prose-heavy fields at schema layer
13
+ * - Observation-only semantics: records events, never enforces policy
14
+ */
15
+ import { z } from 'zod';
16
+ export declare const PURPOSE_EXTENSION_KEY: "org.peacprotocol/purpose";
17
+ export declare const PurposeExtensionSchema: z.ZodObject<{
18
+ external_purposes: z.ZodArray<z.ZodString>;
19
+ purpose_basis: z.ZodOptional<z.ZodString>;
20
+ purpose_limitation: z.ZodOptional<z.ZodBoolean>;
21
+ data_minimization: z.ZodOptional<z.ZodBoolean>;
22
+ compatible_purposes: z.ZodOptional<z.ZodArray<z.ZodString>>;
23
+ peac_purpose_mapping: z.ZodOptional<z.ZodString>;
24
+ }, z.core.$strict>;
25
+ export type PurposeExtension = z.infer<typeof PurposeExtensionSchema>;
26
+ //# sourceMappingURL=purpose-extension.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"purpose-extension.d.ts","sourceRoot":"","sources":["../../src/wire-02-extensions/purpose-extension.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,qBAAqB,EAAG,0BAAmC,CAAC;AAsBzE,eAAO,MAAM,sBAAsB;;;;;;;kBAkDxB,CAAC;AAEZ,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Safety Extension Group (org.peacprotocol/safety)
3
+ *
4
+ * Records safety assessment evidence. Jurisdiction-neutral design.
5
+ * Usage profiles decide when regulatory-specific fields become required.
6
+ *
7
+ * Design:
8
+ * - review_status required (universal assessment lifecycle)
9
+ * - risk_level optional at schema layer; usage profiles may require it
10
+ * - Open taxonomy for assessment_method, safety_measures, category
11
+ * - Observation-only semantics: records events, never enforces policy
12
+ *
13
+ * @see docs/specs/WIRE-0.2.md Section 12.12
14
+ */
15
+ import { z } from 'zod';
16
+ export declare const SAFETY_EXTENSION_KEY: "org.peacprotocol/safety";
17
+ /**
18
+ * Review status: universal safety assessment lifecycle.
19
+ *
20
+ * Closed enum: 4 states cover the assessment lifecycle across
21
+ * EU AI Act, NIST AI RMF, ISO 23894, and general safety review.
22
+ */
23
+ export declare const REVIEW_STATUSES: readonly ["reviewed", "pending", "flagged", "not_applicable"];
24
+ export declare const ReviewStatusSchema: z.ZodEnum<{
25
+ reviewed: "reviewed";
26
+ pending: "pending";
27
+ flagged: "flagged";
28
+ not_applicable: "not_applicable";
29
+ }>;
30
+ export type ReviewStatus = z.infer<typeof ReviewStatusSchema>;
31
+ /**
32
+ * Risk level: converges across EU AI Act Art 6, NIST AI RMF, ISO 23894.
33
+ *
34
+ * Closed enum: 4 risk tiers. Optional at schema level to maintain
35
+ * jurisdiction neutrality; usage profiles may require this field.
36
+ */
37
+ export declare const RISK_LEVELS: readonly ["unacceptable", "high", "limited", "minimal"];
38
+ export declare const RiskLevelSchema: z.ZodEnum<{
39
+ unacceptable: "unacceptable";
40
+ high: "high";
41
+ limited: "limited";
42
+ minimal: "minimal";
43
+ }>;
44
+ export type RiskLevel = z.infer<typeof RiskLevelSchema>;
45
+ export declare const SafetyExtensionSchema: z.ZodObject<{
46
+ review_status: z.ZodEnum<{
47
+ reviewed: "reviewed";
48
+ pending: "pending";
49
+ flagged: "flagged";
50
+ not_applicable: "not_applicable";
51
+ }>;
52
+ risk_level: z.ZodOptional<z.ZodEnum<{
53
+ unacceptable: "unacceptable";
54
+ high: "high";
55
+ limited: "limited";
56
+ minimal: "minimal";
57
+ }>>;
58
+ assessment_method: z.ZodOptional<z.ZodString>;
59
+ safety_measures: z.ZodOptional<z.ZodArray<z.ZodString>>;
60
+ incident_ref: z.ZodOptional<z.ZodString>;
61
+ model_ref: z.ZodOptional<z.ZodString>;
62
+ category: z.ZodOptional<z.ZodString>;
63
+ }, z.core.$strict>;
64
+ export type SafetyExtension = z.infer<typeof SafetyExtensionSchema>;
65
+ //# sourceMappingURL=safety.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"safety.d.ts","sourceRoot":"","sources":["../../src/wire-02-extensions/safety.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,oBAAoB,EAAG,yBAAkC,CAAC;AAEvE;;;;;GAKG;AACH,eAAO,MAAM,eAAe,+DAAgE,CAAC;AAC7F,eAAO,MAAM,kBAAkB;;;;;EAA0B,CAAC;AAC1D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D;;;;;GAKG;AACH,eAAO,MAAM,WAAW,yDAA0D,CAAC;AACnF,eAAO,MAAM,eAAe;;;;;EAAsB,CAAC;AACnD,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;kBAyCvB,CAAC;AAEZ,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Wire 0.2 Extension Schema Map
3
+ *
4
+ * Maps known extension group keys to their Zod schemas.
5
+ * Used by validateKnownExtensions() for group-level validation
6
+ * and by type-to-extension enforcement.
7
+ *
8
+ * This file is the single mutation point for group registration.
9
+ */
10
+ import type { z } from 'zod';
11
+ /** Map from known extension key to its Zod schema */
12
+ export declare const EXTENSION_SCHEMA_MAP: Map<string, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
13
+ //# sourceMappingURL=schema-map.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-map.d.ts","sourceRoot":"","sources":["../../src/wire-02-extensions/schema-map.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAe7B,qDAAqD;AACrD,eAAO,MAAM,oBAAoB,sFAAkC,CAAC"}
@@ -0,0 +1,192 @@
1
+ /**
2
+ * Wire 0.2 Shared Validator Schemas
3
+ *
4
+ * Protocol-grade Zod validators for common field patterns reused across
5
+ * multiple extension groups. Consolidated to prevent drift, improve interop,
6
+ * and keep Layer 1 clean.
7
+ *
8
+ * All validators are pure Zod schemas with zero I/O.
9
+ *
10
+ * @see HASH.pattern from @peac/kernel for SHA-256 digest grammar
11
+ * @see PolicyBlockSchema.uri for HTTPS URI hint pattern origin
12
+ */
13
+ import { z } from 'zod';
14
+ /**
15
+ * Validates a SHA-256 digest string in the canonical PEAC format.
16
+ *
17
+ * Format: `sha256:<64 lowercase hex chars>`
18
+ * Max length: 71 chars ("sha256:" = 7 chars + 64 hex chars = 71 total)
19
+ *
20
+ * Reuses `HASH.pattern` from `@peac/kernel` (same regex used in
21
+ * `PolicyBlockSchema.digest` and `ReceiptRefSchema`).
22
+ *
23
+ * INTEROPERABILITY NOTE: This is a PEAC-internal self-describing digest
24
+ * string grammar. It is NOT the same as:
25
+ * - RFC 9530 `Content-Digest` / `Repr-Digest`, which use structured
26
+ * HTTP fields with base64 encoding (e.g., `sha-256=:base64:`)
27
+ * - RFC 9421 HTTP Message Signatures digest components
28
+ * PEAC digest strings are used within JWS payloads and extension fields,
29
+ * not as HTTP headers. When bridging to HTTP digest headers, adapters
30
+ * (Layer 4+) must convert between formats.
31
+ */
32
+ export declare const Sha256DigestSchema: z.ZodString;
33
+ /**
34
+ * Validates an HTTPS URI hint field.
35
+ *
36
+ * Security hardening beyond basic URL validation:
37
+ * - MUST be https:// scheme (rejects http, ftp, data, javascript, file)
38
+ * - MUST NOT contain embedded credentials (userinfo@)
39
+ * - MUST NOT contain fragment identifiers (#)
40
+ * - MUST NOT contain ASCII control characters (U+0000-U+001F, U+007F)
41
+ * - Max 2048 chars (aligned with POLICY_BLOCK.uriMaxLength)
42
+ *
43
+ * These are locator hints only: callers MUST NOT auto-fetch.
44
+ *
45
+ * NORMATIVE: Localhost and private-network hosts (e.g., 10.x, 192.168.x,
46
+ * localhost) are intentionally accepted at Layer 1 (schema). URI hints
47
+ * are metadata, not fetch targets; restricting to public hosts would
48
+ * break enterprise/internal deployments without improving security at
49
+ * this layer. SSRF prevention is enforced by the non-fetch invariant
50
+ *, not by host filtering in schema validation.
51
+ *
52
+ * Test suite covers: IDN/punycode, IPv6 literals, localhost-style
53
+ * hosts, percent-encoded confusion, and parser ambiguity cases.
54
+ */
55
+ export declare const HttpsUriHintSchema: z.ZodString;
56
+ /**
57
+ * ISO 8601 duration component descriptor.
58
+ */
59
+ interface DurationComponents {
60
+ years: number;
61
+ months: number;
62
+ weeks: number;
63
+ days: number;
64
+ hours: number;
65
+ minutes: number;
66
+ seconds: number;
67
+ }
68
+ /**
69
+ * Parse an ISO 8601 duration string into components.
70
+ *
71
+ * Enforces:
72
+ * - No duplicate designators (P1Y2Y rejected)
73
+ * - Canonical component ordering (P1D1Y rejected; must be P1Y1D)
74
+ * - Weeks cannot be combined with other date components (ISO 8601)
75
+ * - At least one component must be present (bare P rejected)
76
+ * - At least one time component after T (bare PT rejected)
77
+ * - Zero-value durations are accepted (P0D, PT0S are valid ISO 8601)
78
+ *
79
+ * Zero durations: P0D and PT0S are valid per ISO 8601. The spec says
80
+ * "a zero duration" is representable. Consumers decide if a zero
81
+ * duration is semantically meaningful for their use case.
82
+ *
83
+ * @param value - String to parse
84
+ * @returns Parsed components, or null if invalid
85
+ */
86
+ export declare function parseIso8601Duration(value: string): DurationComponents | null;
87
+ /**
88
+ * Validates an ISO 8601 duration string.
89
+ *
90
+ * Parser-grade strict validation:
91
+ * - Rejects bare P, bare PT
92
+ * - Rejects duplicate designators (P1Y2Y)
93
+ * - Enforces canonical component ordering (P1D1Y rejected)
94
+ * - Rejects mixed weeks and other date components
95
+ * - Accepts zero-value durations (P0D, PT0S are valid ISO 8601)
96
+ * - Only non-negative integer components (no decimals, no negatives)
97
+ *
98
+ * Examples:
99
+ * Valid: "P30D", "P1Y", "P1Y6M", "PT1H30M", "P1W", "P0D", "PT0S"
100
+ * Invalid: "P", "PT", "30D", "", "P1D1Y", "P1Y2Y", "P1WD3", "P-1D"
101
+ */
102
+ export declare const Iso8601DurationSchema: z.ZodString;
103
+ /**
104
+ * Validates a structurally valid ISO 8601 date string (YYYY-MM-DD).
105
+ *
106
+ * Structural validation only: checks 4-digit year, 2-digit month 01-12,
107
+ * 2-digit day 01-31. Does NOT validate calendar correctness (e.g.,
108
+ * Feb 30 or Jun 31 would pass structural check). Calendar validation
109
+ * is left to the application layer since this is an evidence record,
110
+ * not a scheduling system.
111
+ *
112
+ * Named "StructuralDate" to avoid implying full calendar validation.
113
+ */
114
+ export declare const Iso8601DateStringSchema: z.ZodString;
115
+ /**
116
+ * @deprecated Use Iso8601DateStringSchema. Alias preserved for backward compat.
117
+ */
118
+ export declare const Iso8601DateSchema: z.ZodString;
119
+ /**
120
+ * Validates an ISO 8601 datetime string with timezone offset.
121
+ *
122
+ * Uses Zod 4 top-level `z.iso.datetime({ offset: true })` (preferred
123
+ * over the deprecated method-style `z.string().datetime()`).
124
+ *
125
+ * This is NOT strictly RFC 3339: it accepts minute-precision timestamps
126
+ * (e.g., `2026-03-14T12:00+05:30` without seconds), which ISO 8601
127
+ * allows but RFC 3339 does not. Use Rfc3339DateTimeSchema for strict
128
+ * RFC 3339 compliance.
129
+ *
130
+ * Consistent with Wire 0.2 `occurred_at` field validation semantics.
131
+ */
132
+ export declare const Iso8601OffsetDateTimeSchema: z.ZodISODateTime;
133
+ /**
134
+ * Validates a datetime string against a practical strict RFC 3339 profile.
135
+ *
136
+ * Enforces the key RFC 3339 Section 5.6 constraints:
137
+ * - Timezone offset always present (Z or +/-HH:MM)
138
+ * - Seconds always present (minute-only timestamps rejected)
139
+ * - Fractional seconds optional (after the seconds component)
140
+ * - No local timestamps
141
+ *
142
+ * This is a practical strict profile, not a proven ABNF implementation.
143
+ * It uses `z.iso.datetime({ offset: true })` as the base (which handles
144
+ * most RFC 3339 grammar) plus a seconds-presence refine. Edge cases
145
+ * like leap seconds or two-digit year forms are not explicitly tested.
146
+ *
147
+ * @see https://www.rfc-editor.org/rfc/rfc3339#section-5.6
148
+ */
149
+ export declare const Rfc3339DateTimeSchema: z.ZodISODateTime;
150
+ /**
151
+ * @deprecated Use Iso8601OffsetDateTimeSchema or Rfc3339DateTimeSchema.
152
+ * This alias points to Iso8601OffsetDateTimeSchema (which accepts
153
+ * minute-precision and is therefore NOT strictly RFC 3339). Preserved
154
+ * for backward compatibility only. Remove-not-before: v0.13.0.
155
+ */
156
+ export declare const Rfc3339TimestampSchema: z.ZodISODateTime;
157
+ /**
158
+ * SPDX License Expression validator: documented structural subset.
159
+ *
160
+ * This is a structural subset validator for v0.12.2, NOT full SPDX 3.0.1
161
+ * support. It validates expression grammar without checking license IDs
162
+ * against the SPDX license list.
163
+ *
164
+ * Supported subset:
165
+ * - Simple license IDs: MIT, Apache-2.0, GPL-3.0-only
166
+ * - LicenseRef custom references: LicenseRef-custom
167
+ * - Or-later suffix: GPL-2.0+
168
+ * - Compound expressions: MIT AND Apache-2.0, MIT OR GPL-2.0-only
169
+ * - Exception clauses: Apache-2.0 WITH Classpath-exception-2.0
170
+ * - Parenthesized sub-expressions: (MIT OR Apache-2.0) AND GPL-3.0-only
171
+ *
172
+ * NOT supported (deferred to attribution extension PR, v0.12.2 PR 4):
173
+ * - DocumentRef-*: prefixes (rare in practice; not seen in npm/PyPI/crates.io)
174
+ *
175
+ * @see https://spdx.github.io/spdx-spec/v3.0.1/annexes/spdx-license-expressions/
176
+ */
177
+ declare function isValidSpdxSubsetExpression(expr: string): boolean;
178
+ /**
179
+ * Validates an SPDX license expression (documented structural subset).
180
+ *
181
+ * Uses a recursive-descent parser for the supported grammar subset.
182
+ * Does NOT validate against the SPDX license list (structure only).
183
+ * Does NOT support DocumentRef-* prefixes (deferred).
184
+ *
185
+ * @see isValidSpdxSubsetExpression for the supported grammar
186
+ */
187
+ export declare const SpdxExpressionSchema: z.ZodString;
188
+ /** @internal Exported for testing only */
189
+ export { parseIso8601Duration as _parseIso8601Duration };
190
+ /** @internal Exported for testing only */
191
+ export { isValidSpdxSubsetExpression as _isValidSpdxExpression };
192
+ //# sourceMappingURL=shared-validators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-validators.d.ts","sourceRoot":"","sources":["../../src/wire-02-extensions/shared-validators.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,kBAAkB,aAGqD,CAAC;AAYrF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,kBAAkB,aAgC5B,CAAC;AAMJ;;GAEG;AACH,UAAU,kBAAkB;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAcD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,kBAAkB,GAAG,IAAI,CAwH7E;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,qBAAqB,aAM9B,CAAC;AAML;;;;;;;;;;GAUG;AACH,eAAO,MAAM,uBAAuB,aAKhC,CAAC;AAEL;;GAEG;AACH,eAAO,MAAM,iBAAiB,aAA0B,CAAC;AAMzD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,2BAA2B,kBAAmC,CAAC;AAa5E;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,qBAAqB,kBAI9B,CAAC;AAEL;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,kBAA8B,CAAC;AAMlE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,iBAAS,2BAA2B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAgH1D;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,aAG/B,CAAC;AAMH,0CAA0C;AAC1C,OAAO,EAAE,oBAAoB,IAAI,qBAAqB,EAAE,CAAC;AAEzD,0CAA0C;AAC1C,OAAO,EAAE,2BAA2B,IAAI,sBAAsB,EAAE,CAAC"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Wire 0.2 Extension Validation (envelope-level superRefine helper)
3
+ *
4
+ * Validates the extensions record inside Wire02ClaimsSchema.superRefine():
5
+ * 1. Extension key grammar validation
6
+ * 2. Recursive plain-JSON-value guard (rejects non-JSON-safe values)
7
+ * 3. Known extension group schema validation
8
+ * 4. Byte-budget enforcement
9
+ *
10
+ * NORMATIVE: Extension group values MUST be plain JSON values all the
11
+ * way down (objects, arrays, strings, finite numbers, booleans, null).
12
+ * Arbitrary JavaScript objects (functions, Symbols, Dates, BigInt,
13
+ * objects with toJSON(), circular references, non-finite numbers, etc.)
14
+ * are not a supported input class and are rejected at the validation
15
+ * boundary via E_EXTENSION_NON_JSON_VALUE. This ensures cross-language
16
+ * portability and reproducible byte-budget measurement.
17
+ *
18
+ * MEASUREMENT BASIS: Byte budgets are measured as the UTF-8 byte length
19
+ * of ECMAScript JSON.stringify() output on plain JSON data. This is
20
+ * explicitly ECMAScript-defined, not language-neutral canonical JSON.
21
+ * Equivalent objects with different member order can yield different
22
+ * byte counts; if cross-language reproducibility is needed in the
23
+ * future, a canonical JSON profile (e.g., JCS / RFC 8785) can be
24
+ * adopted via a future DD without changing the budget constants.
25
+ * See EXTENSION_BUDGET in @peac/kernel for the full specification.
26
+ *
27
+ * Schema does NOT emit warnings (unknown_extension_preserved belongs
28
+ * in @peac/protocol.verifyLocal(), Layer 3).
29
+ *
30
+ * Layer 1 (@peac/schema): pure Zod validation, zero I/O.
31
+ */
32
+ import { z } from 'zod';
33
+ /**
34
+ * Check whether a value is a plain JSON value all the way down.
35
+ *
36
+ * This is the public entry point for the recursive guard. It initializes
37
+ * the depth counter and circular-reference detection set.
38
+ *
39
+ * @param value - Value to check
40
+ * @returns true if the entire value tree is plain JSON
41
+ */
42
+ declare function isPlainJsonValue(value: unknown): boolean;
43
+ /**
44
+ * Validate extensions record in Wire02ClaimsSchema.superRefine().
45
+ *
46
+ * Steps:
47
+ * 1. Validate extension key grammar
48
+ * 2. Recursive guard: reject non-plain-JSON values (E_EXTENSION_NON_JSON_VALUE)
49
+ * 3. Validate known extension groups against their Zod schemas
50
+ * 4. Unconditional byte-budget enforcement
51
+ *
52
+ * @param extensions - The extensions record from Wire 0.2 claims
53
+ * @param ctx - Zod refinement context
54
+ */
55
+ export declare function validateKnownExtensions(extensions: Record<string, unknown> | undefined, ctx: z.RefinementCtx): void;
56
+ export { isPlainJsonValue as _isPlainJsonValue };
57
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/wire-02-extensions/validation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAiHxB;;;;;;;;GAQG;AACH,iBAAS,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAEjD;AAMD;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC/C,GAAG,EAAE,CAAC,CAAC,aAAa,GACnB,IAAI,CA+DN;AAGD,OAAO,EAAE,gBAAgB,IAAI,iBAAiB,EAAE,CAAC"}