Skip to content

Commit

Permalink
Merge pull request #8 from lettdigital/generate-op-device
Browse files Browse the repository at this point in the history
Generate op device
  • Loading branch information
Gabriel Chamon Araujo committed Jun 26, 2020
2 parents 3bba512 + e02c0dd commit 0a63263
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions onepassword.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import base64
import json
import os
import re
Expand Down Expand Up @@ -129,6 +130,8 @@ def get(self, resource, item_name):

def get_access_token(self, secret, shorthand):
try:
if not os.environ.get("OP_DEVICE"):
os.environ["OP_DEVICE"] = base64.b32encode(os.urandom(16)).decode().lower().rstrip("=")
process = subprocess.run(
(f"echo '{secret['password']}' | "
f"{self.op} signin {secret['signin_address']} {secret['username']} {secret['secret_key']} "
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "onepassword"
version = "0.4.0"
version = "0.4.1"
description = "Python wrapper for the 1password CLI"

repository = "https://github.com/lettdigital/onepassword-python"
Expand Down

0 comments on commit 0a63263

Please sign in to comment.