Filter out entries with TOTP

I'll preface this with my jq is beginner subpar state. I'm trying to search all my passwords to see what has a TOTP entry on a Windows 10 machine and then tag them so I can easier find them later. I believe I can do the latter based on https://1password.community/discussion/comment/573170#Comment_573170

But I'm struggling a bit to find things that have OTPs. I see there's a field with "one-time password" but I can't seem to figure out the syntax. I think it'd be something along the lines of
op list items --vault Private | jq '.[] | select(.details.sections[].fields[].t == \"one-time password\") | .overview.title'
but I get a cannot iterate over null error. If I explicitly define 0 for the sections/fields, it works but no results.
Clearly, I don't understand how to structure the select with arrays :) What am I not understanding?

Thanks


1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Win10
Sync Type: Not Provided

Comments

  • ag_yaronag_yaron

    Team Member
    edited January 18

    Hey @linh_nguyen ,

    The op list items command does not check fields content, but just lists items without reviewing their detailed sections.
    You'll need to iterate through every item in your vault(s) and return the ones that have a TOTP field with the get command. Here's an example for listing all items, then getting each item separately and searching if it has a TOTP field:

    op list items |jq -r '.[].uuid' | op get item - | jq '. | select(.details.sections[].fields[].t == "one-time password") | .overview.title'

    I hope that will point you in the right direction :)

  • appreciate it! probably can't do what I originally planned as the effort may not be worth it. But this got what I needed!

  • ag_anaag_ana

    Team Member

    That's great to hear @linh_nguyen! Let us know how it goes :+1:

    And on behalf of ag_yaron, you are very welcome :)

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file