feat(keys): the content-address layer — canonical hash derivation and key encoding (ADR-002)

Wave 1 task core-hashing-keys: the crate's declared one-way door,
implemented byte-exact to ADR-002.

- src/hashing.rs: Algorithm (exactly GitBlobSha256 canonical /
  GitBlobSha1 tolerated; BLAKE3 absent), Digest (known-length
  derivation H("blob <len>\0" + content) as primary constructor;
  from_git_oid_hex interop constructor, lowercase-only acceptance),
  and the hashing::registry constants (0x01/0x02, 0x00 reserved; new
  algorithm = new ADR)
- src/keys.rs: typed Key wrapper; as_bytes/from_bytes are the only
  backend-boundary conversions; 1 algorithm byte + digest bytes
  (33/21 total); rejects-never-guesses validation -> Error::KeyInvalid
- tests/git_interop.rs: the load-bearing test — byte-exact derivation
  against the `git hash-object` CLI, both algorithms, small and
  75-KiB content; external-oid round-trip into pool keys; both oid
  formats coexisting in one flat pool
- named design point (oid hex policy): lowercase-only acceptance,
  recorded in the task Notes and on from_git_oid_hex

Verified: cargo test (15 passed), cargo clippy --all-targets -- -D
warnings, cargo fmt --check, cargo test --all-features — all green.
This commit is contained in:
glm-5.3-flash committed 2026-10-11 18:20:12 +00:00
1 parent fc5ab57d18
commit fef05b4ec5
6 files changed
+775 -13

No files matched your search

+3
View File
@@ -32,5 +32,8 @@ parking_lot = "0.12"
alkcall = { version = "0.8.1", optional = true }
deadpool-postgres = { version = "0.14", optional = true }
hex = "0.4"
rusqlite = { version = "0.40", features = ["bundled"], optional = true }
sha1 = "0.10"
sha2 = "0.10"
tokio-postgres = { version = "0.7", optional = true }