@peac/protocol 0.13.3 → 0.14.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/dist/_internal/record-core/bounded-validator.d.ts +65 -29
- package/dist/_internal/record-core/bounded-validator.d.ts.map +1 -1
- package/dist/_internal/record-core/validation-gate.d.ts +102 -0
- package/dist/_internal/record-core/validation-gate.d.ts.map +1 -0
- package/dist/_internal/record-core/validators/iat-not-yet-valid.d.ts +29 -0
- package/dist/_internal/record-core/validators/iat-not-yet-valid.d.ts.map +1 -0
- package/dist/_internal/record-core/validators/index.d.ts +7 -0
- package/dist/_internal/record-core/validators/index.d.ts.map +1 -1
- package/dist/_internal/record-core/validators/jose-typ-strictness.d.ts +39 -0
- package/dist/_internal/record-core/validators/jose-typ-strictness.d.ts.map +1 -0
- package/dist/_internal/record-core/validators/policy-binding.d.ts +33 -0
- package/dist/_internal/record-core/validators/policy-binding.d.ts.map +1 -0
- package/dist/_internal/record-core/validators/schema-parse.d.ts +72 -0
- package/dist/_internal/record-core/validators/schema-parse.d.ts.map +1 -0
- package/dist/_internal/record-core/validators/signature.d.ts +31 -0
- package/dist/_internal/record-core/validators/signature.d.ts.map +1 -0
- package/dist/_internal/record-core/validators/type-extension-enforcement.d.ts +42 -0
- package/dist/_internal/record-core/validators/type-extension-enforcement.d.ts.map +1 -0
- package/dist/_internal/record-core/validators/unknown-extension-grammar.d.ts +39 -0
- package/dist/_internal/record-core/validators/unknown-extension-grammar.d.ts.map +1 -0
- package/dist/_internal/test-helpers/candidate-runner.d.ts +52 -0
- package/dist/_internal/test-helpers/candidate-runner.d.ts.map +1 -0
- package/dist/index.cjs +360 -59
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +360 -59
- package/dist/index.mjs.map +1 -1
- package/dist/issue.d.ts.map +1 -1
- package/dist/verify-local.cjs +285 -18
- package/dist/verify-local.cjs.map +1 -1
- package/dist/verify-local.d.ts.map +1 -1
- package/dist/verify-local.mjs +285 -18
- package/dist/verify-local.mjs.map +1 -1
- package/package.json +4 -4
|
@@ -1,38 +1,42 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Canonical-composed shadow validation: composition aggregator.
|
|
3
3
|
*
|
|
4
|
-
* INTERNAL ONLY. Composes
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* canonical-
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
4
|
+
* INTERNAL ONLY. Composes layer validators into a single aggregated
|
|
5
|
+
* result. Each layer either delegates to a canonical helper from
|
|
6
|
+
* `@peac/schema` / `@peac/crypto` / `@peac/protocol` (canonical-
|
|
7
|
+
* composed wrapper pattern) or mirrors a canonical inline check
|
|
8
|
+
* verbatim. The canonical-vs-candidate differential test asserts
|
|
9
|
+
* byte-equality of the candidate verdict with the canonical verdict
|
|
10
|
+
* on every eligible fixture; any divergence indicates a defect in
|
|
11
|
+
* the projection logic.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
13
|
+
* Always-on layers (run on every input):
|
|
14
|
+
* - kernel-constraints (depth / array / keys / string / nodes)
|
|
15
|
+
* - issuer-form (canonical iss)
|
|
16
|
+
* - type-extension-mapping (warnings only)
|
|
17
|
+
* - extension-byte-budget
|
|
18
|
+
* - unknown-extension-grammar (warnings only)
|
|
18
19
|
*
|
|
19
|
-
*
|
|
20
|
-
* -
|
|
21
|
-
*
|
|
22
|
-
* -
|
|
23
|
-
*
|
|
24
|
-
* - iat-not-yet-valid
|
|
25
|
-
*
|
|
26
|
-
* -
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
20
|
+
* Optional-input layers (skip when their inputs are absent):
|
|
21
|
+
* - jose-header-hardening (header)
|
|
22
|
+
* - temporal occurred_at skew (evidence kind)
|
|
23
|
+
* - schema-parse (fullClaims)
|
|
24
|
+
* - jose-typ-strictness (header + strictness)
|
|
25
|
+
* - iat-not-yet-valid (maxClockSkew)
|
|
26
|
+
* - policy-binding (receiptPolicyDigest + localPolicyDigest)
|
|
27
|
+
* - type-extension-enforcement (strictness)
|
|
28
|
+
*
|
|
29
|
+
* Out of scope:
|
|
30
|
+
* - signature verification (the standalone `validateSignatureInternal`
|
|
31
|
+
* export is async and is not composed here; callers that need it
|
|
32
|
+
* invoke it directly with serialized + publicKey)
|
|
31
33
|
* - any control-plane behavior (issuer resolver, JWKS fetch, etc.)
|
|
32
34
|
*
|
|
33
|
-
* Public-facing wording for this module: "
|
|
34
|
-
*
|
|
35
|
+
* Public-facing wording for this module: "canonical-composed shadow
|
|
36
|
+
* validation" or "observational equivalence harness". Never
|
|
37
|
+
* "complete validator", "primary validator", or "divergent validator".
|
|
35
38
|
*/
|
|
39
|
+
import { type Strictness } from './validators/index.js';
|
|
36
40
|
/** Minimal claims shape required by the bounded subset. */
|
|
37
41
|
export interface BoundedClaimsInput {
|
|
38
42
|
readonly kind: string;
|
|
@@ -50,13 +54,45 @@ export interface BoundedValidationInput {
|
|
|
50
54
|
readonly header?: BoundedHeaderInput;
|
|
51
55
|
/** Fixed Unix-second clock for temporal evaluation; required. */
|
|
52
56
|
readonly now: number;
|
|
57
|
+
/**
|
|
58
|
+
* Strictness profile for layers that promote warnings to errors
|
|
59
|
+
* under `'strict'` mode. When omitted, layers that consume
|
|
60
|
+
* strictness skip (they do not run). Mirrors the canonical
|
|
61
|
+
* `verifyLocal({ strictness })` option.
|
|
62
|
+
*/
|
|
63
|
+
readonly strictness?: Strictness;
|
|
64
|
+
/**
|
|
65
|
+
* Maximum permitted clock skew in seconds for the iat-not-yet-valid
|
|
66
|
+
* check. When omitted, the iat layer skips. Mirrors
|
|
67
|
+
* `verifyLocal({ maxClockSkew })`; canonical default is 300.
|
|
68
|
+
*/
|
|
69
|
+
readonly maxClockSkew?: number;
|
|
70
|
+
/**
|
|
71
|
+
* Receipt-side policy digest (`claims.policy.digest`). Used together
|
|
72
|
+
* with `localPolicyDigest` by the policy-binding layer. Either
|
|
73
|
+
* absent skips the layer.
|
|
74
|
+
*/
|
|
75
|
+
readonly receiptPolicyDigest?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Caller-supplied policy digest. Used together with
|
|
78
|
+
* `receiptPolicyDigest`. Either absent skips the layer.
|
|
79
|
+
*/
|
|
80
|
+
readonly localPolicyDigest?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Full receipt-claims object for the schema-parse layer. When
|
|
83
|
+
* omitted, the schema-parse layer falls back to running on the
|
|
84
|
+
* minimal `BoundedClaimsInput` projection (which may not surface
|
|
85
|
+
* field-level parse errors that depend on optional fields outside
|
|
86
|
+
* the bounded subset).
|
|
87
|
+
*/
|
|
88
|
+
readonly fullClaims?: Record<string, unknown>;
|
|
53
89
|
}
|
|
54
90
|
/**
|
|
55
91
|
* Layer tag identifies which underlying validator emitted each entry.
|
|
56
92
|
* Useful for downstream filtering (e.g., a future shadow-mode reporter
|
|
57
93
|
* that ignores warning-class entries from one layer but not another).
|
|
58
94
|
*/
|
|
59
|
-
export type BoundedLayer = 'kernel-constraints' | 'type-extension-mapping' | 'jose-header-hardening' | 'issuer-form' | 'temporal' | 'extension-budget';
|
|
95
|
+
export type BoundedLayer = 'kernel-constraints' | 'type-extension-mapping' | 'jose-header-hardening' | 'issuer-form' | 'temporal' | 'extension-budget' | 'schema-parse' | 'jose-typ-strictness' | 'iat-not-yet-valid' | 'policy-binding' | 'unknown-extension-grammar' | 'type-extension-enforcement';
|
|
60
96
|
export interface BoundedViolation {
|
|
61
97
|
readonly layer: BoundedLayer;
|
|
62
98
|
readonly code: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bounded-validator.d.ts","sourceRoot":"","sources":["../../../src/_internal/record-core/bounded-validator.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"bounded-validator.d.ts","sourceRoot":"","sources":["../../../src/_internal/record-core/bounded-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,EAcL,KAAK,UAAU,EAKhB,MAAM,uBAAuB,CAAC;AAE/B,2DAA2D;AAC3D,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/C;AAED,4DAA4D;AAC5D,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;AAErE,0DAA0D;AAC1D,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;IACpC,QAAQ,CAAC,MAAM,CAAC,EAAE,kBAAkB,CAAC;IACrC,iEAAiE;IACjE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC;IACjC;;;;OAIG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IACtC;;;OAGG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IACpC;;;;;;OAMG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/C;AAED;;;;GAIG;AACH,MAAM,MAAM,YAAY,GACpB,oBAAoB,GACpB,wBAAwB,GACxB,uBAAuB,GACvB,aAAa,GACb,UAAU,GACV,kBAAkB,GAClB,cAAc,GACd,qBAAqB,GACrB,mBAAmB,GACnB,gBAAgB,GAChB,2BAA2B,GAC3B,4BAA4B,CAAC;AAEjC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,uBAAuB;IACtC,wDAAwD;IACxD,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACjD,QAAQ,CAAC,QAAQ,EAAE,SAAS,cAAc,EAAE,CAAC;CAC9C;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,sBAAsB,GAAG,uBAAuB,CAsKhG"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Production-facing bounded validation gate.
|
|
3
|
+
*
|
|
4
|
+
* INTERNAL ONLY. Not re-exported from `packages/protocol/src/index.ts`.
|
|
5
|
+
*
|
|
6
|
+
* The gate is the only production wrapper for the bounded validation
|
|
7
|
+
* path. The pre-existing `runBoundedValidatorShadow` from
|
|
8
|
+
* `bounded-validator.ts` remains the entry point for shadow / corpus
|
|
9
|
+
* / parity-harness consumers and is not the primary admission path
|
|
10
|
+
* for the protocol entry points; the production-wrapper boundary is
|
|
11
|
+
* enforced by `tests/tooling/production-gate-boundary.test.ts`.
|
|
12
|
+
*
|
|
13
|
+
* The gate is entrypoint-aware: callers identify themselves with a
|
|
14
|
+
* `surface` discriminator, and the gate applies a per-surface
|
|
15
|
+
* production projection allowlist. Layers in the bounded validator's
|
|
16
|
+
* broader composition that fall outside the allowlist for a given
|
|
17
|
+
* surface stay available to shadow / parity tests through
|
|
18
|
+
* `runBoundedValidatorShadow` but are not surfaced as production
|
|
19
|
+
* failure or production warning here.
|
|
20
|
+
*
|
|
21
|
+
* Allowlist for surface 'issueWire02':
|
|
22
|
+
* - schema-parse only.
|
|
23
|
+
*
|
|
24
|
+
* Allowlist for surface 'verifyLocal':
|
|
25
|
+
* - kernel-constraints (via canonical `validateKernelConstraints`).
|
|
26
|
+
* - schema-parse (via the extended `validateSchemaParseInternal`).
|
|
27
|
+
*
|
|
28
|
+
* Out of scope here (kept inline-canonical on both branches by the
|
|
29
|
+
* caller): caller-option-bearing checks (issuer mismatch, subjectUri
|
|
30
|
+
* mismatch, policyDigest format), strictness routing for missing typ,
|
|
31
|
+
* iat-not-yet-valid, occurred_at temporal, type-extension warnings,
|
|
32
|
+
* type-extension enforcement, policy-binding compute, bindings
|
|
33
|
+
* construction, sortWarnings.
|
|
34
|
+
*
|
|
35
|
+
* The canonical materializer (claim encoding, JWS signing, JWS
|
|
36
|
+
* decoding, result-shape construction) is shared between the
|
|
37
|
+
* bounded-default and rollback branches and is not touched by the
|
|
38
|
+
* gate.
|
|
39
|
+
*/
|
|
40
|
+
import type { VerificationWarning } from '@peac/kernel';
|
|
41
|
+
import type { Wire02Claims } from '@peac/schema';
|
|
42
|
+
/**
|
|
43
|
+
* Discriminator identifying which protocol entry point invoked the
|
|
44
|
+
* gate. Drives the production projection allowlist. Adding a third
|
|
45
|
+
* surface requires a deliberate plan amendment, not an unannounced
|
|
46
|
+
* source change.
|
|
47
|
+
*/
|
|
48
|
+
export type GateSurface = 'issueWire02' | 'verifyLocal';
|
|
49
|
+
/** Sanitized parse-issue projection surfaced on rejection. */
|
|
50
|
+
export interface SanitizedParseIssue {
|
|
51
|
+
readonly path: string;
|
|
52
|
+
readonly message: string;
|
|
53
|
+
}
|
|
54
|
+
/** Parsed-claims projection surfaced on `verifyLocal` acceptance. */
|
|
55
|
+
export interface ValidationGateParsed {
|
|
56
|
+
readonly wireVersion: '0.2';
|
|
57
|
+
readonly claims: Wire02Claims;
|
|
58
|
+
readonly parserWarnings: readonly VerificationWarning[];
|
|
59
|
+
}
|
|
60
|
+
/** Failure-detail projection. Smaller than the bounded layer set. */
|
|
61
|
+
export interface ValidationGateFailureDetails {
|
|
62
|
+
readonly parse_code?: string;
|
|
63
|
+
readonly issues?: readonly SanitizedParseIssue[];
|
|
64
|
+
}
|
|
65
|
+
/** Successful gate result. */
|
|
66
|
+
export interface ValidationGateSuccess {
|
|
67
|
+
readonly ok: true;
|
|
68
|
+
readonly parsed?: ValidationGateParsed;
|
|
69
|
+
}
|
|
70
|
+
/** Failed gate result. */
|
|
71
|
+
export interface ValidationGateFailure {
|
|
72
|
+
readonly ok: false;
|
|
73
|
+
readonly code: string;
|
|
74
|
+
readonly message: string;
|
|
75
|
+
readonly details?: ValidationGateFailureDetails;
|
|
76
|
+
}
|
|
77
|
+
export type ValidationGateResult = ValidationGateSuccess | ValidationGateFailure;
|
|
78
|
+
/** Inputs to the gate. Only `surface` and `payload` are required. */
|
|
79
|
+
export interface ValidationGateInput {
|
|
80
|
+
readonly surface: GateSurface;
|
|
81
|
+
/**
|
|
82
|
+
* Full claims object. For surface 'issueWire02' this is the just-
|
|
83
|
+
* constructed `Wire02Claims` cast to a plain record (the same
|
|
84
|
+
* object that today flows through `Wire02ClaimsSchema.safeParse`).
|
|
85
|
+
* For surface 'verifyLocal' this is the decoded JWS payload (the
|
|
86
|
+
* same object that today flows through `validateKernelConstraints`
|
|
87
|
+
* and `parseReceiptClaims`).
|
|
88
|
+
*/
|
|
89
|
+
readonly payload: unknown;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Run the production projection of the bounded validation path.
|
|
93
|
+
*
|
|
94
|
+
* Behavior is byte-equivalent to the inline canonical sequences at
|
|
95
|
+
* `issue.ts` and `verify-local.ts` for every input on the covered
|
|
96
|
+
* runtime matrix. Any cross-branch divergence on JWS bytes, result
|
|
97
|
+
* shape, error code, warning order, thrown error class, success /
|
|
98
|
+
* failure classification, or observable default behavior is a
|
|
99
|
+
* validation-equivalence regression.
|
|
100
|
+
*/
|
|
101
|
+
export declare function runBoundedValidationGate(input: ValidationGateInput): ValidationGateResult;
|
|
102
|
+
//# sourceMappingURL=validation-gate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation-gate.d.ts","sourceRoot":"","sources":["../../../src/_internal/record-core/validation-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAGH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAGjD;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,aAAa,GAAG,aAAa,CAAC;AAExD,8DAA8D;AAC9D,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,qEAAqE;AACrE,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,WAAW,EAAE,KAAK,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,cAAc,EAAE,SAAS,mBAAmB,EAAE,CAAC;CACzD;AAED,qEAAqE;AACrE,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,mBAAmB,EAAE,CAAC;CAClD;AAED,8BAA8B;AAC9B,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAClB,QAAQ,CAAC,MAAM,CAAC,EAAE,oBAAoB,CAAC;CACxC;AAED,0BAA0B;AAC1B,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,4BAA4B,CAAC;CACjD;AAED,MAAM,MAAM,oBAAoB,GAAG,qBAAqB,GAAG,qBAAqB,CAAC;AAEjF,qEAAqE;AACrE,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B;;;;;;;OAOG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAwBD;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,mBAAmB,GAAG,oBAAoB,CAKzF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bounded internal iat-not-yet-valid validator.
|
|
3
|
+
*
|
|
4
|
+
* INTERNAL ONLY. Parity-observed counterpart of the inline iat-not-yet-valid
|
|
5
|
+
* check in `verify-local.ts` (`if (claims.iat > now + maxClockSkew) ...`).
|
|
6
|
+
* Both implementations consume the same `iat`, `now`, and `maxClockSkew`
|
|
7
|
+
* inputs and apply the same comparison; behavioral parity is proven
|
|
8
|
+
* byte-equal by the parity tests.
|
|
9
|
+
*
|
|
10
|
+
* Existing canonical iat handling in `verify-local.ts` remains canonical.
|
|
11
|
+
* This module is observational only; it is not re-exported from
|
|
12
|
+
* `packages/protocol/src/index.ts` and is not wired into the public
|
|
13
|
+
* runtime path.
|
|
14
|
+
*
|
|
15
|
+
* SCOPE:
|
|
16
|
+
* - Reject when `iat > now + maxClockSkew` (claim issued too far in the future).
|
|
17
|
+
* - Accept when `iat <= now + maxClockSkew`.
|
|
18
|
+
* - Never reads `Date.now()`; the caller injects `now` for determinism.
|
|
19
|
+
*
|
|
20
|
+
* Out of scope:
|
|
21
|
+
* - `exp` / `nbf` checks (Wire 0.2 records do not expire and have no nbf).
|
|
22
|
+
* - `occurred_at` skew (handled by `temporal.ts`).
|
|
23
|
+
*/
|
|
24
|
+
export interface IatNotYetValidResult {
|
|
25
|
+
readonly accepted: boolean;
|
|
26
|
+
readonly errorCode?: string;
|
|
27
|
+
}
|
|
28
|
+
export declare function validateIatNotYetValidInternal(iat: number, now: number, maxClockSkew: number): IatNotYetValidResult;
|
|
29
|
+
//# sourceMappingURL=iat-not-yet-valid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iat-not-yet-valid.d.ts","sourceRoot":"","sources":["../../../../src/_internal/record-core/validators/iat-not-yet-valid.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAQD,wBAAgB,8BAA8B,CAC5C,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,MAAM,GACnB,oBAAoB,CAGtB"}
|
|
@@ -10,4 +10,11 @@ export { validateJoseHardeningInternal, type JoseHardeningInput, type JoseHarden
|
|
|
10
10
|
export { validateIssuerFormInternal, type IssuerFormResult } from './issuer-form.js';
|
|
11
11
|
export { validateTemporalInternal, type TemporalResult, type TemporalWarning } from './temporal.js';
|
|
12
12
|
export { validateExtensionBudgetInternal, type ExtensionBudgetResult, type ExtensionBudgetViolation, } from './extension-budget.js';
|
|
13
|
+
export { validateSchemaParseInternal, type SchemaParseResult } from './schema-parse.js';
|
|
14
|
+
export { validateJoseTypStrictnessInternal, type JoseTypStrictnessResult, type JoseTypStrictnessWarning, type Strictness, } from './jose-typ-strictness.js';
|
|
15
|
+
export { validateIatNotYetValidInternal, type IatNotYetValidResult } from './iat-not-yet-valid.js';
|
|
16
|
+
export { validatePolicyBindingInternal, type PolicyBindingResult } from './policy-binding.js';
|
|
17
|
+
export { validateUnknownExtensionGrammarInternal, type UnknownExtensionGrammarResult, type UnknownExtensionWarning, } from './unknown-extension-grammar.js';
|
|
18
|
+
export { validateTypeExtensionEnforcementInternal, type TypeExtensionEnforcementResult, type TypeExtensionEnforcementWarning, } from './type-extension-enforcement.js';
|
|
19
|
+
export { validateSignatureInternal, type SignatureResult } from './signature.js';
|
|
13
20
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/_internal/record-core/validators/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC5E,OAAO,EAAE,iCAAiC,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,EACL,oCAAoC,EACpC,KAAK,yBAAyB,EAC9B,KAAK,2BAA2B,GACjC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,6BAA6B,EAC7B,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,GACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,0BAA0B,EAAE,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACrF,OAAO,EAAE,wBAAwB,EAAE,KAAK,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AACpG,OAAO,EACL,+BAA+B,EAC/B,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,GAC9B,MAAM,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/_internal/record-core/validators/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC5E,OAAO,EAAE,iCAAiC,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,EACL,oCAAoC,EACpC,KAAK,yBAAyB,EAC9B,KAAK,2BAA2B,GACjC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,6BAA6B,EAC7B,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,GACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,0BAA0B,EAAE,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACrF,OAAO,EAAE,wBAAwB,EAAE,KAAK,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AACpG,OAAO,EACL,+BAA+B,EAC/B,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,GAC9B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,2BAA2B,EAAE,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACxF,OAAO,EACL,iCAAiC,EACjC,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,UAAU,GAChB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,8BAA8B,EAAE,KAAK,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnG,OAAO,EAAE,6BAA6B,EAAE,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC9F,OAAO,EACL,uCAAuC,EACvC,KAAK,6BAA6B,EAClC,KAAK,uBAAuB,GAC7B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,wCAAwC,EACxC,KAAK,8BAA8B,EACnC,KAAK,+BAA+B,GACrC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,yBAAyB,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bounded internal JOSE typ-strictness validator.
|
|
3
|
+
*
|
|
4
|
+
* INTERNAL ONLY. Parity-observed counterpart of the typ-strictness
|
|
5
|
+
* routing in `verify-local.ts` (the block that rejects a missing typ
|
|
6
|
+
* under `'strict'` mode and surfaces a `typ_missing` warning under
|
|
7
|
+
* `'interop'` mode). Both implementations consume the same protected-
|
|
8
|
+
* header `typ` value plus a `strictness` parameter and apply the same
|
|
9
|
+
* accept/reject/warning rules.
|
|
10
|
+
*
|
|
11
|
+
* Existing canonical strictness routing in `verify-local.ts` remains
|
|
12
|
+
* canonical. This module is observational only; not re-exported and
|
|
13
|
+
* not wired into the public runtime path.
|
|
14
|
+
*
|
|
15
|
+
* SCOPE:
|
|
16
|
+
* - typ present (any string) -> accepted, no warning.
|
|
17
|
+
* - typ absent (undefined or non-string) and strictness === 'strict'
|
|
18
|
+
* -> rejected with E_INVALID_FORMAT.
|
|
19
|
+
* - typ absent and strictness === 'interop' -> accepted with
|
|
20
|
+
* typ_missing warning.
|
|
21
|
+
*
|
|
22
|
+
* Out of scope:
|
|
23
|
+
* - typ value validation (`'interaction-record+jwt'` enforcement lives
|
|
24
|
+
* in `@peac/crypto.validateWire02Header` / the JOSE-hardening layer).
|
|
25
|
+
* - alg / kid / crit / b64 / zip checks (handled by `jose-hardening.ts`).
|
|
26
|
+
*/
|
|
27
|
+
export type Strictness = 'strict' | 'interop';
|
|
28
|
+
export interface JoseTypStrictnessWarning {
|
|
29
|
+
readonly code: string;
|
|
30
|
+
}
|
|
31
|
+
export type JoseTypStrictnessResult = {
|
|
32
|
+
readonly accepted: true;
|
|
33
|
+
readonly warnings?: readonly JoseTypStrictnessWarning[];
|
|
34
|
+
} | {
|
|
35
|
+
readonly accepted: false;
|
|
36
|
+
readonly errorCode: string;
|
|
37
|
+
};
|
|
38
|
+
export declare function validateJoseTypStrictnessInternal(typ: unknown, strictness: Strictness): JoseTypStrictnessResult;
|
|
39
|
+
//# sourceMappingURL=jose-typ-strictness.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jose-typ-strictness.d.ts","sourceRoot":"","sources":["../../../../src/_internal/record-core/validators/jose-typ-strictness.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE9C,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,MAAM,uBAAuB,GAC/B;IAAE,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,wBAAwB,EAAE,CAAA;CAAE,GACpF;IAAE,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAY7D,wBAAgB,iCAAiC,CAC/C,GAAG,EAAE,OAAO,EACZ,UAAU,EAAE,UAAU,GACrB,uBAAuB,CAKzB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bounded internal policy-binding validator (canonical-composed).
|
|
3
|
+
*
|
|
4
|
+
* INTERNAL ONLY. Thin wrapper around `verifyPolicyBinding` from
|
|
5
|
+
* `@peac/schema`. Surfaces the canonical three-state result
|
|
6
|
+
* (`verified` / `failed` / `unavailable`) projected into the bounded
|
|
7
|
+
* validator's accept/reject contract, where `failed` is the only
|
|
8
|
+
* rejection.
|
|
9
|
+
*
|
|
10
|
+
* This is observational equivalence by construction, not a divergent
|
|
11
|
+
* binding check. Module is observational only; not re-exported from
|
|
12
|
+
* `packages/protocol/src/index.ts` and not wired into the public
|
|
13
|
+
* runtime path.
|
|
14
|
+
*
|
|
15
|
+
* SCOPE:
|
|
16
|
+
* - Both digests present and equal -> accepted (`verified`).
|
|
17
|
+
* - Either digest absent -> accepted (`unavailable`); no policy
|
|
18
|
+
* check is performed when the receipt or caller omits the digest.
|
|
19
|
+
* - Both present but unequal -> rejected with E_POLICY_BINDING_FAILED.
|
|
20
|
+
*
|
|
21
|
+
* Out of scope:
|
|
22
|
+
* - Policy-document fetch and digest computation (lives in
|
|
23
|
+
* `verifyLocal()` / caller responsibility).
|
|
24
|
+
* - Policy URI handling (`policy.uri` is informational only).
|
|
25
|
+
*/
|
|
26
|
+
export interface PolicyBindingResult {
|
|
27
|
+
readonly accepted: boolean;
|
|
28
|
+
readonly errorCode?: string;
|
|
29
|
+
/** 'verified' | 'failed' | 'unavailable'. Surfaced unchanged from canonical. */
|
|
30
|
+
readonly status: 'verified' | 'failed' | 'unavailable';
|
|
31
|
+
}
|
|
32
|
+
export declare function validatePolicyBindingInternal(receiptPolicyDigest: string | undefined, localPolicyDigest: string | undefined): PolicyBindingResult;
|
|
33
|
+
//# sourceMappingURL=policy-binding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy-binding.d.ts","sourceRoot":"","sources":["../../../../src/_internal/record-core/validators/policy-binding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAIH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,gFAAgF;IAChF,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,QAAQ,GAAG,aAAa,CAAC;CACxD;AAED,wBAAgB,6BAA6B,CAC3C,mBAAmB,EAAE,MAAM,GAAG,SAAS,EACvC,iBAAiB,EAAE,MAAM,GAAG,SAAS,GACpC,mBAAmB,CASrB"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bounded internal schema-parse validator.
|
|
3
|
+
*
|
|
4
|
+
* INTERNAL ONLY. Thin wrapper around the canonical
|
|
5
|
+
* `parseReceiptClaims` from `@peac/schema`. Projects the canonical
|
|
6
|
+
* accept/reject signal plus the full canonical projection (parsed
|
|
7
|
+
* claims, parser warnings, canonical error triple) so production
|
|
8
|
+
* callers can reproduce the canonical surface byte-equally without
|
|
9
|
+
* re-invoking `parseReceiptClaims`.
|
|
10
|
+
*
|
|
11
|
+
* Module is internal-only; not re-exported from
|
|
12
|
+
* `packages/protocol/src/index.ts`.
|
|
13
|
+
*
|
|
14
|
+
* SCOPE:
|
|
15
|
+
* - Run `parseReceiptClaims(payload)` and surface its accept/reject.
|
|
16
|
+
* - On acceptance: surface `wireVersion`, parsed `claims`, and
|
|
17
|
+
* parser `warnings` (e.g., `type_unregistered`,
|
|
18
|
+
* `unknown_extension_preserved`). Higher-layer aggregation merges
|
|
19
|
+
* these into the caller's warning array.
|
|
20
|
+
* - On rejection: surface the canonical error triple
|
|
21
|
+
* (`errorCode`, `errorMessage`, `errorIssues`) so callers can
|
|
22
|
+
* project the canonical `details: { parse_code, issues }` and
|
|
23
|
+
* `message: 'Receipt schema validation failed: <message>'`
|
|
24
|
+
* surface byte-equally.
|
|
25
|
+
*/
|
|
26
|
+
import type { ZodError } from 'zod';
|
|
27
|
+
import type { VerificationWarning } from '@peac/kernel';
|
|
28
|
+
import type { Wire02Claims } from '@peac/schema';
|
|
29
|
+
export interface SchemaParseResult {
|
|
30
|
+
readonly accepted: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Canonical parse-error code from `parseReceiptClaims` when the
|
|
33
|
+
* parse rejects. Mirrors `pr.error.code`.
|
|
34
|
+
*/
|
|
35
|
+
readonly errorCode?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Canonical parse-error message from `parseReceiptClaims` when the
|
|
38
|
+
* parse rejects. Mirrors `pr.error.message`. Required for callers
|
|
39
|
+
* that reproduce the canonical surface message
|
|
40
|
+
* `Receipt schema validation failed: <message>` byte-equally.
|
|
41
|
+
*/
|
|
42
|
+
readonly errorMessage?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Canonical parse-error issues from `parseReceiptClaims` when the
|
|
45
|
+
* parse rejects. Mirrors `pr.error.issues`. Callers downstream
|
|
46
|
+
* apply their own bounded sanitization (path-join, length cap)
|
|
47
|
+
* before surfacing on a public verifier-result `details` payload.
|
|
48
|
+
*/
|
|
49
|
+
readonly errorIssues?: ZodError['issues'];
|
|
50
|
+
/**
|
|
51
|
+
* Parsed Wire 0.2 claims when accepted. Internal-only; does not
|
|
52
|
+
* appear on any emitted record or public surface.
|
|
53
|
+
*/
|
|
54
|
+
readonly claims?: Wire02Claims;
|
|
55
|
+
/**
|
|
56
|
+
* Wire version surfaced from `parseReceiptClaims` on acceptance.
|
|
57
|
+
* The bounded surface only admits `'0.2'`; Wire 0.1 acceptance from
|
|
58
|
+
* the canonical parser is rejected at this layer with
|
|
59
|
+
* `E_UNSUPPORTED_WIRE_VERSION` because the bounded composition is
|
|
60
|
+
* keyed on Wire 0.2 claim shapes.
|
|
61
|
+
*/
|
|
62
|
+
readonly wireVersion?: '0.2';
|
|
63
|
+
/**
|
|
64
|
+
* Parser warnings surfaced on acceptance. Mirrors `pr.warnings` for
|
|
65
|
+
* Wire 0.2 acceptance. Callers that aggregate into a single
|
|
66
|
+
* canonical warning array merge this list at the canonical-equivalent
|
|
67
|
+
* flow position before the canonical sort.
|
|
68
|
+
*/
|
|
69
|
+
readonly warnings?: readonly VerificationWarning[];
|
|
70
|
+
}
|
|
71
|
+
export declare function validateSchemaParseInternal(payload: unknown): SchemaParseResult;
|
|
72
|
+
//# sourceMappingURL=schema-parse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-parse.d.ts","sourceRoot":"","sources":["../../../../src/_internal/record-core/validators/schema-parse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;;OAKG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC1C;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC;IAC/B;;;;;;OAMG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC;IAC7B;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,mBAAmB,EAAE,CAAC;CACpD;AAED,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,OAAO,GAAG,iBAAiB,CAuB/E"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bounded internal signature validator (canonical-composed).
|
|
3
|
+
*
|
|
4
|
+
* INTERNAL ONLY. Thin wrapper around `verify` from `@peac/crypto`.
|
|
5
|
+
* Surfaces the canonical Ed25519 signature-verification result
|
|
6
|
+
* projected into the bounded validator's accept/reject contract.
|
|
7
|
+
* The wrapper has no decision logic of its own and never re-implements
|
|
8
|
+
* Ed25519; it always delegates to the canonical signer/verifier.
|
|
9
|
+
*
|
|
10
|
+
* Module is observational only; not re-exported from
|
|
11
|
+
* `packages/protocol/src/index.ts` and not wired into the public
|
|
12
|
+
* runtime path.
|
|
13
|
+
*
|
|
14
|
+
* SCOPE:
|
|
15
|
+
* - Run `verify(serialized, publicKey)` against the supplied compact JWS.
|
|
16
|
+
* - On structural-format failure (CryptoError with a CRYPTO_* code),
|
|
17
|
+
* surface the code unchanged.
|
|
18
|
+
* - On signature mismatch, surface CRYPTO_INVALID_SIGNATURE.
|
|
19
|
+
* - On success, accepted=true with no further claims projection.
|
|
20
|
+
*
|
|
21
|
+
* Out of scope:
|
|
22
|
+
* - JOSE header hardening (handled by `jose-hardening.ts`).
|
|
23
|
+
* - typ strictness routing (handled by `jose-typ-strictness.ts`).
|
|
24
|
+
* - Schema parse on the verified payload (handled by `schema-parse.ts`).
|
|
25
|
+
*/
|
|
26
|
+
export interface SignatureResult {
|
|
27
|
+
readonly accepted: boolean;
|
|
28
|
+
readonly errorCode?: string;
|
|
29
|
+
}
|
|
30
|
+
export declare function validateSignatureInternal(serialized: string, publicKey: Uint8Array): Promise<SignatureResult>;
|
|
31
|
+
//# sourceMappingURL=signature.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signature.d.ts","sourceRoot":"","sources":["../../../../src/_internal/record-core/validators/signature.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAIH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,wBAAsB,yBAAyB,CAC7C,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,UAAU,GACpB,OAAO,CAAC,eAAe,CAAC,CAe1B"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bounded internal type-extension-enforcement validator (canonical-composed).
|
|
3
|
+
*
|
|
4
|
+
* INTERNAL ONLY. Thin wrapper around `checkTypeExtensionMapping` from
|
|
5
|
+
* `@peac/protocol/src/type-extension-check` plus the strictness-mode
|
|
6
|
+
* routing performed by `verifyLocal`. Surfaces the canonical mapping
|
|
7
|
+
* result projected into the bounded validator's accept/reject and
|
|
8
|
+
* warning contract.
|
|
9
|
+
*
|
|
10
|
+
* Distinct from `type-extension-mapping.ts` (warnings-only) in this
|
|
11
|
+
* module's directory: this layer covers the strictness-mode path that
|
|
12
|
+
* promotes `missing` and `mismatch` to hard errors when
|
|
13
|
+
* `strictness === 'strict'`. Both layers consume the same canonical
|
|
14
|
+
* mapping result; they differ only in how they project it.
|
|
15
|
+
*
|
|
16
|
+
* Module is observational only; not re-exported from
|
|
17
|
+
* `packages/protocol/src/index.ts` and not wired into the public
|
|
18
|
+
* runtime path.
|
|
19
|
+
*
|
|
20
|
+
* SCOPE:
|
|
21
|
+
* - `skip` -> accepted, no warning, no error.
|
|
22
|
+
* - `ok` -> accepted, no warning, no error.
|
|
23
|
+
* - `missing` + strict -> rejected with E_EXTENSION_GROUP_REQUIRED.
|
|
24
|
+
* - `mismatch` + strict -> rejected with E_EXTENSION_GROUP_MISMATCH.
|
|
25
|
+
* - `missing` + interop -> accepted with extension_group_missing warning at /type.
|
|
26
|
+
* - `mismatch` + interop -> accepted with extension_group_mismatch warning at /type.
|
|
27
|
+
*/
|
|
28
|
+
import type { Strictness } from './jose-typ-strictness.js';
|
|
29
|
+
export interface TypeExtensionEnforcementWarning {
|
|
30
|
+
readonly code: string;
|
|
31
|
+
readonly pointer: string;
|
|
32
|
+
}
|
|
33
|
+
export type TypeExtensionEnforcementResult = {
|
|
34
|
+
readonly accepted: true;
|
|
35
|
+
readonly warnings?: readonly TypeExtensionEnforcementWarning[];
|
|
36
|
+
} | {
|
|
37
|
+
readonly accepted: false;
|
|
38
|
+
readonly errorCode: string;
|
|
39
|
+
readonly pointer?: string;
|
|
40
|
+
};
|
|
41
|
+
export declare function validateTypeExtensionEnforcementInternal(kind: string, type: string, extensions: Record<string, unknown> | undefined, strictness: Strictness): TypeExtensionEnforcementResult;
|
|
42
|
+
//# sourceMappingURL=type-extension-enforcement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-extension-enforcement.d.ts","sourceRoot":"","sources":["../../../../src/_internal/record-core/validators/type-extension-enforcement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE3D,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,MAAM,8BAA8B,GACtC;IAAE,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,+BAA+B,EAAE,CAAA;CAAE,GAC3F;IAAE,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAIxF,wBAAgB,wCAAwC,CACtD,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC/C,UAAU,EAAE,UAAU,GACrB,8BAA8B,CA0BhC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bounded internal unknown-extension-grammar validator (canonical-composed).
|
|
3
|
+
*
|
|
4
|
+
* INTERNAL ONLY. Thin wrapper around `isValidExtensionKey` and
|
|
5
|
+
* `REGISTERED_EXTENSION_GROUP_KEYS` from `@peac/schema`. Identifies
|
|
6
|
+
* unknown-but-well-formed extension keys and surfaces them as
|
|
7
|
+
* non-blocking warnings, mirroring the canonical
|
|
8
|
+
* `unknown_extension_preserved` warning emitted by `verifyLocal`.
|
|
9
|
+
*
|
|
10
|
+
* Malformed extension keys (failing `isValidExtensionKey`) are NOT
|
|
11
|
+
* surfaced here as warnings; they are hard errors at the canonical
|
|
12
|
+
* schema-parse layer (`E_INVALID_EXTENSION_KEY`) and therefore never
|
|
13
|
+
* reach this layer on an accepted record.
|
|
14
|
+
*
|
|
15
|
+
* Module is observational only; not re-exported from
|
|
16
|
+
* `packages/protocol/src/index.ts` and not wired into the public
|
|
17
|
+
* runtime path.
|
|
18
|
+
*
|
|
19
|
+
* SCOPE:
|
|
20
|
+
* - Walk `claims.extensions` keys.
|
|
21
|
+
* - For every key that is well-formed but not registered, emit a
|
|
22
|
+
* warning with code `unknown_extension_preserved` and an
|
|
23
|
+
* RFC 6901 JSON-pointer-encoded path.
|
|
24
|
+
* - Always accepted; this layer never rejects.
|
|
25
|
+
*
|
|
26
|
+
* Out of scope:
|
|
27
|
+
* - Malformed-key rejection (canonical schema-parse owns this).
|
|
28
|
+
* - Per-extension content validation (extension-specific schemas).
|
|
29
|
+
*/
|
|
30
|
+
export interface UnknownExtensionWarning {
|
|
31
|
+
readonly code: string;
|
|
32
|
+
readonly pointer: string;
|
|
33
|
+
}
|
|
34
|
+
export interface UnknownExtensionGrammarResult {
|
|
35
|
+
readonly accepted: true;
|
|
36
|
+
readonly warnings: readonly UnknownExtensionWarning[];
|
|
37
|
+
}
|
|
38
|
+
export declare function validateUnknownExtensionGrammarInternal(extensions: Record<string, unknown> | undefined): UnknownExtensionGrammarResult;
|
|
39
|
+
//# sourceMappingURL=unknown-extension-grammar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unknown-extension-grammar.d.ts","sourceRoot":"","sources":["../../../../src/_internal/record-core/validators/unknown-extension-grammar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAIH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,SAAS,uBAAuB,EAAE,CAAC;CACvD;AAeD,wBAAgB,uCAAuC,CACrD,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAC9C,6BAA6B,CAe/B"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical-composed candidate-runner for parity tests.
|
|
3
|
+
*
|
|
4
|
+
* INTERNAL TEST HELPER. Wraps `runBoundedValidatorShadow` (the
|
|
5
|
+
* canonical-composed candidate validator) and projects its
|
|
6
|
+
* `BoundedValidationResult` into the same `ParityVerdict` shape that
|
|
7
|
+
* `canonical-runner` emits. The candidate-runner is the LEFT input to
|
|
8
|
+
* the canonical-vs-candidate differential test; the canonical-runner
|
|
9
|
+
* is the RIGHT input. Both produce verdicts; the differential test
|
|
10
|
+
* asserts byte-equality (or, where applicable, error-class
|
|
11
|
+
* equivalence).
|
|
12
|
+
*
|
|
13
|
+
* The candidate is canonical-composed by construction: every layer
|
|
14
|
+
* either delegates to a canonical helper from `@peac/schema` /
|
|
15
|
+
* `@peac/crypto` / `@peac/protocol`, or mirrors a canonical inline
|
|
16
|
+
* check verbatim. Divergence between canonical and candidate
|
|
17
|
+
* therefore indicates a defect in the bounded validator's projection
|
|
18
|
+
* logic, not a "different implementation disagreed."
|
|
19
|
+
*
|
|
20
|
+
* Pure: same input always yields the same verdict bytes.
|
|
21
|
+
*/
|
|
22
|
+
import { type ParityVerdict } from './parity-verdict.js';
|
|
23
|
+
import type { CanonicalRunnerKind } from './canonical-runner.js';
|
|
24
|
+
/**
|
|
25
|
+
* Run the canonical-composed candidate path on a Wire 0.2 envelope
|
|
26
|
+
* payload. Mirrors `runEnvelopeCanonical` shape-for-shape:
|
|
27
|
+
*
|
|
28
|
+
* 1. Kernel-constraints check via `runBoundedValidatorShadow`
|
|
29
|
+
* (composes the parallel `validateKernelConstraintsInternal`).
|
|
30
|
+
* 2. Schema-parse projection (delegates to canonical
|
|
31
|
+
* `parseReceiptClaims`).
|
|
32
|
+
* 3. Canonical claims digest on accepted records.
|
|
33
|
+
*
|
|
34
|
+
* Errors from bounded-validator are projected onto `ParityError`
|
|
35
|
+
* entries so the verdict shape is comparable byte-for-byte against
|
|
36
|
+
* `runEnvelopeCanonical`.
|
|
37
|
+
*/
|
|
38
|
+
export declare function runEnvelopeCandidate(payload: Record<string, unknown>): Promise<ParityVerdict>;
|
|
39
|
+
/**
|
|
40
|
+
* Run the canonical-composed candidate JOSE-hardening path on a
|
|
41
|
+
* protected header. The bounded `validateJoseHardeningInternal`
|
|
42
|
+
* mirrors `validateWire02Header` from `@peac/crypto`; the candidate
|
|
43
|
+
* runner surfaces the same first-violation error code projected into
|
|
44
|
+
* the parity verdict shape.
|
|
45
|
+
*/
|
|
46
|
+
export declare function runJoseCandidate(header: Record<string, unknown> | undefined): ParityVerdict;
|
|
47
|
+
/**
|
|
48
|
+
* Dispatch to the appropriate candidate runner by kind. Mirrors
|
|
49
|
+
* `runCanonicalForKind`. Always async so callers can uniformly await.
|
|
50
|
+
*/
|
|
51
|
+
export declare function runCandidateForKind(kind: CanonicalRunnerKind, input: Record<string, unknown>): Promise<ParityVerdict>;
|
|
52
|
+
//# sourceMappingURL=candidate-runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"candidate-runner.d.ts","sourceRoot":"","sources":["../../../src/_internal/test-helpers/candidate-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAKH,OAAO,EAAiC,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACxF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAejE;;;;;;;;;;;;;GAaG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,aAAa,CAAC,CAsCxB;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAAG,aAAa,CAc3F;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,mBAAmB,EACzB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,OAAO,CAAC,aAAa,CAAC,CAGxB"}
|