@peac/protocol 0.13.0 → 0.13.2
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 +83 -0
- package/dist/_internal/record-core/bounded-validator.d.ts.map +1 -0
- package/dist/_internal/record-core/codec/index.d.ts +27 -0
- package/dist/_internal/record-core/codec/index.d.ts.map +1 -0
- package/dist/_internal/record-core/codec/jws-jwt.d.ts +25 -0
- package/dist/_internal/record-core/codec/jws-jwt.d.ts.map +1 -0
- package/dist/_internal/record-core/codec/types.d.ts +80 -0
- package/dist/_internal/record-core/codec/types.d.ts.map +1 -0
- package/dist/_internal/record-core/index.d.ts +14 -0
- package/dist/_internal/record-core/index.d.ts.map +1 -0
- package/dist/_internal/record-core/normalize.d.ts +24 -0
- package/dist/_internal/record-core/normalize.d.ts.map +1 -0
- package/dist/_internal/record-core/shadow-hook.d.ts +46 -0
- package/dist/_internal/record-core/shadow-hook.d.ts.map +1 -0
- package/dist/_internal/record-core/types.d.ts +15 -0
- package/dist/_internal/record-core/types.d.ts.map +1 -0
- package/dist/_internal/record-core/validators/extension-budget.d.ts +47 -0
- package/dist/_internal/record-core/validators/extension-budget.d.ts.map +1 -0
- package/dist/_internal/record-core/validators/index.d.ts +13 -0
- package/dist/_internal/record-core/validators/index.d.ts.map +1 -0
- package/dist/_internal/record-core/validators/issuer-form.d.ts +58 -0
- package/dist/_internal/record-core/validators/issuer-form.d.ts.map +1 -0
- package/dist/_internal/record-core/validators/jose-hardening.d.ts +58 -0
- package/dist/_internal/record-core/validators/jose-hardening.d.ts.map +1 -0
- package/dist/_internal/record-core/validators/kernel-constraints.d.ts +48 -0
- package/dist/_internal/record-core/validators/kernel-constraints.d.ts.map +1 -0
- package/dist/_internal/record-core/validators/temporal.d.ts +50 -0
- package/dist/_internal/record-core/validators/temporal.d.ts.map +1 -0
- package/dist/_internal/record-core/validators/type-extension-mapping.d.ts +51 -0
- package/dist/_internal/record-core/validators/type-extension-mapping.d.ts.map +1 -0
- package/dist/_internal/record-core/validators/types.d.ts +42 -0
- package/dist/_internal/record-core/validators/types.d.ts.map +1 -0
- package/dist/_internal/shadow-observe.d.ts +93 -0
- package/dist/_internal/shadow-observe.d.ts.map +1 -0
- package/dist/_internal/shadow-redact.d.ts +74 -0
- package/dist/_internal/shadow-redact.d.ts.map +1 -0
- package/dist/_internal/shadow-types.d.ts +62 -0
- package/dist/_internal/shadow-types.d.ts.map +1 -0
- package/dist/_internal/shadow.d.ts +134 -0
- package/dist/_internal/shadow.d.ts.map +1 -0
- package/dist/_internal/test-helpers/canonical-runner.d.ts +43 -0
- package/dist/_internal/test-helpers/canonical-runner.d.ts.map +1 -0
- package/dist/_internal/test-helpers/corpus-loader.d.ts +61 -0
- package/dist/_internal/test-helpers/corpus-loader.d.ts.map +1 -0
- package/dist/_internal/test-helpers/fixture-manifest.d.ts +46 -0
- package/dist/_internal/test-helpers/fixture-manifest.d.ts.map +1 -0
- package/dist/_internal/test-helpers/parity-verdict.d.ts +31 -0
- package/dist/_internal/test-helpers/parity-verdict.d.ts.map +1 -0
- package/dist/index.cjs +684 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +685 -12
- package/dist/index.mjs.map +1 -1
- package/dist/issue.d.ts +12 -12
- package/dist/issue.d.ts.map +1 -1
- package/dist/policy-binding.d.ts +1 -1
- package/dist/verify-local.cjs +645 -3
- package/dist/verify-local.cjs.map +1 -1
- package/dist/verify-local.d.ts.map +1 -1
- package/dist/verify-local.mjs +647 -5
- package/dist/verify-local.mjs.map +1 -1
- package/package.json +6 -4
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bounded observation subset: composition aggregator.
|
|
3
|
+
*
|
|
4
|
+
* INTERNAL ONLY. Composes the six proven layer validators introduced
|
|
5
|
+
* across this PR (kernel constraints; type-extension mapping; JOSE
|
|
6
|
+
* header hardening; issuer form; occurred_at temporal skew;
|
|
7
|
+
* extension byte budget) into a single aggregated result. The
|
|
8
|
+
* canonical-truth sanity test, layer-isolated parity tests, and
|
|
9
|
+
* differential same-path proof have already established that each
|
|
10
|
+
* underlying validator is byte-equal with the existing canonical
|
|
11
|
+
* surface for the layer it covers.
|
|
12
|
+
*
|
|
13
|
+
* NOT WIRED. This module is NOT called from issue.ts, verify-local.ts,
|
|
14
|
+
* or any runtime path in v0.13.1. It exists as a composition example
|
|
15
|
+
* so PR D can wire the inert shadow-call hook to a real bounded
|
|
16
|
+
* pipeline behind an internal feature flag without re-deriving the
|
|
17
|
+
* composition shape.
|
|
18
|
+
*
|
|
19
|
+
* NOT FULL VALIDATION. The bounded subset deliberately EXCLUDES:
|
|
20
|
+
* - full Wire 0.2 schema parsing (parseReceiptClaims; the canonical
|
|
21
|
+
* parse continues to drive the runtime path)
|
|
22
|
+
* - signature verification and full JWS decode (decodeWire02;
|
|
23
|
+
* @peac/crypto remains canonical)
|
|
24
|
+
* - iat-not-yet-valid temporal check (lives inline at
|
|
25
|
+
* verify-local.ts:454 with no helper to import)
|
|
26
|
+
* - typ_missing strictness handling
|
|
27
|
+
* - policy binding verification
|
|
28
|
+
* - unknown_extension key grammar / plain-JSON guard / typed
|
|
29
|
+
* extension schema parse (only the byte-budget portion of
|
|
30
|
+
* validateKnownExtensions is in scope)
|
|
31
|
+
* - any control-plane behavior (issuer resolver, JWKS fetch, etc.)
|
|
32
|
+
*
|
|
33
|
+
* Public-facing wording for this module: "bounded observation subset",
|
|
34
|
+
* never "complete validator" or "primary validator".
|
|
35
|
+
*/
|
|
36
|
+
/** Minimal claims shape required by the bounded subset. */
|
|
37
|
+
export interface BoundedClaimsInput {
|
|
38
|
+
readonly kind: string;
|
|
39
|
+
readonly type: string;
|
|
40
|
+
readonly iss: unknown;
|
|
41
|
+
readonly iat: number;
|
|
42
|
+
readonly occurred_at?: string;
|
|
43
|
+
readonly extensions?: Record<string, unknown>;
|
|
44
|
+
}
|
|
45
|
+
/** Optional JOSE header (from the JWS protected header). */
|
|
46
|
+
export type BoundedHeaderInput = Record<string, unknown> | undefined;
|
|
47
|
+
/** Aggregated input to the bounded observation subset. */
|
|
48
|
+
export interface BoundedValidationInput {
|
|
49
|
+
readonly claims: BoundedClaimsInput;
|
|
50
|
+
readonly header?: BoundedHeaderInput;
|
|
51
|
+
/** Fixed Unix-second clock for temporal evaluation; required. */
|
|
52
|
+
readonly now: number;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Layer tag identifies which underlying validator emitted each entry.
|
|
56
|
+
* Useful for downstream filtering (e.g., a future shadow-mode reporter
|
|
57
|
+
* that ignores warning-class entries from one layer but not another).
|
|
58
|
+
*/
|
|
59
|
+
export type BoundedLayer = 'kernel-constraints' | 'type-extension-mapping' | 'jose-header-hardening' | 'issuer-form' | 'temporal' | 'extension-budget';
|
|
60
|
+
export interface BoundedViolation {
|
|
61
|
+
readonly layer: BoundedLayer;
|
|
62
|
+
readonly code: string;
|
|
63
|
+
readonly path?: string;
|
|
64
|
+
}
|
|
65
|
+
export interface BoundedWarning {
|
|
66
|
+
readonly layer: BoundedLayer;
|
|
67
|
+
readonly code: string;
|
|
68
|
+
readonly path?: string;
|
|
69
|
+
}
|
|
70
|
+
export interface BoundedValidationResult {
|
|
71
|
+
/** True iff every in-scope layer accepted the input. */
|
|
72
|
+
readonly accepted: boolean;
|
|
73
|
+
readonly violations: readonly BoundedViolation[];
|
|
74
|
+
readonly warnings: readonly BoundedWarning[];
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Run the bounded observation subset. Composes the six layer
|
|
78
|
+
* validators in a stable order; aggregates violations and warnings
|
|
79
|
+
* with explicit layer tags; never throws. Pure: same input always
|
|
80
|
+
* yields the same result.
|
|
81
|
+
*/
|
|
82
|
+
export declare function runBoundedValidatorShadow(input: BoundedValidationInput): BoundedValidationResult;
|
|
83
|
+
//# sourceMappingURL=bounded-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bounded-validator.d.ts","sourceRoot":"","sources":["../../../src/_internal/record-core/bounded-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAcH,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;CACtB;AAED;;;;GAIG;AACH,MAAM,MAAM,YAAY,GACpB,oBAAoB,GACpB,wBAAwB,GACxB,uBAAuB,GACvB,aAAa,GACb,UAAU,GACV,kBAAkB,CAAC;AAEvB,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,CA8EhG"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal codec registry.
|
|
3
|
+
*
|
|
4
|
+
* @internal
|
|
5
|
+
*
|
|
6
|
+
* v0.13.1 ships exactly one codec: jws-jwt. Future codecs (e.g.,
|
|
7
|
+
* cose-sign1 per RFC 9052) register here. COSE/CBOR is hook-only in
|
|
8
|
+
* v0.13.1; no implementation.
|
|
9
|
+
*/
|
|
10
|
+
import { CodecError, type CodecHeader, type RecordCodec } from './types.js';
|
|
11
|
+
import { defaultCodec } from './jws-jwt.js';
|
|
12
|
+
/**
|
|
13
|
+
* Internal codec registry lookup. v0.13.1 has only `jws-jwt` registered;
|
|
14
|
+
* any other name throws `CodecError('CODEC_UNKNOWN', ...)`.
|
|
15
|
+
*
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
export declare function getCodec(name: string): RecordCodec;
|
|
19
|
+
/**
|
|
20
|
+
* Test-only registry view. Returns the registry's keys snapshot.
|
|
21
|
+
*
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
export declare function _registeredCodecNames(): readonly string[];
|
|
25
|
+
export { defaultCodec, CodecError };
|
|
26
|
+
export type { CodecHeader, RecordCodec };
|
|
27
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/_internal/record-core/codec/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAK5C;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAMlD;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,SAAS,MAAM,EAAE,CAEzD;AAED,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC;AACpC,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default codec: pure pass-through to @peac/crypto.signWire02 / verify.
|
|
3
|
+
*
|
|
4
|
+
* @internal
|
|
5
|
+
*
|
|
6
|
+
* Byte-identical encode output to signWire02 is guaranteed by the
|
|
7
|
+
* golden-vector test (codec-jws-jwt-byte-identical.test.ts). Decode
|
|
8
|
+
* returns the underlying cryptoVerify result unchanged.
|
|
9
|
+
*
|
|
10
|
+
* peekHeader is structural-only: it requires typ + alg presence and a
|
|
11
|
+
* structurally valid compact JWS, but does NOT enforce policy on
|
|
12
|
+
* unsupported alg, crit, zip, or b64:false. Those rejections are
|
|
13
|
+
* downstream responsibilities (kernel constraints, JOSE hardening).
|
|
14
|
+
*
|
|
15
|
+
* The canonical implementation lives here. Tests import via relative
|
|
16
|
+
* paths from packages/protocol/__tests__/_internal/.
|
|
17
|
+
*/
|
|
18
|
+
import { type RecordCodec } from './types.js';
|
|
19
|
+
/**
|
|
20
|
+
* Default codec instance. Internal-only.
|
|
21
|
+
*
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
export declare const defaultCodec: RecordCodec;
|
|
25
|
+
//# sourceMappingURL=jws-jwt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jws-jwt.d.ts","sourceRoot":"","sources":["../../../../src/_internal/record-core/codec/jws-jwt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAQH,OAAO,EAAgC,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AA+E5E;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,WAA+B,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal codec strategy types.
|
|
3
|
+
*
|
|
4
|
+
* @internal
|
|
5
|
+
*
|
|
6
|
+
* These types MUST NOT be re-exported from packages/protocol/src/index.ts.
|
|
7
|
+
* The dist-leak gate (Tier 2) asserts that these names never appear in
|
|
8
|
+
* @peac/protocol's public root declaration (dist/index.d.ts) or any
|
|
9
|
+
* subpath in @peac/protocol/package.json `exports`.
|
|
10
|
+
*
|
|
11
|
+
* The canonical implementation of these types lives at
|
|
12
|
+
* packages/protocol/src/_internal/record-core/codec/jws-jwt.ts and is
|
|
13
|
+
* imported via RELATIVE paths from issue.ts / verify-local.ts.
|
|
14
|
+
*/
|
|
15
|
+
import type { VerifyResult } from '@peac/crypto';
|
|
16
|
+
/**
|
|
17
|
+
* Header view returned by codec.peekHeader().
|
|
18
|
+
*
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export interface CodecHeader {
|
|
22
|
+
/** JOSE typ value. Required at peek time; not defaulted. */
|
|
23
|
+
readonly typ: string;
|
|
24
|
+
/** Algorithm identifier. JWS string (e.g., 'EdDSA'). */
|
|
25
|
+
readonly alg: string;
|
|
26
|
+
/** Key identifier (when present). */
|
|
27
|
+
readonly kid?: string;
|
|
28
|
+
/** Full raw protected-header object for downstream policy inspection. */
|
|
29
|
+
readonly raw: Readonly<Record<string, unknown>>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Codec error with a structured code.
|
|
33
|
+
*
|
|
34
|
+
* @internal
|
|
35
|
+
*/
|
|
36
|
+
export declare class CodecError extends Error {
|
|
37
|
+
readonly code: string;
|
|
38
|
+
constructor(code: string, message: string);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Internal codec strategy. v0.13.1 ships exactly one implementation:
|
|
42
|
+
* jws-jwt. Signature mirrors @peac/crypto.signWire02 / verify exactly;
|
|
43
|
+
* concrete Uint8Array keys (Ed25519 at this layer); parametric only on
|
|
44
|
+
* the optional payload type T of VerifyResult<T>. Future codecs with
|
|
45
|
+
* different key shapes register a different interface; they MAY NOT
|
|
46
|
+
* shoehorn into this interface via parametric generics.
|
|
47
|
+
*
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
export interface RecordCodec {
|
|
51
|
+
/** Codec name. Used for registry lookup. */
|
|
52
|
+
readonly name: string;
|
|
53
|
+
/**
|
|
54
|
+
* Sign and serialize. Pure pass-through to the underlying signer; never
|
|
55
|
+
* accepts a typ override (the signer hardcodes typ per the wire format).
|
|
56
|
+
*/
|
|
57
|
+
encode(payload: unknown, privateKey: Uint8Array, kid: string): Promise<string>;
|
|
58
|
+
/**
|
|
59
|
+
* Verify and decode. Returns the underlying crypto verifier's result
|
|
60
|
+
* unchanged. Throws structured CodecError on malformed input;
|
|
61
|
+
* propagates the underlying CryptoError on signature mismatch.
|
|
62
|
+
*/
|
|
63
|
+
decode<T = unknown>(serialized: string, publicKey: Uint8Array): Promise<VerifyResult<T>>;
|
|
64
|
+
/**
|
|
65
|
+
* Header-only decode. Structural strictness only: throws CodecError on
|
|
66
|
+
* missing typ, missing alg, malformed protected header JSON, or
|
|
67
|
+
* malformed compact JWS (must be exactly three non-empty
|
|
68
|
+
* dot-separated segments). Does NOT enforce policy on crit / zip /
|
|
69
|
+
* b64 / unsupported alg; those rejections are downstream JOSE-hardening
|
|
70
|
+
* responsibilities and are surfaced via the raw header for inspection.
|
|
71
|
+
*
|
|
72
|
+
* Note: this codec is JWS/JWT string-based. The `serialized` parameter
|
|
73
|
+
* is typed as `string` for that reason. Future codecs that operate on
|
|
74
|
+
* binary inputs (e.g., COSE/CBOR over `Uint8Array`) MUST register a
|
|
75
|
+
* different interface; do not generalize this one to imply binary
|
|
76
|
+
* support that the JWS codec does not provide.
|
|
77
|
+
*/
|
|
78
|
+
peekHeader(serialized: string): CodecHeader;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/_internal/record-core/codec/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,4DAA4D;IAC5D,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,wDAAwD;IACxD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,qCAAqC;IACrC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,yEAAyE;IACzE,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACjD;AAED;;;;GAIG;AACH,qBAAa,UAAW,SAAQ,KAAK;aAEjB,IAAI,EAAE,MAAM;gBAAZ,IAAI,EAAE,MAAM,EAC5B,OAAO,EAAE,MAAM;CAKlB;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,WAAW;IAC1B,4CAA4C;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE/E;;;;OAIG;IACH,MAAM,CAAC,CAAC,GAAG,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;IAEzF;;;;;;;;;;;;;OAaG;IACH,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,WAAW,CAAC;CAC7C"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal record-core barrel.
|
|
3
|
+
*
|
|
4
|
+
* @internal
|
|
5
|
+
*
|
|
6
|
+
* NOT re-exported from packages/protocol/src/index.ts. Internal callers
|
|
7
|
+
* inside @peac/protocol use relative imports either to this barrel or
|
|
8
|
+
* (for narrower targeting) directly to the sub-modules.
|
|
9
|
+
*/
|
|
10
|
+
export { defaultCodec, getCodec, _registeredCodecNames, CodecError } from './codec/index.js';
|
|
11
|
+
export type { CodecHeader, RecordCodec } from './codec/index.js';
|
|
12
|
+
export { normalize } from './normalize.js';
|
|
13
|
+
export type { InternalMigrationClass } from './types.js';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/_internal/record-core/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC7F,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,YAAY,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Record-claim normalization (INERT in v0.13.1).
|
|
3
|
+
*
|
|
4
|
+
* @internal
|
|
5
|
+
*
|
|
6
|
+
* v0.13.1 contract: this function MUST be a no-op identity passthrough.
|
|
7
|
+
* It returns the SAME object reference passed in. Tests assert this via
|
|
8
|
+
* `expect(normalize(claims)).toBe(claims)` (Vitest `toBe` uses
|
|
9
|
+
* `Object.is` - referential identity, NOT deep equality).
|
|
10
|
+
*
|
|
11
|
+
* Do NOT add default expansion, key reordering, wire-version tagging, or
|
|
12
|
+
* any claim mutation in v0.13.1. The live issue() / verifyLocal() path
|
|
13
|
+
* does not route through normalize() in this release; the function exists
|
|
14
|
+
* as a named hook future releases can wire into the live path AFTER the
|
|
15
|
+
* byte-identical parity corpus proves zero divergence.
|
|
16
|
+
*/
|
|
17
|
+
import type { Wire02Claims } from '@peac/schema';
|
|
18
|
+
/**
|
|
19
|
+
* INERT identity passthrough. Returns the same object reference.
|
|
20
|
+
*
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
export declare function normalize(claims: Wire02Claims): Wire02Claims;
|
|
24
|
+
//# sourceMappingURL=normalize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../src/_internal/record-core/normalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,YAAY,CAE5D"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inert shadow-call boundary for the bounded validator foundation.
|
|
3
|
+
*
|
|
4
|
+
* INTERNAL ONLY. This module is the call-site placeholder that PR D
|
|
5
|
+
* will wire to the bounded validator pipeline behind an internal
|
|
6
|
+
* feature flag. In v0.13.1 the boundary is INERT by construction:
|
|
7
|
+
*
|
|
8
|
+
* - the only declared mode is `'disabled'`
|
|
9
|
+
* - the function body is a single early return on `'disabled'`
|
|
10
|
+
* - it imports no bounded validators (zero runtime weight at
|
|
11
|
+
* verify-local.ts cold-start, even though the call site exists)
|
|
12
|
+
* - it never throws into verifyLocal()
|
|
13
|
+
* - it never mutates the input claims object
|
|
14
|
+
* - it never logs
|
|
15
|
+
* - it never reads environment variables
|
|
16
|
+
* - it never affects the canonical verify-local result
|
|
17
|
+
*
|
|
18
|
+
* The function returns `undefined` for every call. The call site in
|
|
19
|
+
* verify-local.ts ignores the return value and never awaits any work.
|
|
20
|
+
*
|
|
21
|
+
* NOT re-exported from packages/protocol/src/index.ts. Public surface
|
|
22
|
+
* is byte-stable. PR D may extend the input shape when wiring the
|
|
23
|
+
* actual flag plumbing; that is a future-internal change, not a
|
|
24
|
+
* public API change.
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* The only declared shadow validation mode. Adding new modes requires
|
|
28
|
+
* a deliberate future change in PR D where the actual flag is wired.
|
|
29
|
+
*/
|
|
30
|
+
export type ShadowValidationMode = 'disabled';
|
|
31
|
+
/**
|
|
32
|
+
* Input shape for the shadow-call boundary. `claims` is intentionally
|
|
33
|
+
* `unknown` so callers may pass parsed Wire 0.2 claims without a
|
|
34
|
+
* coupling to the schema's exported type from this internal helper.
|
|
35
|
+
*/
|
|
36
|
+
export interface ShadowValidationInput {
|
|
37
|
+
readonly mode: ShadowValidationMode;
|
|
38
|
+
readonly claims: unknown;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Inert shadow-call hook. Always returns `undefined`. The signature
|
|
42
|
+
* is stable enough for PR D to extend (e.g., adding a `header` or
|
|
43
|
+
* `now` field) without breaking the disabled-default contract.
|
|
44
|
+
*/
|
|
45
|
+
export declare function maybeRunShadowValidation(input: ShadowValidationInput): undefined;
|
|
46
|
+
//# sourceMappingURL=shadow-hook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shadow-hook.d.ts","sourceRoot":"","sources":["../../../src/_internal/record-core/shadow-hook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC;AAE9C;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,qBAAqB,GAAG,SAAS,CAGhF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local internal type union for the record-core internal modules.
|
|
3
|
+
*
|
|
4
|
+
* @internal
|
|
5
|
+
*
|
|
6
|
+
* If protocol internals need a migration-class literal in the future,
|
|
7
|
+
* define it here. Importing the equivalent type from a workspace-private
|
|
8
|
+
* package is forbidden by the protocol-private-imports tooling test (which
|
|
9
|
+
* walks packages/protocol/src/** for forbidden import specifiers).
|
|
10
|
+
*
|
|
11
|
+
* v0.13.1 has no live consumer for this type; it exists as the named
|
|
12
|
+
* landing point for a future inline definition.
|
|
13
|
+
*/
|
|
14
|
+
export type InternalMigrationClass = 'exact' | 'derived' | 'lossy' | 'impossible';
|
|
15
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/_internal/record-core/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,YAAY,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bounded internal extension-budget validator.
|
|
3
|
+
*
|
|
4
|
+
* INTERNAL ONLY. This is the parity-observed counterpart of the
|
|
5
|
+
* byte-budget portion (steps 4 + 5) of validateKnownExtensions in
|
|
6
|
+
* @peac/schema/src/wire-02-extensions/validation.ts. Both sides import
|
|
7
|
+
* EXTENSION_BUDGET from @peac/kernel; behavioral parity is proven
|
|
8
|
+
* byte-equal by the parity tests, not by code copy.
|
|
9
|
+
*
|
|
10
|
+
* Existing canonical validateKnownExtensions in @peac/schema remains
|
|
11
|
+
* canonical. This module is observational only; it is NOT re-exported
|
|
12
|
+
* from packages/protocol/src/index.ts and is NOT wired into runtime
|
|
13
|
+
* paths (issue.ts, verify-local.ts) in v0.13.1.
|
|
14
|
+
*
|
|
15
|
+
* SCOPE (deliberately narrow):
|
|
16
|
+
* - byte-budget enforcement on the extensions record only
|
|
17
|
+
* - the other three steps in validateKnownExtensions (key grammar,
|
|
18
|
+
* plain-JSON guard, typed extension schema parse) are NOT in
|
|
19
|
+
* scope here; they belong to other parity work and would require
|
|
20
|
+
* their own validators
|
|
21
|
+
*
|
|
22
|
+
* Measurement basis (must mirror canonical exactly):
|
|
23
|
+
* - bytes = TextEncoder.encode(JSON.stringify(value)).byteLength
|
|
24
|
+
* (UTF-8 byte length of ECMAScript JSON.stringify output)
|
|
25
|
+
* - serialization failure (circular references, BigInt, etc.) yields
|
|
26
|
+
* Infinity, which the comparison treats as over-budget
|
|
27
|
+
*
|
|
28
|
+
* Order of checks (must mirror canonical exactly):
|
|
29
|
+
* 1. Total: jsonUtf8ByteLength(extensions) > maxTotalBytes
|
|
30
|
+
* -> violation at path '/extensions'; EARLY STOP (no per-group)
|
|
31
|
+
* 2. Per-group, in Object.keys(extensions) iteration order:
|
|
32
|
+
* jsonUtf8ByteLength(extensions[key]) > maxGroupBytes
|
|
33
|
+
* -> violation at path '/extensions/<escaped-key>'
|
|
34
|
+
*
|
|
35
|
+
* Comparison uses '>' (strictly greater than), so values exactly equal
|
|
36
|
+
* to the limit are accepted.
|
|
37
|
+
*/
|
|
38
|
+
export interface ExtensionBudgetViolation {
|
|
39
|
+
readonly code: string;
|
|
40
|
+
readonly path: string;
|
|
41
|
+
}
|
|
42
|
+
export interface ExtensionBudgetResult {
|
|
43
|
+
readonly accepted: boolean;
|
|
44
|
+
readonly violations: readonly ExtensionBudgetViolation[];
|
|
45
|
+
}
|
|
46
|
+
export declare function validateExtensionBudgetInternal(extensions: Record<string, unknown> | undefined): ExtensionBudgetResult;
|
|
47
|
+
//# sourceMappingURL=extension-budget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extension-budget.d.ts","sourceRoot":"","sources":["../../../../src/_internal/record-core/validators/extension-budget.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAIH,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,SAAS,wBAAwB,EAAE,CAAC;CAC1D;AAyBD,wBAAgB,+BAA+B,CAC7C,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAC9C,qBAAqB,CA0BvB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal validator barrel for the bounded shadow-mode validator foundation.
|
|
3
|
+
*
|
|
4
|
+
* INTERNAL ONLY. Not re-exported from packages/protocol/src/index.ts.
|
|
5
|
+
*/
|
|
6
|
+
export type { ParityVerdict, ParityError, ParityWarning } from './types.js';
|
|
7
|
+
export { validateKernelConstraintsInternal } from './kernel-constraints.js';
|
|
8
|
+
export { validateTypeExtensionMappingInternal, type TypeExtensionMappingInput, type TypeExtensionMappingWarning, } from './type-extension-mapping.js';
|
|
9
|
+
export { validateJoseHardeningInternal, type JoseHardeningInput, type JoseHardeningResult, } from './jose-hardening.js';
|
|
10
|
+
export { validateIssuerFormInternal, type IssuerFormResult } from './issuer-form.js';
|
|
11
|
+
export { validateTemporalInternal, type TemporalResult, type TemporalWarning } from './temporal.js';
|
|
12
|
+
export { validateExtensionBudgetInternal, type ExtensionBudgetResult, type ExtensionBudgetViolation, } from './extension-budget.js';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bounded internal issuer-form validator.
|
|
3
|
+
*
|
|
4
|
+
* INTERNAL ONLY. This is the parity-observed counterpart of
|
|
5
|
+
* @peac/schema.isCanonicalIss (referenced by Wire 0.2's CanonicalIssSchema
|
|
6
|
+
* and by issue.ts pre-sign validation). Both implementations consume the
|
|
7
|
+
* same ISS_CANONICAL.maxLength constant from @peac/kernel and apply the
|
|
8
|
+
* same accept/reject rules in the same order; behavioral parity is proven
|
|
9
|
+
* byte-equal by the parity tests, not by code copy.
|
|
10
|
+
*
|
|
11
|
+
* Existing canonical isCanonicalIss in @peac/schema remains canonical.
|
|
12
|
+
* This module is observational only; it is NOT re-exported from
|
|
13
|
+
* packages/protocol/src/index.ts and is NOT wired into runtime paths
|
|
14
|
+
* (issue.ts, verify-local.ts) in v0.13.1.
|
|
15
|
+
*
|
|
16
|
+
* Scope (must mirror isCanonicalIss in packages/schema/src/wire-02-envelope.ts):
|
|
17
|
+
*
|
|
18
|
+
* 1. Type and length:
|
|
19
|
+
* - Non-string iss -> rejected
|
|
20
|
+
* - Empty string -> rejected
|
|
21
|
+
* - Length > ISS_CANONICAL.maxLength (2048) -> rejected
|
|
22
|
+
*
|
|
23
|
+
* 2. did: branch (checked before URL parsing because did: is a valid
|
|
24
|
+
* URL scheme in some parsers):
|
|
25
|
+
* - Pattern: ^did:[a-z0-9]+:[^#?/]+$
|
|
26
|
+
* - Method: lowercase letters and digits only, non-empty
|
|
27
|
+
* - Method-specific-id: non-empty, no '/', '?', or '#'
|
|
28
|
+
*
|
|
29
|
+
* 3. https:// branch (URL-constructor based):
|
|
30
|
+
* - new URL(iss) must succeed
|
|
31
|
+
* - url.protocol === 'https:'
|
|
32
|
+
* - Non-empty url.hostname
|
|
33
|
+
* - No userinfo (url.username and url.password both empty)
|
|
34
|
+
* - iss must equal the canonical reconstructed origin
|
|
35
|
+
* ('https://${url.host}'). This rejects:
|
|
36
|
+
* - uppercase host (URL spec lowercases hostname)
|
|
37
|
+
* - explicit default port (:443 is dropped from url.host)
|
|
38
|
+
* - trailing slash, path, query, fragment, userinfo
|
|
39
|
+
* - raw Unicode hostname (URL emits punycode in url.host)
|
|
40
|
+
*
|
|
41
|
+
* 4. All other schemes -> rejected with E_ISS_NOT_CANONICAL.
|
|
42
|
+
*/
|
|
43
|
+
/**
|
|
44
|
+
* Normalized result. accepted=true means iss is in canonical form.
|
|
45
|
+
* accepted=false carries the canonical error code E_ISS_NOT_CANONICAL.
|
|
46
|
+
*
|
|
47
|
+
* The canonical surface emits a single error code for any rejection;
|
|
48
|
+
* no path field is attached, so the comparison is on (accepted, errorCode)
|
|
49
|
+
* only.
|
|
50
|
+
*/
|
|
51
|
+
export type IssuerFormResult = {
|
|
52
|
+
readonly accepted: true;
|
|
53
|
+
} | {
|
|
54
|
+
readonly accepted: false;
|
|
55
|
+
readonly errorCode: string;
|
|
56
|
+
};
|
|
57
|
+
export declare function validateIssuerFormInternal(iss: unknown): IssuerFormResult;
|
|
58
|
+
//# sourceMappingURL=issuer-form.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issuer-form.d.ts","sourceRoot":"","sources":["../../../../src/_internal/record-core/validators/issuer-form.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAIH;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GACxB;IAAE,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAA;CAAE,GAC3B;IAAE,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAQ7D,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB,CAyBzE"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bounded internal JOSE header hardening validator.
|
|
3
|
+
*
|
|
4
|
+
* INTERNAL ONLY. This is the parity-observed counterpart of
|
|
5
|
+
* @peac/crypto.validateWire02Header. Both implementations consume the
|
|
6
|
+
* same JOSE protected-header object and apply the same five hardening
|
|
7
|
+
* checks in the same order; behavioral parity is proven byte-equal by
|
|
8
|
+
* the parity tests, not by code copy.
|
|
9
|
+
*
|
|
10
|
+
* Existing canonical hardening in @peac/crypto remains canonical. This
|
|
11
|
+
* module is observational only; it is NOT re-exported from
|
|
12
|
+
* packages/protocol/src/index.ts and is NOT wired into runtime paths
|
|
13
|
+
* (issue.ts, verify-local.ts, peekHeader) in v0.13.1.
|
|
14
|
+
*
|
|
15
|
+
* Scope (must mirror validateWire02Header in packages/crypto/src/jws.ts):
|
|
16
|
+
*
|
|
17
|
+
* 1. kid presence and length:
|
|
18
|
+
* - missing kid (undefined / non-string / empty) -> CRYPTO_JWS_MISSING_KID
|
|
19
|
+
* - kid length > 256 chars -> CRYPTO_JWS_MISSING_KID
|
|
20
|
+
*
|
|
21
|
+
* 2. embedded key material (jwk, x5c, x5u, jku):
|
|
22
|
+
* - any of the four set -> CRYPTO_JWS_EMBEDDED_KEY
|
|
23
|
+
*
|
|
24
|
+
* 3. crit header:
|
|
25
|
+
* - any value (including null / empty array) -> CRYPTO_JWS_CRIT_REJECTED
|
|
26
|
+
*
|
|
27
|
+
* 4. b64: false (RFC 7797 unencoded payload):
|
|
28
|
+
* - the only rejected value is the boolean false; other values pass through
|
|
29
|
+
* - rejection -> CRYPTO_JWS_B64_REJECTED
|
|
30
|
+
*
|
|
31
|
+
* 5. zip header:
|
|
32
|
+
* - any value -> CRYPTO_JWS_ZIP_REJECTED
|
|
33
|
+
*
|
|
34
|
+
* Out of scope for this module (mirroring validateWire02Header exactly):
|
|
35
|
+
* - alg validation (lives in buildHeader, not validateWire02Header)
|
|
36
|
+
* - typ validation (lives in buildHeader)
|
|
37
|
+
* - signature verification
|
|
38
|
+
* - compact-JWS shape / size checks
|
|
39
|
+
*
|
|
40
|
+
* Order is significant: the canonical function returns the FIRST
|
|
41
|
+
* matching violation per call (it throws on the first hit). The
|
|
42
|
+
* internal validator emits the same first-hit code.
|
|
43
|
+
*/
|
|
44
|
+
/** Header input shape (matches the parsed JOSE protected header). */
|
|
45
|
+
export type JoseHardeningInput = Record<string, unknown>;
|
|
46
|
+
/**
|
|
47
|
+
* Normalized result. accepted=true means the header passes all five
|
|
48
|
+
* hardening checks. accepted=false carries the canonical CryptoError
|
|
49
|
+
* code emitted by the corresponding canonical check.
|
|
50
|
+
*/
|
|
51
|
+
export type JoseHardeningResult = {
|
|
52
|
+
readonly accepted: true;
|
|
53
|
+
} | {
|
|
54
|
+
readonly accepted: false;
|
|
55
|
+
readonly errorCode: string;
|
|
56
|
+
};
|
|
57
|
+
export declare function validateJoseHardeningInternal(header: JoseHardeningInput): JoseHardeningResult;
|
|
58
|
+
//# sourceMappingURL=jose-hardening.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jose-hardening.d.ts","sourceRoot":"","sources":["../../../../src/_internal/record-core/validators/jose-hardening.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,qEAAqE;AACrE,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEzD;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAC3B;IAAE,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAA;CAAE,GAC3B;IAAE,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAU7D,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,kBAAkB,GAAG,mBAAmB,CAqC7F"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bounded internal kernel-constraints validator.
|
|
3
|
+
*
|
|
4
|
+
* INTERNAL ONLY. This is the parity-observed counterpart of
|
|
5
|
+
* @peac/schema.validateKernelConstraints; both implementations consume
|
|
6
|
+
* the same KERNEL_CONSTRAINTS constants from @peac/kernel and emit the
|
|
7
|
+
* same ConstraintValidationResult shape. The differential parity test
|
|
8
|
+
* asserts byte-identical equality between the two on every eligible
|
|
9
|
+
* fixture; any divergence is stop-the-line.
|
|
10
|
+
*
|
|
11
|
+
* Existing validation in @peac/schema remains canonical. This module
|
|
12
|
+
* is observational only; it is NOT re-exported from
|
|
13
|
+
* packages/protocol/src/index.ts and is NOT wired into runtime paths
|
|
14
|
+
* (issue.ts, verify-local.ts) in v0.13.1.
|
|
15
|
+
*
|
|
16
|
+
* Implementation invariants (must mirror @peac/schema/src/constraints.ts
|
|
17
|
+
* verbatim; any drift fails the parity test):
|
|
18
|
+
* - iterative stack-based traversal (stack-safe; no recursion)
|
|
19
|
+
* - every value (primitives, arrays, objects) is pushed and counted as
|
|
20
|
+
* a node when popped
|
|
21
|
+
* - total-nodes check evaluated FIRST per pop; over-limit pushes the
|
|
22
|
+
* violation with the current totalNodes count and breaks (preserves
|
|
23
|
+
* first-violation semantics)
|
|
24
|
+
* - depth check evaluated SECOND per pop; over-limit pushes a
|
|
25
|
+
* violation and continues (no-op for primitives, prevents deeper
|
|
26
|
+
* descent for containers)
|
|
27
|
+
* - string-length check (primitives only) uses .length (code units)
|
|
28
|
+
* - array-length and object-key-count checks pushed BEFORE descending
|
|
29
|
+
* into children
|
|
30
|
+
* - children pushed in reverse index/key order so traversal visits
|
|
31
|
+
* them in original order (LIFO)
|
|
32
|
+
* - empty path for root; bracket notation for arrays (`a[0]`); dot
|
|
33
|
+
* notation for object keys (`a.b`)
|
|
34
|
+
* - returns { valid: violations.length === 0, violations }
|
|
35
|
+
* - never throws
|
|
36
|
+
* - assumes acyclic input
|
|
37
|
+
*/
|
|
38
|
+
import type { ConstraintValidationResult } from '@peac/schema';
|
|
39
|
+
/**
|
|
40
|
+
* Validate claims against structural kernel constraints. Mirrors the
|
|
41
|
+
* canonical implementation in @peac/schema for parity.
|
|
42
|
+
*
|
|
43
|
+
* Distinct exported name (validateKernelConstraintsInternal) to avoid
|
|
44
|
+
* collision with the canonical @peac/schema export when both are
|
|
45
|
+
* imported into the same parity test file.
|
|
46
|
+
*/
|
|
47
|
+
export declare function validateKernelConstraintsInternal(claims: unknown): ConstraintValidationResult;
|
|
48
|
+
//# sourceMappingURL=kernel-constraints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kernel-constraints.d.ts","sourceRoot":"","sources":["../../../../src/_internal/record-core/validators/kernel-constraints.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAGH,OAAO,KAAK,EAAE,0BAA0B,EAAuB,MAAM,cAAc,CAAC;AAEpF;;;;;;;GAOG;AACH,wBAAgB,iCAAiC,CAAC,MAAM,EAAE,OAAO,GAAG,0BAA0B,CA0F7F"}
|