$ npm run test
npm notice run autonet@1.0.0 test
npm notice run node --import tsx --test test/*.test.ts
6 RFC 8949 B'4.2.1 Deterministic CBOR Encoding
passes RFC 8949 Appendix A minimal encoding and types (15.129338ms)
sorts mixed-length string keys by length first, then bytewise (1.224474ms)
sorts equal-length keys bytewise (1.127748ms)
encodes Map identically to equivalent plain object (2.05384ms)
rejects unsupported types (undefined, NaN, Set) (5.867195ms)
prepareForSignature produces domain || 0x00 || canonical_cbor(bytes)
(1.834535ms)
GOLDEN HASH: Proof payload struct (2.359686ms)
RFC 8949 B'4.2.1 Deterministic CBOR Encoding (36.710412ms)
6 Negative Security Test Suite (Attack Vectors)
6 1. Cryptographic Domain Separation
rejects cross-domain signature replay (10.84541ms)
1. Cryptographic Domain Separation (15.130023ms)
6 2. Routing and Hops (Hop Tampering)
rejects envelope if hops are tampered (breaks hash chain) (12.458529ms)
2. Routing and Hops (Hop Tampering) (14.260063ms)
6 3. Capability Attenuation (Scope & Target Widening)
rejects scope widening (child claims scope parent lacks) (6.533739ms)
rejects
target widening (child claims broader target than parent) (2.138306ms)
3. Capability Attenuation (Scope & Target Widening) (10.181513ms)
6 4. Capability Proof & Origin Rules
rejects chain-origin violation (chain[0].holder !== root_block.subject)
(1.155286ms)
rejects stale proof (presented_at outside CLOCK_SKEW_TOLERANCE)
(2.106398ms)
4. Capability Proof & Origin Rules (5.290617ms)
6 5. Consumption Replay Defense
rejects second presentation using the correct consumption key
(2.102954ms)
5. Consumption Replay Defense (10.576622ms)
Negative Security Test Suite (Attack Vectors) (60.031223ms)
9 tests 14
9 suites 7
9 pass 14
9 fail 0
9 cancelled 0
9 skipped 0
9 todo 0
9 duration_ms 1202.725897
$