Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/io/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@
// http://opensource.org/licenses/MIT>, at your option. You may not use this file except in
// accordance with one or both of these licenses.

use std::fs;
use std::fs::{self, OpenOptions};
use std::io::Write;
use std::ops::Deref;
use std::path::Path;
use std::sync::Arc;

#[cfg(unix)]
use std::os::unix::fs::OpenOptionsExt;

use bdk_chain::indexer::keychain_txout::ChangeSet as BdkIndexerChangeSet;
use bdk_chain::local_chain::ChangeSet as BdkLocalChainChangeSet;
use bdk_chain::miniscript::{Descriptor, DescriptorPublicKey};
Expand Down Expand Up @@ -78,7 +81,11 @@ pub(crate) fn read_or_generate_seed_file(
fs::create_dir_all(parent_dir)?;
}

let mut f = fs::File::create(keys_seed_path)?;
#[cfg(unix)]
let mut f = OpenOptions::new().write(true).create_new(true).mode(0o400).open(keys_seed_path)?;

#[cfg(not(unix))]
let mut f = OpenOptions::new().write(true).create_new(true).open(keys_seed_path)?;

f.write_all(&key)?;

Expand Down
Loading