MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / make_key_file

Function make_key_file

nodedb/src/control/security/keystore/file.rs:74–86  ·  view source on GitHub ↗
(
        dir: &std::path::Path,
        name: &str,
        mode: u32,
        content: &[u8],
    )

Source from the content-addressed store, hash-verified

72 /// Create a regular file with given mode (Unix) or default perms (non-Unix).
73 #[cfg(unix)]
74 fn make_key_file(
75 dir: &std::path::Path,
76 name: &str,
77 mode: u32,
78 content: &[u8],
79 ) -> std::path::PathBuf {
80 let path = dir.join(name);
81 let mut f = std::fs::File::create(&path).unwrap();
82 f.write_all(content).unwrap();
83 drop(f);
84 std::fs::set_permissions(&path, std::fs::Permissions::from_mode(mode)).unwrap();
85 path
86 }
87
88 #[tokio::test]
89 #[cfg(unix)]

Callers 6

file_roundtrip_0o600Function · 0.85
file_roundtrip_0o400Function · 0.85
file_0o644_rejectedFunction · 0.85
symlink_rejectedFunction · 0.85
file_wrong_size_rejectedFunction · 0.85
file_rotate_rereadsFunction · 0.85

Calls 2

joinMethod · 0.80
createFunction · 0.50

Tested by

no test coverage detected