Skip to content

Commit 14c38ba

Browse files
committed
chore: comment out authentication login and logout logic for now
1 parent d0d24da commit 14c38ba

File tree

6 files changed

+202
-209
lines changed

6 files changed

+202
-209
lines changed

TODO.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,7 @@
33
## TODO List
44

55
31st September plan:
6-
- Look into authentication to login and then use it outside rrelayer.yaml
76
- Reread documentation
87
- TransactionSpeed code snippets tag default
98
- max_gas_price_multiplier: 4
10-
- Get CI builds / releases working
11-
12-
# AFTER
13-
14-
- Testing
15-
- loading up ALL supported gas providers so it works
16-
- Testing handling custom gas with http call
17-
- Create CI to run E2E tests on push
9+
- Get CI builds / releases working

crates/cli/Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ help:
44
cargo run -- auth --help
55
new:
66
cargo run -- new --path $(CURDIR)/../../playground
7-
start:
7+
auth_login:
8+
RUST_BACKTRACE=1 cargo run -- start --path $(CURDIR)/../../playground/example
9+
network_list_local: # using this with auth_login to see if i can get it working
10+
cargo run -- network list
11+
start_example:
812
RUST_BACKTRACE=1 cargo run -- start --path $(CURDIR)/../../playground/example
913
start_local:
1014
RUST_BACKTRACE=1 cargo run -- start --path $(CURDIR)/../../playground/local-node

crates/cli/src/commands/auth.rs

Lines changed: 137 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
use crate::credentials::{self, StoredCredentials};
1+
// use crate::credentials::{self, StoredCredentials};
2+
use crate::credentials::{self};
23
use crate::error::CliError;
34
use clap::Subcommand;
4-
use dialoguer::{Input, Password};
5+
// use dialoguer::{Input, Password};
56
use rand::Rng;
67
use rand::distributions::Alphanumeric;
78

@@ -10,17 +11,17 @@ pub enum AuthCommand {
1011
/// Show authentication status
1112
Status,
1213
/// Login and store credentials securely
13-
Login {
14-
/// Profile name (defaults to 'default')
15-
#[arg(long, short = 'p')]
16-
profile: Option<String>,
17-
},
14+
// Login {
15+
// /// Profile name (defaults to 'default')
16+
// #[arg(long, short = 'p')]
17+
// profile: Option<String>,
18+
// },
1819
/// Logout and remove stored credentials
19-
Logout {
20-
/// Profile name (defaults to 'default')
21-
#[arg(long, short = 'p')]
22-
profile: Option<String>,
23-
},
20+
// Logout {
21+
// /// Profile name (defaults to 'default')
22+
// #[arg(long, short = 'p')]
23+
// profile: Option<String>,
24+
// },
2425
/// List all stored profiles
2526
List,
2627
/// Generate an API key which you can then use in the network config
@@ -33,14 +34,14 @@ pub async fn handle_auth_command(cmd: &AuthCommand) -> Result<(), CliError> {
3334
AuthCommand::Status => {
3435
status().await;
3536
}
36-
AuthCommand::Login { profile } => {
37-
let profile_name = profile.as_deref().unwrap_or("default");
38-
login(profile_name).await?;
39-
}
40-
AuthCommand::Logout { profile } => {
41-
let profile_name = profile.as_deref().unwrap_or("default");
42-
logout(profile_name).await?;
43-
}
37+
// AuthCommand::Login { profile } => {
38+
// let profile_name = profile.as_deref().unwrap_or("default");
39+
// login(profile_name).await?;
40+
// }
41+
// AuthCommand::Logout { profile } => {
42+
// let profile_name = profile.as_deref().unwrap_or("default");
43+
// logout(profile_name).await?;
44+
// }
4445
AuthCommand::List => {
4546
list_profiles().await?;
4647
}
@@ -120,123 +121,123 @@ async fn status() -> () {
120121
println!(" Use 'rrelayer auth login' to store credentials securely.");
121122
}
122123

123-
async fn login(profile_name: &str) -> Result<(), CliError> {
124-
println!("🔐 Login to RRelayer");
125-
println!("===================");
126-
127-
// Get API URL
128-
let api_url: String = Input::new()
129-
.with_prompt("API URL")
130-
.default("http://localhost:3000".to_string())
131-
.interact_text()
132-
.map_err(|e| CliError::Input(format!("Failed to get API URL: {}", e)))?;
133-
134-
// Get username
135-
let username: String = Input::new()
136-
.with_prompt("Username")
137-
.interact_text()
138-
.map_err(|e| CliError::Input(format!("Failed to get username: {}", e)))?;
139-
140-
// Get password
141-
let password: String = Password::new()
142-
.with_prompt("Password")
143-
.interact()
144-
.map_err(|e| CliError::Input(format!("Failed to get password: {}", e)))?;
124+
// async fn login(profile_name: &str) -> Result<(), CliError> {
125+
// println!("🔐 Login to RRelayer");
126+
// println!("===================");
127+
//
128+
// // Get API URL
129+
// let api_url: String = Input::new()
130+
// .with_prompt("API URL")
131+
// .default("http://localhost:3000".to_string())
132+
// .interact_text()
133+
// .map_err(|e| CliError::Input(format!("Failed to get API URL: {}", e)))?;
134+
//
135+
// // Get username
136+
// let username: String = Input::new()
137+
// .with_prompt("Username")
138+
// .interact_text()
139+
// .map_err(|e| CliError::Input(format!("Failed to get username: {}", e)))?;
140+
//
141+
// // Get password
142+
// let password: String = Password::new()
143+
// .with_prompt("Password")
144+
// .interact()
145+
// .map_err(|e| CliError::Input(format!("Failed to get password: {}", e)))?;
146+
//
147+
// // Test the credentials
148+
// println!("\n🧪 Testing credentials...");
149+
// // let sdk = SDK::new(api_url.clone(), username.clone(), password.clone());
150+
// //
151+
// // match sdk.health.check().await {
152+
// // Ok(_) => {
153+
// // println!("✅ API server is reachable");
154+
// // }
155+
// // Err(e) => {
156+
// // println!("❌ Failed to reach API server: {}", e);
157+
// // return Err(CliError::Authentication(
158+
// // "API server is not reachable. Please check the URL and try again.".to_string(),
159+
// // ));
160+
// // }
161+
// // }
162+
// //
163+
// // match sdk.test_auth().await {
164+
// // Ok(_) => {
165+
// // println!("✅ Authentication successful");
166+
// // }
167+
// // Err(e) => {
168+
// // println!("❌ Authentication failed: {}", e);
169+
// // return Err(CliError::Authentication(
170+
// // "Invalid credentials. Please check your username and password.".to_string(),
171+
// // ));
172+
// // }
173+
// // }
174+
//
175+
// // Store credentials
176+
// let credentials = StoredCredentials { api_url, username, password };
177+
//
178+
// // Store credentials with detailed error reporting
179+
// match credentials::store_credentials(profile_name, &credentials) {
180+
// Ok(_) => println!("🔒 Credentials storage: Success"),
181+
// Err(e) => {
182+
// println!("🔒 Credentials storage: Failed - {}", e);
183+
// return Err(CliError::Storage(format!("Failed to store credentials: {}", e)));
184+
// }
185+
// }
186+
//
187+
// // Update profile list with detailed error reporting
188+
// match credentials::add_profile_to_list(profile_name) {
189+
// Ok(_) => println!("📋 Profile list update: Success"),
190+
// Err(e) => {
191+
// println!("📋 Profile list update: Failed - {}", e);
192+
// return Err(CliError::Storage(format!("Failed to update profile list: {}", e)));
193+
// }
194+
// }
195+
//
196+
// // Immediately test retrieval
197+
// println!("🧪 Testing immediate retrieval...");
198+
// match credentials::load_credentials(profile_name) {
199+
// Ok(test_creds) => {
200+
// println!(
201+
// "✅ Immediate retrieval successful: {} at {}",
202+
// test_creds.username, test_creds.api_url
203+
// );
204+
// }
205+
// Err(e) => {
206+
// println!("❌ Immediate retrieval failed: {}", e);
207+
// }
208+
// }
209+
//
210+
// println!("✅ Credentials stored successfully for profile '{}'", profile_name);
211+
// println!("💡 You can now use RRelayer CLI without environment variables");
212+
//
213+
// Ok(())
214+
// }
145215

146-
// Test the credentials
147-
println!("\n🧪 Testing credentials...");
148-
// let sdk = SDK::new(api_url.clone(), username.clone(), password.clone());
149-
//
150-
// match sdk.health.check().await {
151-
// Ok(_) => {
152-
// println!("✅ API server is reachable");
153-
// }
154-
// Err(e) => {
155-
// println!("❌ Failed to reach API server: {}", e);
156-
// return Err(CliError::Authentication(
157-
// "API server is not reachable. Please check the URL and try again.".to_string(),
158-
// ));
159-
// }
160-
// }
161-
//
162-
// match sdk.test_auth().await {
163-
// Ok(_) => {
164-
// println!("✅ Authentication successful");
165-
// }
166-
// Err(e) => {
167-
// println!("❌ Authentication failed: {}", e);
168-
// return Err(CliError::Authentication(
169-
// "Invalid credentials. Please check your username and password.".to_string(),
170-
// ));
171-
// }
172-
// }
173-
174-
// Store credentials
175-
let credentials = StoredCredentials { api_url, username, password };
176-
177-
// Store credentials with detailed error reporting
178-
match credentials::store_credentials(profile_name, &credentials) {
179-
Ok(_) => println!("🔒 Credentials storage: Success"),
180-
Err(e) => {
181-
println!("🔒 Credentials storage: Failed - {}", e);
182-
return Err(CliError::Storage(format!("Failed to store credentials: {}", e)));
183-
}
184-
}
185-
186-
// Update profile list with detailed error reporting
187-
match credentials::add_profile_to_list(profile_name) {
188-
Ok(_) => println!("📋 Profile list update: Success"),
189-
Err(e) => {
190-
println!("📋 Profile list update: Failed - {}", e);
191-
return Err(CliError::Storage(format!("Failed to update profile list: {}", e)));
192-
}
193-
}
194-
195-
// Immediately test retrieval
196-
println!("🧪 Testing immediate retrieval...");
197-
match credentials::load_credentials(profile_name) {
198-
Ok(test_creds) => {
199-
println!(
200-
"✅ Immediate retrieval successful: {} at {}",
201-
test_creds.username, test_creds.api_url
202-
);
203-
}
204-
Err(e) => {
205-
println!("❌ Immediate retrieval failed: {}", e);
206-
}
207-
}
208-
209-
println!("✅ Credentials stored successfully for profile '{}'", profile_name);
210-
println!("💡 You can now use RRelayer CLI without environment variables");
211-
212-
Ok(())
213-
}
214-
215-
async fn logout(profile_name: &str) -> Result<(), CliError> {
216-
println!("🚪 Logout from RRelayer");
217-
println!("=====================");
218-
219-
match credentials::load_credentials(profile_name) {
220-
Ok(_) => {
221-
credentials::delete_credentials(profile_name)
222-
.map_err(|e| CliError::Storage(format!("Failed to delete credentials: {}", e)))?;
223-
224-
credentials::remove_profile_from_list(profile_name)
225-
.map_err(|e| CliError::Storage(format!("Failed to update profile list: {}", e)))?;
226-
227-
println!("✅ Successfully logged out profile '{}'", profile_name);
228-
}
229-
Err(credentials::CredentialError::NotFound) => {
230-
println!("❌ Profile '{}' not found", profile_name);
231-
return Err(CliError::NotFound(format!("Profile '{}' not found", profile_name)));
232-
}
233-
Err(e) => {
234-
return Err(CliError::Storage(format!("Failed to load credentials: {}", e)));
235-
}
236-
}
237-
238-
Ok(())
239-
}
216+
// async fn logout(profile_name: &str) -> Result<(), CliError> {
217+
// println!("🚪 Logout from RRelayer");
218+
// println!("=====================");
219+
//
220+
// match credentials::load_credentials(profile_name) {
221+
// Ok(_) => {
222+
// credentials::delete_credentials(profile_name)
223+
// .map_err(|e| CliError::Storage(format!("Failed to delete credentials: {}", e)))?;
224+
//
225+
// credentials::remove_profile_from_list(profile_name)
226+
// .map_err(|e| CliError::Storage(format!("Failed to update profile list: {}", e)))?;
227+
//
228+
// println!("✅ Successfully logged out profile '{}'", profile_name);
229+
// }
230+
// Err(credentials::CredentialError::NotFound) => {
231+
// println!("❌ Profile '{}' not found", profile_name);
232+
// return Err(CliError::NotFound(format!("Profile '{}' not found", profile_name)));
233+
// }
234+
// Err(e) => {
235+
// return Err(CliError::Storage(format!("Failed to load credentials: {}", e)));
236+
// }
237+
// }
238+
//
239+
// Ok(())
240+
// }
240241

241242
async fn list_profiles() -> Result<(), CliError> {
242243
println!("📋 Stored Profiles");

0 commit comments

Comments
 (0)