Rename and Format
This commit is contained in:
parent
53337d16f8
commit
6ff40ec75e
|
@ -1,12 +1,12 @@
|
||||||
use tapir::acns::tor::authentication::HashedPassword;
|
|
||||||
use ed25519_dalek::SecretKey;
|
use ed25519_dalek::SecretKey;
|
||||||
use tapir::primitives::identity::Identity;
|
|
||||||
use tapir::connections::{OutboundConnection, Connection, ConnectionInterface};
|
|
||||||
use tapir::primitives::transcript::Transcript;
|
|
||||||
use tapir::applications::authentication_app::{AuthenicationApp, AUTHENTICATION_CAPABILITY};
|
|
||||||
use tapir::connections::service::Service;
|
|
||||||
use rand::rngs::OsRng;
|
use rand::rngs::OsRng;
|
||||||
use tapir::acns::tor::TorProcess;
|
use tapir_cwtch::acns::tor::authentication::HashedPassword;
|
||||||
|
use tapir_cwtch::acns::tor::TorProcess;
|
||||||
|
use tapir_cwtch::applications::authentication_app::{AuthenicationApp, AUTHENTICATION_CAPABILITY};
|
||||||
|
use tapir_cwtch::connections::service::Service;
|
||||||
|
use tapir_cwtch::connections::{Connection, ConnectionInterface, OutboundConnection};
|
||||||
|
use tapir_cwtch::primitives::identity::Identity;
|
||||||
|
use tapir_cwtch::primitives::transcript::Transcript;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut auth_control_port = TorProcess::connect(9051)
|
let mut auth_control_port = TorProcess::connect(9051)
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
use tapir::acns::tor::authentication::HashedPassword;
|
|
||||||
use ed25519_dalek::SecretKey;
|
use ed25519_dalek::SecretKey;
|
||||||
use tapir::primitives::identity::Identity;
|
|
||||||
use tapir::connections::{Connection, InboundConnection, ConnectionInterface};
|
|
||||||
use tapir::primitives::transcript::Transcript;
|
|
||||||
use tapir::applications::authentication_app::AuthenicationApp;
|
|
||||||
use tapir::connections::service::Service;
|
|
||||||
use rand::rngs::OsRng;
|
use rand::rngs::OsRng;
|
||||||
use tapir::acns::tor::TorProcess;
|
use tapir_cwtch::acns::tor::authentication::HashedPassword;
|
||||||
|
use tapir_cwtch::acns::tor::TorProcess;
|
||||||
|
use tapir_cwtch::applications::authentication_app::AuthenicationApp;
|
||||||
|
use tapir_cwtch::connections::service::Service;
|
||||||
|
use tapir_cwtch::connections::{Connection, ConnectionInterface, InboundConnection};
|
||||||
|
use tapir_cwtch::primitives::identity::Identity;
|
||||||
|
use tapir_cwtch::primitives::transcript::Transcript;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut auth_control_port = TorProcess::connect(9051)
|
let mut auth_control_port = TorProcess::connect(9051)
|
||||||
|
@ -29,12 +29,8 @@ fn main() {
|
||||||
let mut transcript = Transcript::new_transcript("tapir-transcript");
|
let mut transcript = Transcript::new_transcript("tapir-transcript");
|
||||||
let mut auth_app = AuthenicationApp::new(identity);
|
let mut auth_app = AuthenicationApp::new(identity);
|
||||||
match auth_app.run_inbound(conn, &mut transcript) {
|
match auth_app.run_inbound(conn, &mut transcript) {
|
||||||
Ok(conn) => {
|
Ok(conn) => println!("Authenticated Inbound Connection from {}", conn.hostname()),
|
||||||
println!("Authenticated Inbound Connection from {}", conn.hostname())
|
_ => println!("Failed Inbound Authentication"),
|
||||||
}
|
|
||||||
_ => {
|
|
||||||
println!("Failed Inbound Authentication")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::applications::authentication_app::AuthenticationAppError::NotAuthenticatedError;
|
use crate::applications::authentication_app::AuthenticationAppError::NotAuthenticatedError;
|
||||||
use crate::connections::utils::public_key_to_hostname;
|
use crate::connections::utils::public_key_to_hostname;
|
||||||
use crate::connections::{Connection, ConnectionInterface, InboundConnection, OutboundConnection, Capability};
|
use crate::connections::{Capability, Connection, ConnectionInterface, InboundConnection, OutboundConnection};
|
||||||
use crate::primitives::identity::Identity;
|
use crate::primitives::identity::Identity;
|
||||||
use crate::primitives::transcript::Transcript;
|
use crate::primitives::transcript::Transcript;
|
||||||
use ed25519_dalek::PublicKey;
|
use ed25519_dalek::PublicKey;
|
||||||
|
@ -36,7 +36,10 @@ struct AuthenticationSession<Direction> {
|
||||||
conn: Connection<Direction>,
|
conn: Connection<Direction>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<Direction> AuthenticationSession<Direction> where Direction:Clone {
|
impl<Direction> AuthenticationSession<Direction>
|
||||||
|
where
|
||||||
|
Direction: Clone,
|
||||||
|
{
|
||||||
pub fn new_outbound(conn: Connection<OutboundConnection>, long_term_identity: Arc<Identity>) -> AuthenticationSession<OutboundConnection> {
|
pub fn new_outbound(conn: Connection<OutboundConnection>, long_term_identity: Arc<Identity>) -> AuthenticationSession<OutboundConnection> {
|
||||||
let ephemeral_identity = Identity::initialize_ephemeral_identity();
|
let ephemeral_identity = Identity::initialize_ephemeral_identity();
|
||||||
let mut auth_session = AuthenticationSession {
|
let mut auth_session = AuthenticationSession {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
|
use hashbrown::HashSet;
|
||||||
use integer_encoding::{FixedInt, VarInt};
|
use integer_encoding::{FixedInt, VarInt};
|
||||||
use secretbox::CipherType::Salsa20;
|
use secretbox::CipherType::Salsa20;
|
||||||
use secretbox::SecretBox;
|
use secretbox::SecretBox;
|
||||||
use std::io::{Error, Read, Write};
|
use std::io::{Error, Read, Write};
|
||||||
use std::net::{Shutdown, TcpStream};
|
use std::net::{Shutdown, TcpStream};
|
||||||
use hashbrown::HashSet;
|
|
||||||
|
|
||||||
/// Connections provides an interface for manage sets of connections on top of a particular
|
/// Connections provides an interface for manage sets of connections on top of a particular
|
||||||
/// ACN.
|
/// ACN.
|
||||||
|
@ -25,13 +25,12 @@ pub struct OutboundConnection(());
|
||||||
#[derive(Clone, Eq, PartialEq, Hash)]
|
#[derive(Clone, Eq, PartialEq, Hash)]
|
||||||
pub struct Capability(pub &'static str);
|
pub struct Capability(pub &'static str);
|
||||||
|
|
||||||
|
|
||||||
pub struct Connection<Direction> {
|
pub struct Connection<Direction> {
|
||||||
conn: TcpStream,
|
conn: TcpStream,
|
||||||
direction: Direction,
|
direction: Direction,
|
||||||
key: Vec<u8>,
|
key: Vec<u8>,
|
||||||
hostname: String,
|
hostname: String,
|
||||||
capabilities: HashSet<Capability>
|
capabilities: HashSet<Capability>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait ConnectionInterface {
|
pub trait ConnectionInterface {
|
||||||
|
@ -151,7 +150,7 @@ where
|
||||||
direction: InboundConnection(()),
|
direction: InboundConnection(()),
|
||||||
key: vec![],
|
key: vec![],
|
||||||
hostname: String::new(),
|
hostname: String::new(),
|
||||||
capabilities: HashSet::new()
|
capabilities: HashSet::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +160,7 @@ where
|
||||||
direction: OutboundConnection(()),
|
direction: OutboundConnection(()),
|
||||||
key: vec![],
|
key: vec![],
|
||||||
hostname: String::new(),
|
hostname: String::new(),
|
||||||
capabilities: HashSet::new()
|
capabilities: HashSet::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,7 +170,7 @@ where
|
||||||
direction: self.direction.clone(),
|
direction: self.direction.clone(),
|
||||||
key: self.key.clone(),
|
key: self.key.clone(),
|
||||||
hostname: self.hostname.clone(),
|
hostname: self.hostname.clone(),
|
||||||
capabilities: self.capabilities.clone()
|
capabilities: self.capabilities.clone(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue