diff --git a/sdk/src/signature.rs b/sdk/src/signature.rs index 08b8ad3ca1..278e2ca65d 100644 --- a/sdk/src/signature.rs +++ b/sdk/src/signature.rs @@ -333,9 +333,8 @@ pub fn read_keypair(reader: &mut R) -> Result Result> { - assert!(path != "-"); - let mut file = File::open(path.to_string())?; +pub fn read_keypair_file>(path: F) -> Result> { + let mut file = File::open(path.as_ref())?; read_keypair(&mut file) } @@ -349,12 +348,13 @@ pub fn write_keypair( Ok(serialized) } -pub fn write_keypair_file( +pub fn write_keypair_file>( keypair: &Keypair, - outfile: &str, + outfile: F, ) -> Result> { - assert!(outfile != "-"); - if let Some(outdir) = Path::new(outfile).parent() { + let outfile = outfile.as_ref(); + + if let Some(outdir) = outfile.parent() { fs::create_dir_all(outdir)?; }