diff --git a/tools/keyring-fetcher/Cargo.lock b/tools/keyring-fetcher/Cargo.lock index e535e37..864edd1 100644 --- a/tools/keyring-fetcher/Cargo.lock +++ b/tools/keyring-fetcher/Cargo.lock @@ -597,6 +597,7 @@ name = "keyring-fetch" version = "0.1.0" dependencies = [ "async-std", + "hex", "oo7", ] diff --git a/tools/keyring-fetcher/Cargo.toml b/tools/keyring-fetcher/Cargo.toml index 621fbfd..c1920be 100644 --- a/tools/keyring-fetcher/Cargo.toml +++ b/tools/keyring-fetcher/Cargo.toml @@ -7,4 +7,5 @@ edition = "2021" [dependencies] oo7 = {version = "0.1.0-alpha.5", features = ["tracing", "unstable", "async-std"]} -async-std = "1.11.0" \ No newline at end of file +async-std = "1.11.0" +hex = "0.4" diff --git a/tools/keyring-fetcher/src/main.rs b/tools/keyring-fetcher/src/main.rs index 281e33d..af90a66 100644 --- a/tools/keyring-fetcher/src/main.rs +++ b/tools/keyring-fetcher/src/main.rs @@ -26,15 +26,25 @@ async fn main() -> oo7::Result<()> { let secret = items[0].secret().await?; let keyring = oo7::portal::Keyring::load(keyring_path, &secret).await?; - let keyring_items = keyring.items().await?; + let keyring_items = keyring + .search_items(HashMap::from([("type", "token")])) + .await?; for item in keyring_items.iter() { let attributes = item.attributes(); let secret = item.secret(); - println!( - "Found a secret: \nAttributes: {:#?}\nSecret: {:#?}", - attributes, - String::from_utf8_lossy(&secret) - ); + if let Ok(decoded_secret) = hex::decode(secret.clone()) { + println!( + "Found a secret: \nAttributes: {:#?}\nSecret: {:#?}", + attributes, + String::from_utf8_lossy(&decoded_secret) + ); + } else { + println!( + "ERROR!! Failed to decode secret for \n Attributes {:#?} \n {:#?}", + attributes, + String::from_utf8_lossy(&secret) + ); + } println!("################################################"); }