MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / write_key_file

Function write_key_file

atomic-cli/tests/it/git_anchor_cb7a_test.rs:85–94  ·  view source on GitHub ↗

Hex-encoded deterministic test signing key file — test-owned, never the global identity store (managed signing is CB-12B).

(root: &Path, name: &str, seed: u8)

Source from the content-addressed store, hash-verified

83/// Hex-encoded deterministic test signing key file — test-owned, never the
84/// global identity store (managed signing is CB-12B).
85fn write_key_file(root: &Path, name: &str, seed: u8) -> std::path::PathBuf {
86 let mut secret = [0u8; 32];
87 for (index, byte) in secret.iter_mut().enumerate() {
88 *byte = seed.wrapping_add((index as u8) * 7 + 11);
89 }
90 let hex: String = secret.iter().map(|byte| format!("{byte:02x}")).collect();
91 let path = root.join(name);
92 fs::write(&path, hex).expect("write key file");
93 path
94}
95
96/// Colocated fixture: a Git repository with one commit, imported into Atomic
97/// (RFC §6.1: the same conversion policy makes every layer equivalent).

Callers 2

newMethod · 0.70

Calls 4

iter_mutMethod · 0.80
writeFunction · 0.70
collectMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected