test(entropy,hmac,ed25519): cover domain constants, JWK shapes, clone/debug invariants#703
test(entropy,hmac,ed25519): cover domain constants, JWK shapes, clone/debug invariants#703EffortlessSteven wants to merge 1 commit into
Conversation
…/debug invariants entropy: - Pin DOMAIN_ENTROPY_FIXTURE constant (part of every consumer's cache key). - bytes(0) returns empty; fill_bytes(&mut []) is a no-op. - fill_bytes_with_variant matches bytes_with_variant for the same variant. - Clone preserves bytes, label, variant. - Debug includes label/variant but never byte material (hex form check). - Default variant on the fixture handle propagates through bytes() and variant-bound fixtures produce the same material as explicit variant calls on the default fixture. hmac: - Pin DOMAIN_HMAC_SECRET constant. - Clone preserves secret_bytes, label, spec (single + chained clones). - Debug must not contain raw secret bytes (hex form check). - JWK use_ field is exactly "sig" across HS256/HS384/HS512. - JWKS keys array has exactly one entry. ed25519: - Pin DOMAIN_ED25519_KEYPAIR constant. - PKCS#8 / SPKI DER outputs meet minimum length invariants. - PEM outputs have correct BEGIN headers. - public_jwk() exercises every OKP field shape and the x base64url decodes to 32 bytes; private_key_jwk() d decodes to 32 bytes. - public_jwks() cardinality is exactly 1; public_jwks_json() matches public_jwks().to_value(). - Clone preserves private/public DER and label.
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Port useful entropy/HMAC/Ed25519 coverage from stale #703 onto current main. - cover domain constants and deterministic clone/debug invariants - cover Ed25519 JWK/JWKS public material shapes - cover HMAC secret-shape/debug behavior without new no-panic debt Validation: hosted pr, perf, and GitGuardian checks passed on #727.
|
Closing as superseded by #727. The useful entropy/HMAC/Ed25519 coverage was ported onto current main, cleaned up for no-panic-style tests, validated, and merged there; this older draft branch is now stale. |
Summary
Closes small coverage gaps across three sibling fixture crates.
uselesskey-entropyDOMAIN_ENTROPY_FIXTUREconstant (part of every consumer's cache key — silent change would invalidate all deterministic outputs).bytes(0)returns empty;fill_bytes(&mut [])is a no-op.fill_bytes_with_variantmatchesbytes_with_variantfor the same variant.Clonepreserves bytes, label, variant.Debugincludes label/variant but never byte material (hex form check).bytes()and variant-bound fixtures produce the same material as explicit variant calls on the default fixture.uselesskey-hmacDOMAIN_HMAC_SECRETconstant.Clonepreservessecret_bytes,label,spec(single + chained clones).Debugmust not contain raw secret bytes (hex form check).use_field is exactly"sig"across HS256/HS384/HS512.uselesskey-ed25519DOMAIN_ED25519_KEYPAIRconstant.BEGINheaders.public_jwk()exercises every OKP field shape;xbase64url decodes to 32 bytes;private_key_jwk()ddecodes to 32 bytes.public_jwks()cardinality is exactly 1;public_jwks_json()matchespublic_jwks().to_value().Clonepreserves private/public DER and label.No production code changes; 3 new test files, all green.
Test plan
cargo test -p uselesskey-entropy -p uselesskey-hmac -p uselesskey-ed25519 --all-featurescargo fmt --checkfor each cratecargo clippy --all-features --all-targets -- -D warningsfor each crateGenerated by Claude Code