2020-04-17 17:09:04 +00:00
|
|
|
from .python_util import *
|
2020-04-15 12:26:48 +00:00
|
|
|
import deprecation
|
2019-09-04 16:40:41 +00:00
|
|
|
|
2020-04-15 12:26:48 +00:00
|
|
|
@deprecation.deprecated(deprecated_in="0.5.0", removed_in="1.0",
|
|
|
|
details='use gopass_password_from_path(os.environ.get(env_var, None)) instead')
|
2020-01-28 11:47:43 +00:00
|
|
|
def gopass_credential_from_env_path (env_var):
|
|
|
|
env_path = os.environ.get(env_var, None)
|
2020-04-11 13:12:02 +00:00
|
|
|
return gopass_password_from_path(env_path)
|
2020-01-28 10:47:21 +00:00
|
|
|
|
2020-04-15 12:26:48 +00:00
|
|
|
@deprecation.deprecated(deprecated_in="0.5.0", removed_in="1.0",
|
|
|
|
details='use gopass_password_from_path(path) instead')
|
2020-01-28 10:47:21 +00:00
|
|
|
def gopass_credential_from_path (path):
|
2020-04-11 13:12:02 +00:00
|
|
|
return gopass_password_from_path(path)
|
|
|
|
|
|
|
|
|
|
|
|
def gopass_field_from_path (path, field):
|
|
|
|
credential = None
|
|
|
|
if path and field:
|
2020-04-16 16:30:02 +00:00
|
|
|
print('get field for: ' + path + ', ' + field)
|
2020-04-17 17:09:04 +00:00
|
|
|
credential = execute(['gopass', 'show', path, field])
|
2020-04-11 13:12:02 +00:00
|
|
|
return credential
|
|
|
|
|
|
|
|
def gopass_password_from_path (path):
|
2019-09-04 16:40:41 +00:00
|
|
|
credential = None
|
2020-01-28 11:47:43 +00:00
|
|
|
if path:
|
2020-04-16 16:30:02 +00:00
|
|
|
print('get password for: ' + path)
|
2020-04-17 17:09:04 +00:00
|
|
|
credential = execute(['gopass', 'show', '--password', path])
|
2019-09-04 16:40:41 +00:00
|
|
|
return credential
|
2020-01-28 10:47:21 +00:00
|
|
|
|