Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joyqvq committed Nov 30, 2024
1 parent d7eb7b0 commit 1855078
Show file tree
Hide file tree
Showing 7 changed files with 543 additions and 247 deletions.
45 changes: 3 additions & 42 deletions crates/sui-e2e-tests/tests/passkey_e2e_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,48 +34,8 @@ use sui_types::{
use test_cluster::TestCluster;
use test_cluster::TestClusterBuilder;
use url::Url;

struct MyUserValidationMethod {}
#[async_trait::async_trait]
impl UserValidationMethod for MyUserValidationMethod {
async fn check_user_presence(&self) -> bool {
true
}

async fn check_user_verification(&self) -> bool {
true
}

fn is_verification_enabled(&self) -> Option<bool> {
Some(true)
}

fn is_presence_enabled(&self) -> bool {
true
}
}

/// A helper struct for passkey response and transaction construction.
pub struct PasskeyResponse<T> {
user_sig_bytes: Vec<u8>,
authenticator_data: Vec<u8>,
client_data_json: String,
intent_msg: IntentMessage<T>,
}

/// Submits a transaction to the test cluster and returns the result.
async pub fn execute_tx(tx: Transaction, test_cluster: &TestCluster) -> SuiResult {
test_cluster
.authority_aggregator()
.authority_clients
.values()
.next()
.unwrap()
.authority_client()
.handle_transaction(tx, Some(SocketAddr::new([127, 0, 0, 1].into(), 0)))
.await
.map(|_| ())
}
pub mod passkey_util;
use passkey_util::{execute_tx, MyUserValidationMethod, PasskeyResponse};

/// Register a new passkey, derive its address, fund it with gas and create a test
/// transaction, then get a response from the passkey from signing.
Expand Down Expand Up @@ -202,6 +162,7 @@ async fn create_credential_and_sign_test_tx(
let client_data_json = authenticated_cred.response.client_data_json.as_slice();

PasskeyResponse {
sender,
user_sig_bytes,
authenticator_data: authenticator_data.to_vec(),
client_data_json: String::from_utf8_lossy(client_data_json).to_string(),
Expand Down
171 changes: 0 additions & 171 deletions crates/sui-e2e-tests/tests/passkey_session_e2e_test.rs

This file was deleted.

Loading

0 comments on commit 1855078

Please sign in to comment.