MCPcopy Create free account
hub / github.com/ElementsProject/lightning / write_private_key

Function write_private_key

plugins/rest-plugin/src/certs.rs:7–17  ·  view source on GitHub ↗
(path: PathBuf, contents: &[u8])

Source from the content-addressed store, hash-verified

5use std::path::{Path, PathBuf};
6
7fn write_private_key(path: PathBuf, contents: &[u8]) -> Result<(), Error> {
8 use std::io::Write;
9 use std::os::unix::fs::PermissionsExt;
10
11 let mut file = fs::File::create(&path)?;
12 let mut perms = fs::metadata(&path)?.permissions();
13 perms.set_mode(0o600);
14 fs::set_permissions(&path, perms)?;
15 file.write_all(contents)?;
16 Ok(())
17}
18
19pub fn generate_certificates(certs_path: &PathBuf, rest_host: &str) -> Result<(), Error> {
20 /* Generate the CA certificate */

Callers 1

generate_certificatesFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected