@peac/protocol 0.13.3 → 0.13.4
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/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 +42 -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 +183 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +183 -27
- package/dist/index.mjs.map +1 -1
- package/dist/verify-local.cjs +154 -0
- package/dist/verify-local.cjs.map +1 -1
- package/dist/verify-local.mjs +154 -0
- 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,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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,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,a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
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,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bounded internal schema-parse validator (canonical-composed).
|
|
3
|
+
*
|
|
4
|
+
* INTERNAL ONLY. Thin wrapper around the canonical
|
|
5
|
+
* `parseReceiptClaims` from `@peac/schema`, projecting the canonical
|
|
6
|
+
* result into the bounded validator's normalized shape. The wrapper
|
|
7
|
+
* has no decision logic of its own: it delegates the parse, then
|
|
8
|
+
* surfaces the canonical accept/reject and the canonical error code.
|
|
9
|
+
*
|
|
10
|
+
* This is observational equivalence by construction, not a divergent
|
|
11
|
+
* parser. The layer boundary allows an alternate implementation
|
|
12
|
+
* without changing callers; the input/output shape is stable enough
|
|
13
|
+
* for a drop-in replacement should rigorous cross-implementation
|
|
14
|
+
* parity beyond observational evidence be required.
|
|
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
|
+
* - Run `parseReceiptClaims(payload)` and surface its accept/reject.
|
|
22
|
+
* - On rejection, surface `pr.error.code` (canonical parse-error code)
|
|
23
|
+
* so the candidate's error taxonomy matches the canonical's.
|
|
24
|
+
* - On acceptance, no warnings are surfaced from this layer; parser
|
|
25
|
+
* warnings (e.g., `type_unregistered`, `unknown_extension_preserved`)
|
|
26
|
+
* are emitted by the canonical parser and consumed at higher layers
|
|
27
|
+
* (verifyLocal warning aggregation).
|
|
28
|
+
*/
|
|
29
|
+
import type { Wire02Claims } from '@peac/schema';
|
|
30
|
+
export interface SchemaParseResult {
|
|
31
|
+
readonly accepted: boolean;
|
|
32
|
+
readonly errorCode?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Parsed Wire 0.2 claims when accepted. Internal-only; does not
|
|
35
|
+
* appear on any emitted record or public surface. Callers that need
|
|
36
|
+
* a typed view of the parsed claims read this field; callers that
|
|
37
|
+
* only need the accept/reject signal ignore it.
|
|
38
|
+
*/
|
|
39
|
+
readonly claims?: Wire02Claims;
|
|
40
|
+
}
|
|
41
|
+
export declare function validateSchemaParseInternal(payload: unknown): SchemaParseResult;
|
|
42
|
+
//# 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;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC;CAChC;AAED,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,OAAO,GAAG,iBAAiB,CAS/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"}
|