1 Commits

Author SHA1 Message Date
27c2f467c4 fix cli invocations in gui entrypoint 2024-07-14 20:51:49 -04:00
2 changed files with 5 additions and 41 deletions

View File

@ -148,43 +148,6 @@ impl AwsSessionCredential {
}
#[derive(Clone, Debug, FromRow)]
pub struct AwsSessionRow {
version: i64,
base_id: Uuid,
access_key_id: String,
session_token: String,
secret_key_enc: Vec<u8>,
nonce: Vec<u8>,
expiration: i64,
}
impl PersistentCredential for AwsSessionCredential {
type Row = AwsSessionRow;
fn type_name() -> &'static str { "aws_session" }
fn into_credential(self) -> Credential { Credential::AwsSession(self) }
fn row_id(row: &AwsSessionRow) -> Uuid { row.base_id }
fn from_row(row: AwsSessionRow, crypto: &Crypto) -> Rsult<Self, LoadCredentialsError> {
let nonce = XNonce::clone_from_slice(&row.nonce);
let secret_key_bytes = crypto.decrypt(&nonce, &row.secret_key_enc)?;
let secret_access_key = String::from_utf8(secret_key_bytes)
.map_err(|_| LoadCredentialsError::InvalidData)?;
Ok(AwsSessionCredential {
version: row.version as usize,
access_key_id: row.access_key_id,
secret_access_key,
session_token: row.session_token,
expiration: DateTime::from_secs(row.expiration),
})
}
fn save_details(&self, base_id: &Uuid, crypto: &Crypto, txn: &mut Transaction)
}
fn default_credentials_version() -> usize { 1 }

View File

@ -11,14 +11,15 @@ use creddy::{
fn main() {
let res = match cli::parser().get_matches().subcommand() {
let global_matches = cli::parser().get_matches();
let res = match global_matches.subcommand() {
None | Some(("run", _)) => {
app::run().error_popup("Creddy encountered an error");
Ok(())
},
Some(("get", m)) => cli::get(m),
Some(("exec", m)) => cli::exec(m),
Some(("shortcut", m)) => cli::invoke_shortcut(m),
Some(("get", m)) => cli::get(m, &global_matches),
Some(("exec", m)) => cli::exec(m, &global_matches),
Some(("shortcut", m)) => cli::invoke_shortcut(m, &global_matches),
_ => unreachable!(),
};