Skip to content
Open
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
8 changes: 3 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Command line arguments.
use clap::{Parser, Subcommand};
use dumbpipe::EndpointTicket;
use iroh::{endpoint::Connecting, Endpoint, EndpointAddr, SecretKey};
use iroh::{Endpoint, EndpointAddr, SecretKey, endpoint::Connecting};
use n0_snafu::{Result, ResultExt};
use std::{
io,
Expand Down Expand Up @@ -282,16 +282,14 @@ async fn copy_from_quinn(
}

/// Get the secret key or generate a new one.
///
/// Print the secret key to stderr if it was generated, so the user can save it.
fn get_or_create_secret() -> Result<SecretKey> {
match std::env::var("IROH_SECRET") {
Ok(secret) => SecretKey::from_str(&secret).context("invalid secret"),
Err(_) => {
let key = SecretKey::generate(&mut rand::rng());
eprintln!(
"using secret key {}",
data_encoding::HEXLOWER.encode(&key.to_bytes())
"generated new endpoint ID: {}",
data_encoding::HEXLOWER.encode(&*key.public())
);
Ok(key)
}
Expand Down
Loading