Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat: adding otp fields #62

Merged
merged 2 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions onepassword/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,3 +445,13 @@ def get_item(uuid: str | bytes, fields: str | bytes | list | None = None):
else:
item = json.loads(read_bash_return("op item get {} --format=json".format(uuid), single=False))
return item

@staticmethod
def get_item_otp(uuid: str | bytes):
"""
Helper function to get the item otp, you can find the UUID you need using list_items

:param uuid: Uuid of the item you wish to get, no vault needed
:return: the otp of the item, if it exists
"""
return read_bash_return("op item get {} --otp".format(uuid), single=False).rstrip('\n')
6 changes: 6 additions & 0 deletions test/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ def test_get_items(self):
"""
pass

def test_get_item_otp(self):
"""
Without user interaction will not be signed in and be unable to list anything
"""
pass


if __name__ == '__main__':
unittest.main()
Loading