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

Function write_key_file

atomic-cli/tests/it/git_binding_cb6a_test.rs:47–56  ·  view source on GitHub ↗

Hex-encoded deterministic signing key file (test-owned, never the global identity store).

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

Source from the content-addressed store, hash-verified

45/// Hex-encoded deterministic signing key file (test-owned, never the global
46/// identity store).
47fn write_key_file(root: &Path, name: &str, seed: u8) -> std::path::PathBuf {
48 let mut secret = [0u8; 32];
49 for (index, byte) in secret.iter_mut().enumerate() {
50 *byte = seed.wrapping_add((index as u8) * 7 + 11);
51 }
52 let hex: String = secret.iter().map(|byte| format!("{byte:02x}")).collect();
53 let path = root.join(name);
54 fs::write(&path, hex).expect("write key file");
55 path
56}
57
58fn setup_fixture(root: &Path, home: &Path) {
59 {

Calls 4

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

Tested by

no test coverage detected