Skip to content

Commit 4f81445

Browse files
committed
test(core): pin to_seed's Zeroizing return type, drop duplicate round-trip
The to_seed_is_sole_seed_accessor test was named for a compile-time property its body couldn't assert, and its from_seed -> DID check duplicated from_seed_round_trip. Replace it with a type-annotated binding that fails to compile if to_seed ever returns a bare [u8; 32] again, plus the determinism check, which is the only behavior it uniquely covered.
1 parent d453182 commit 4f81445

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

‎crates/gitlawb-core/src/identity.rs‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,17 @@ mod tests {
169169
}
170170

171171
// `to_seed()` is the only seed accessor on `Keypair` (the raw, unzeroized
172-
// `seed_bytes()` was removed in #41). It must hand out the seed
173-
// deterministically, so the same seed reconstructs the same DID.
172+
// `seed_bytes()` was removed in #41). Pin its return type so a bare-array
173+
// accessor can't slip back in, and confirm it is deterministic. The
174+
// from_seed -> verifying_key round-trip is already covered by
175+
// `from_seed_round_trip`.
174176
#[test]
175-
fn to_seed_is_sole_seed_accessor() {
177+
fn to_seed_returns_zeroizing_and_is_deterministic() {
176178
let kp = Keypair::generate();
177-
let seed = kp.to_seed();
179+
// The type annotation is the regression guard: the seed must be handed
180+
// out wrapped in `Zeroizing`, never as a bare `[u8; 32]`.
181+
let seed: Zeroizing<[u8; 32]> = kp.to_seed();
178182
assert_eq!(*kp.to_seed(), *seed); // stable across calls
179-
assert_eq!(Keypair::from_seed(&seed).unwrap().did(), kp.did());
180183
}
181184

182185
#[test]

0 commit comments

Comments
 (0)