Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Feature request] Filter list by existing TOTP #119

Open
tasmo opened this issue May 25, 2023 · 4 comments
Open

[Feature request] Filter list by existing TOTP #119

tasmo opened this issue May 25, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@tasmo
Copy link

tasmo commented May 25, 2023

I wish to get just names/IDs of entries with an existing TOTP code.

rbw list just can list the fields Name, ID, User and Folder.

rbw/src/bin/rbw/commands.rs

Lines 592 to 604 in 8aa7e36

impl std::convert::TryFrom<&String> for ListField {
type Error = anyhow::Error;
fn try_from(s: &String) -> anyhow::Result<Self> {
Ok(match s.as_str() {
"name" => Self::Name,
"id" => Self::Id,
"user" => Self::User,
"folder" => Self::Folder,
_ => return Err(anyhow::anyhow!("unknown field {}", s)),
})
}
}

Neither it can list the full JSON in raw format to get filtered by advanced gojq/jq. This is just possible for single entries.

@rjc
Copy link

rjc commented Jul 3, 2023

@tasmo Only yesterday I had the need for the very same functionality - had to run this instead:

 $ for i in $(rbw ls) ; do rbw get --full $i 2>/dev/null | awk -v totp=$i '/TOTP/ { print totp }' ; done | sed 's/\n/ /'

sed is optional, of course, but I need to format the list for OpenBSD's ksh autocomplete.

@tasmo
Copy link
Author

tasmo commented Jul 3, 2023

@rjc Your solution is working and a good approach. Although the command took in my case much too long:

for i in $(rbw ls); do; rbw get --full $i 2> /dev/null | awk -v totp=$i ; done  19,68s user 33,36s system 64% cpu 1:22,21 total
sed 's/\n/ /'  0,00s user 0,00s system 0% cpu 1:22,21 total

@rjc
Copy link

rjc commented Jul 3, 2023

For me it's:

     0m13.34s real     0m02.99s user     0m05.45s system

Is #11 related by any chance?

@tasmo
Copy link
Author

tasmo commented Jul 5, 2023

Is #11 related by any chance?

I cannot tell. To get single passwords filtered with skim is quite fast here.

@doy doy added the enhancement New feature or request label Jul 18, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants