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

Function write_private_key

plugins/wss-proxy-plugin/src/certs.rs:14–24  ·  view source on GitHub ↗
(path: PathBuf, contents: &[u8])

Source from the content-addressed store, hash-verified

12use crate::options::WssproxyOptions;
13
14fn write_private_key(path: PathBuf, contents: &[u8]) -> Result<(), Error> {
15 use std::io::Write;
16 use std::os::unix::fs::PermissionsExt;
17
18 let mut file = fs::File::create(&path)?;
19 let mut perms = fs::metadata(&path)?.permissions();
20 perms.set_mode(0o600);
21 fs::set_permissions(&path, perms)?;
22 file.write_all(contents)?;
23 Ok(())
24}
25
26pub fn generate_certificates(certs_path: &PathBuf, wss_host: &[String]) -> Result<(), Error> {
27 /* Generate the CA certificate */

Callers 1

generate_certificatesFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected