Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: fixing documentation in CI #392

Merged
merged 5 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions compat_tester/webauthn-rs-demo/src/actors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use webauthn_rs_core::proto::{
};
use webauthn_rs_core::proto::{AuthenticationState, RegistrationState};

use webauthn_rs::{prelude::Uuid, Webauthn, WebauthnBuilder};
use webauthn_rs::{prelude::Uuid, Webauthn, WebauthnBuilder, DEFAULT_AUTHENTICATOR_TIMEOUT};
use webauthn_rs_core::WebauthnCore;
use webauthn_rs_demo_shared::*;

Expand Down Expand Up @@ -61,7 +61,7 @@ impl WebauthnActor {
&rp_name,
&rp_id,
vec![rp_origin.to_owned()],
None,
DEFAULT_AUTHENTICATOR_TIMEOUT,
None,
None,
);
Expand Down
1 change: 1 addition & 0 deletions fido-key-manager/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use std::time::Duration;
use tokio_stream::StreamExt;
#[cfg(feature = "solokey")]
use webauthn_authenticator_rs::ctap2::SoloKeyAuthenticator;
#[cfg(feature = "solokey")]
use webauthn_authenticator_rs::prelude::WebauthnCError;
use webauthn_authenticator_rs::{
ctap2::{
Expand Down
2 changes: 1 addition & 1 deletion webauthn-authenticator-rs/examples/authenticate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ async fn main() {
"https://localhost:8080/auth",
"localhost",
vec![url::Url::parse("https://localhost:8080").unwrap()],
Some(Duration::from_millis(1)),
Duration::from_secs(60),
None,
None,
);
Expand Down
5 changes: 4 additions & 1 deletion webauthn-authenticator-rs/src/softpasskey.rs
Original file line number Diff line number Diff line change
Expand Up @@ -523,19 +523,22 @@ impl U2FToken for SoftPasskey {
mod tests {
use super::SoftPasskey;
use crate::prelude::{Url, WebauthnAuthenticator};
use std::time::Duration;
use webauthn_rs_core::WebauthnCore as Webauthn;
use webauthn_rs_proto::{
AttestationConveyancePreference, COSEAlgorithm, UserVerificationPolicy,
};

const AUTHENTICATOR_TIMEOUT: Duration = Duration::from_secs(60);

#[test]
fn webauthn_authenticator_wan_softpasskey_self_attest() {
let _ = tracing_subscriber::fmt::try_init();
let wan = Webauthn::new_unsafe_experts_only(
"https://localhost:8080/auth",
"localhost",
vec![url::Url::parse("https://localhost:8080").unwrap()],
None,
AUTHENTICATOR_TIMEOUT,
None,
None,
);
Expand Down
8 changes: 5 additions & 3 deletions webauthn-authenticator-rs/src/softtoken.rs
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ impl AuthenticatorBackendHashedClientData for SoftTokenFile {
mod tests {
use super::*;
use openssl::{hash::MessageDigest, rand::rand_bytes, sign::Verifier, x509::X509};
use std::collections::BTreeSet;
use std::{collections::BTreeSet, time::Duration};
use tempfile::tempfile;
use webauthn_rs_core::{
proto::{AttestationCa, AttestationCaList, COSEKey},
Expand All @@ -876,14 +876,16 @@ mod tests {
softtoken::SoftToken,
};

const AUTHENTICATOR_TIMEOUT: Duration = Duration::from_secs(60);

#[test]
fn webauthn_authenticator_wan_softtoken_direct_attest() {
let _ = tracing_subscriber::fmt::try_init();
let wan = Webauthn::new_unsafe_experts_only(
"https://localhost:8080/auth",
"localhost",
vec![url::Url::parse("https://localhost:8080").unwrap()],
None,
AUTHENTICATOR_TIMEOUT,
None,
None,
);
Expand Down Expand Up @@ -962,7 +964,7 @@ mod tests {
"https://localhost:8080/auth",
"localhost",
vec![url::Url::parse("https://localhost:8080").unwrap()],
None,
AUTHENTICATOR_TIMEOUT,
None,
None,
);
Expand Down
40 changes: 30 additions & 10 deletions webauthn-authenticator-rs/src/stubs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,21 @@ pub mod tokio {
}
pub mod sync {
pub mod mpsc {
pub struct Sender<T> {}
pub struct Receiver<T> {}
pub struct Sender<T> {
_phantom: std::marker::PhantomData<T>,
}
pub struct Receiver<T> {
_phantom: std::marker::PhantomData<T>,
}
}
}
pub mod time {
pub async fn sleep(_: std::time::Duration) {}
}
pub mod task {
pub struct JoinHandle<T> {}
pub struct JoinHandle<T> {
_phantom: std::marker::PhantomData<T>,
}
pub fn spawn<A, B>(future: A) -> JoinHandle<B> {}
pub fn spawn_blocking() {}
}
Expand All @@ -71,7 +77,9 @@ pub mod tokio {
#[cfg(not(feature = "ctap2"))]
pub mod tokio_stream {
pub mod wrappers {
pub struct ReceiverStream<T> {}
pub struct ReceiverStream<T> {
_phantom: std::marker::PhantomData<T>,
}
}
}

Expand All @@ -85,8 +93,12 @@ pub mod tokio_tungstenite {
}
}
}
pub struct MaybeTlsStream<T> {}
pub struct WebSocketStream<T> {}
pub struct MaybeTlsStream<T> {
_phantom: std::marker::PhantomData<T>,
}
pub struct WebSocketStream<T> {
_phantom: std::marker::PhantomData<T>,
}
}

#[cfg(not(any(feature = "bluetooth", feature = "cable")))]
Expand Down Expand Up @@ -120,9 +132,13 @@ pub mod openssl {
pub struct BigNumContext {}
}
pub mod ec {
pub struct EcKey<T> {}
pub struct EcKey<T> {
_phantom: std::marker::PhantomData<T>,
}
pub struct EcGroup {}
pub struct EcKeyRef<T> {}
pub struct EcKeyRef<T> {
_phantom: std::marker::PhantomData<T>,
}
pub struct EcPoint {}
pub struct EcPointRef {}
pub enum PointConversionForm {}
Expand All @@ -132,8 +148,12 @@ pub mod openssl {
}
pub mod pkey {
pub struct Id {}
pub struct PKey<T> {}
pub struct PKeyRef<T> {}
pub struct PKey<T> {
_phantom: std::marker::PhantomData<T>,
}
pub struct PKeyRef<T> {
_phantom: std::marker::PhantomData<T>,
}
pub struct Private {}
pub struct Public {}
}
Expand Down
3 changes: 0 additions & 3 deletions webauthn-rs-core/src/constants.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
use std::time::Duration;

// Can this ever change?
pub const CHALLENGE_SIZE_BYTES: usize = 32;
pub const DEFAULT_AUTHENTICATOR_TIMEOUT: Duration = Duration::from_millis(60000);
Loading
Loading