Skip to content

Commit f4d4965

Browse files
ekollofemiel
and
emiel
authored
Make "PASSPHRASE" optional in the config
This change will allow the config to be empty so gpg-agent can take over authentication. It will also help avoid having secrets in config files Co-authored-by: emiel <[email protected]>
1 parent 6bb95c0 commit f4d4965

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

passboltapi/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,13 @@ def encrypt(self, text, recipients=None):
131131
return str(self.gpg.encrypt(data=text, recipients=recipients or self.gpg_fingerprint, always_trust=True))
132132

133133
def decrypt(self, text):
134-
return str(self.gpg.decrypt(text, always_trust=True, passphrase=str(self.config["PASSBOLT"]["PASSPHRASE"])))
134+
if "PASSPHRASE" in self.config["PASSBOLT"]:
135+
passphrase = str(self.config["PASSBOLT"]["PASSPHRASE"])
136+
else:
137+
passphrase = None
138+
139+
140+
return str(self.gpg.decrypt(text, always_trust=True, passphrase=passphrase))
135141

136142
def get_headers(self):
137143
return {

0 commit comments

Comments
 (0)