Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
broody committed Mar 21, 2024
1 parent cae78e1 commit e7593d0
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 32 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ cainome = { git = "https://github.com/piniom/cainome", tag="v0.2.4-expand", feat
"abigen-rs", "expand-expr"
] }
cairo-lang-starknet = "2.4.0"
coset = { version = "0.3.4", features = ["std"] }
futures = "0.3"
lazy_static = "1"
p256 = "0.13"
Expand Down
1 change: 0 additions & 1 deletion crates/account_sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ async-trait.workspace = true
base64.workspace = true
cainome.workspace = true
cairo-lang-starknet.workspace = true
coset.workspace = true
futures.workspace = true
lazy_static.workspace = true
p256.workspace = true
Expand Down
5 changes: 1 addition & 4 deletions crates/account_sdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,4 @@ pub mod session_token;

#[cfg(not(target_arch = "wasm32"))]

Check warning on line 9 in crates/account_sdk/src/lib.rs

View workflow job for this annotation

GitHub Actions / fmt

Diff in /home/runner/work/cairo-webauthn/cairo-webauthn/crates/account_sdk/src/lib.rs
#[cfg(test)]
pub mod tests;

#[cfg(target_arch = "wasm32")]
pub mod wasm_tests;
pub mod tests;
14 changes: 13 additions & 1 deletion crates/account_sdk/src/tests/webauthn/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ async fn test_verify_webauthn_explicit() {

let challenge = felt!("0x0169af1f6f99d35e0b80e0140235ec4a2041048868071a8654576223934726f5");
let challenge_bytes = challenge.to_bytes_be().to_vec();
let response = data.signer.sign(&challenge_bytes).await;
let response = data
.signer
.sign(&challenge_bytes)
.await
.expect("signer error");

let args = VerifyWebauthnSignerArgs::from_response(origin, challenge_bytes, response.clone());

Expand Down Expand Up @@ -112,3 +116,11 @@ async fn test_verify_webauthn_execute() {
.await;
result.unwrap();
}

#[tokio::test]
async fn test_signer() {
let rp_id = "https://localhost:8080".to_string();
let signer = P256r1Signer::random(rp_id);
let calldata = signer.sign("842903840923".as_bytes()).await.unwrap();
dbg!(&calldata);
}
1 change: 0 additions & 1 deletion crates/account_sdk/src/wasm_tests/mod.rs

This file was deleted.

14 changes: 0 additions & 14 deletions crates/account_sdk/src/wasm_tests/webauthn.rs

This file was deleted.

8 changes: 0 additions & 8 deletions crates/account_sdk/src/webauthn_signer/signers/p256r1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,3 @@ impl P256VerifyingKeyConverter {
)
}
}

// #[tokio::test]
// async fn test_signer() {
// let rp_id = "https://localhost:8080".to_string();
// let signer = P256r1Signer::random(rp_id);
// let calldata = signer.sign("842903840923".as_bytes()).await;
// dbg!(&calldata);
// }
2 changes: 1 addition & 1 deletion crates/webauthn/tests/src/auth/verify_ecdsa.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use account_sdk::webauthn_signer::P256VerifyingKeyConverter;
use account_sdk::webauthn_signer::signers::p256r1::P256VerifyingKeyConverter;
use p256::{
ecdsa::{signature::Signer, Signature, SigningKey},
elliptic_curve::{rand_core::OsRng, SecretKey},
Expand Down
2 changes: 1 addition & 1 deletion crates/webauthn/tests/src/auth/verify_signature.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use account_sdk::webauthn_signer::P256VerifyingKeyConverter;
use account_sdk::webauthn_signer::signers::p256r1::P256VerifyingKeyConverter;
use p256::{
ecdsa::{signature::Signer, Signature, SigningKey},
elliptic_curve::rand_core::OsRng,
Expand Down

0 comments on commit e7593d0

Please sign in to comment.