fixed building on windows
This commit is contained in:
parent
7e9ad7c793
commit
27789f94d2
|
@ -24,7 +24,7 @@ required-features = ["ed25519", "clap", "rpassword", "base64"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
rand = "0.8.4"
|
rand = "0.8.4"
|
||||||
clap = {version = "3.0.0-beta.5", optional = true}
|
clap = {version = "3.0.0-beta.5", optional = true, features = ["derive"]}
|
||||||
base64 = {version = "0.13.0", optional = true}
|
base64 = {version = "0.13.0", optional = true}
|
||||||
bytes = {version = "1.1.0", optional = true}
|
bytes = {version = "1.1.0", optional = true}
|
||||||
osshkeys = {git = "https://github.com/noonebtw/rust-osshkeys.git", branch = "master", optional = true}
|
osshkeys = {git = "https://github.com/noonebtw/rust-osshkeys.git", branch = "master", optional = true}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
use std::{fs::Permissions, io::Write};
|
use std::io::Write;
|
||||||
|
|
||||||
|
#[macro_use]
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use libduralumin::ed25519::{generate_ed25519_keypair, randomart};
|
use libduralumin::ed25519::{generate_ed25519_keypair, randomart};
|
||||||
use osshkeys::{error::OsshResult, PublicParts};
|
use osshkeys::{error::OsshResult, PublicParts};
|
||||||
|
@ -83,16 +84,15 @@ fn main() -> OsshResult<()> {
|
||||||
println!("Using passphrase to encrypt key..");
|
println!("Using passphrase to encrypt key..");
|
||||||
}
|
}
|
||||||
|
|
||||||
let fingerprint =
|
let fingerprint = keypair.fingerprint(osshkeys::keys::FingerprintHash::SHA256)?;
|
||||||
keypair.fingerprint(osshkeys::keys::FingerprintHash::SHA256)?;
|
|
||||||
|
|
||||||
println!(
|
println!(
|
||||||
"Your key fingerprint is: Sha256:{}",
|
"Your key fingerprint is: Sha256:{}",
|
||||||
base64::encode(&fingerprint)
|
base64::encode(&fingerprint)
|
||||||
);
|
);
|
||||||
|
|
||||||
let randomart = randomart::RandomArt::from_digest(&fingerprint)
|
let randomart =
|
||||||
.render("ED25519 256", "SHA256")?;
|
randomart::RandomArt::from_digest(&fingerprint).render("ED25519 256", "SHA256")?;
|
||||||
|
|
||||||
println!("RandomArt:\n{}", randomart);
|
println!("RandomArt:\n{}", randomart);
|
||||||
|
|
||||||
|
@ -108,6 +108,9 @@ fn main() -> OsshResult<()> {
|
||||||
let public_key = keypair.serialize_publickey()?;
|
let public_key = keypair.serialize_publickey()?;
|
||||||
std::fs::write(&public_path, public_key)?;
|
std::fs::write(&public_path, public_key)?;
|
||||||
|
|
||||||
|
#[cfg(target_family = "unix")]
|
||||||
|
use std::fs::Permissions;
|
||||||
|
#[cfg(target_family = "unix")]
|
||||||
use std::os::unix::fs::PermissionsExt;
|
use std::os::unix::fs::PermissionsExt;
|
||||||
|
|
||||||
#[cfg(target_family = "unix")]
|
#[cfg(target_family = "unix")]
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#[macro_use]
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use libduralumin::passphrase_gen::{PassPhraseGenerator, Words};
|
use libduralumin::passphrase_gen::{PassPhraseGenerator, Words};
|
||||||
|
|
||||||
|
@ -69,12 +70,8 @@ fn main() {
|
||||||
.with_length(opts.words_per_passphrase());
|
.with_length(opts.words_per_passphrase());
|
||||||
|
|
||||||
let words = match opts.backend() {
|
let words = match opts.backend() {
|
||||||
Some(Backend::UseAPassPhrase) => {
|
Some(Backend::UseAPassPhrase) => Words::from_str(include_str!("../../useapassphrase.txt")),
|
||||||
Words::from_str(include_str!("../../useapassphrase.txt"))
|
Some(Backend::EnglishWords) => Words::from_str(include_str!("../../words_alpha.txt")),
|
||||||
}
|
|
||||||
Some(Backend::EnglishWords) => {
|
|
||||||
Words::from_str(include_str!("../../words_alpha.txt"))
|
|
||||||
}
|
|
||||||
None => {
|
None => {
|
||||||
panic!("invalid backend.")
|
panic!("invalid backend.")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue