add expose method for displaying raw passwords

This commit is contained in:
Greg Gauthier 2019-03-12 15:49:52 +00:00
parent 3034f1108d
commit de3759e977
2 changed files with 11 additions and 2 deletions

View File

@ -12,13 +12,22 @@ class Credentials:
def read_cred(self, service):
return self.creds[service]
def expose_cred(self, service):
decrypted = {
"username": self.creds[service]["username"],
"password": Password().decrypt(
self.creds[service]["password"].encode()
)
}
return decrypted
def create_cred(self, service, username, password=None):
if password is None:
password = Password.generate(mn=64)
new_entry = {
"username": username,
"password": Password().encrypt(password)
"password": Password().encrypt(password).decode()
}
self.creds[service] = new_entry
Pwdfile().write(self.creds)

View File

@ -1 +1 @@
{"twitter": {"username": "@twitterhandle", "password": "gobbledygook"}, "youtube": {"username": "googlemail@gmail.com", "password": "moregobbledygook"}}
{"twitter": {"username": "@twitterhandle", "password": "gAAAAABch9QOeWT4s6fAL6_2jsY7kVRF4BoLuIjkBXhWr53GcVQUXs1olYw4HrzVcgmNIuJkVAvaaHAQMNJrvwHcMh1p28XYcw=="}, "youtube": {"username": "googlemail@gmail.com", "password": "moregobbledygook"}}