Skip to content

Commit

Permalink
Add env_logger and fix comments and server configuration
Browse files Browse the repository at this point in the history
Added "env_logger" package to Cargo.toml to enable environment-based logging. Corrected a grammatical error in a comment within src/authn.rs. Made improvements to the server configuration in src/main.rs to properly serve the app and handle potential errors.
  • Loading branch information
arkavo-com committed Jul 15, 2024
1 parent 89fc2ce commit fac4e50
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ tower-sessions = "0.12.2"
thiserror = "1.0.62"
log = "0.4.22"
serde = { version = "1.0.204", features = ["derive"] }
serde_json = "1.0.120"
serde_json = "1.0.120"
env_logger ="0.11.3"
2 changes: 1 addition & 1 deletion src/authn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ pub async fn start_register(
Ok(res)
}

// 3. The browser has completed it's steps and the user has created a public key
// 3. The browser has completed its steps and the user has created a public key
// on their device. Now we have the registration options sent to us, and we need
// to verify these and persist them.

Expand Down
9 changes: 5 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ mod authn;

#[tokio::main]
async fn main() {
env_logger::init();
// Load configuration
let settings = load_config().unwrap();
// Load and cache the apple-app-site-association.json file
Expand Down Expand Up @@ -66,7 +67,10 @@ async fn main() {
.await
.unwrap();
} else {
axum_server::from_tcp(listener);
axum_server::from_tcp(listener)
.serve(app.into_make_service())
.await
.unwrap();
}
}

Expand All @@ -90,15 +94,12 @@ impl AppState {
let builder = WebauthnBuilder::new(rp_id, &rp_origin).expect("Invalid configuration");
// Relying party name
let builder = builder.rp_name("Arkavo");

// Consume the builder and create our webauthn instance.
let webauthn = Arc::new(builder.build().expect("Invalid configuration"));

let users = Arc::new(Mutex::new(AccountData {
name_to_id: HashMap::new(),
keys: HashMap::new(),
}));

AppState { webauthn, accounts: users }
}
}
Expand Down

0 comments on commit fac4e50

Please sign in to comment.