add expose method for displaying raw passwords
This commit is contained in:
parent
3034f1108d
commit
de3759e977
@ -12,13 +12,22 @@ class Credentials:
|
|||||||
def read_cred(self, service):
|
def read_cred(self, service):
|
||||||
return self.creds[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):
|
def create_cred(self, service, username, password=None):
|
||||||
if password is None:
|
if password is None:
|
||||||
password = Password.generate(mn=64)
|
password = Password.generate(mn=64)
|
||||||
|
|
||||||
new_entry = {
|
new_entry = {
|
||||||
"username": username,
|
"username": username,
|
||||||
"password": Password().encrypt(password)
|
"password": Password().encrypt(password).decode()
|
||||||
}
|
}
|
||||||
self.creds[service] = new_entry
|
self.creds[service] = new_entry
|
||||||
Pwdfile().write(self.creds)
|
Pwdfile().write(self.creds)
|
||||||
|
@ -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"}}
|
Loading…
Reference in New Issue
Block a user