Skip to content

Commit d544cc1

Browse files
belamubelamu
and
belamu
authored
Fix typos to make key decryption work (#148)
* fix wrong variable use (password vs. pw) * fix typo (encrypted_key vs encryted_key) * fix typo * correct docstring --------- Co-authored-by: belamu <[email protected]>
1 parent 390b522 commit d544cc1

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

sigexport/crypto.py

+8-9
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
PASSWORD_CMD_DARWIN = ["security", "find-generic-password", "-ws", "Signal Safe Storage"]
1717
PASSWORD_CMD_GNOME = ["secret-tool", "lookup", "application", "Signal"]
18-
PASSWARD_CMD_KDE = ["kwallet-query", "kdewallet", "-f",
18+
PASSWORD_CMD_KDE = ["kwallet-query", "kdewallet", "-f",
1919
"Chromium Keys", "-r", "Chromium Safe Storage"]
2020

2121

@@ -39,7 +39,7 @@ def get_key(file: Path, password: Optional[str]) -> str:
3939
if "key" in data:
4040
return data["key"]
4141
elif "encryptedKey" in data:
42-
encrypyed_key = data["encryptedKey"]
42+
encrypted_key = data["encryptedKey"]
4343
if sys.platform == "win32":
4444
secho(
4545
"Signal decryption isn't currently supported on Windows"
@@ -48,21 +48,20 @@ def get_key(file: Path, password: Optional[str]) -> str:
4848
)
4949
if sys.platform == "darwin":
5050
if password:
51-
return decrypt(password, encrypyed_key, b"v10", 1003)
51+
return decrypt(password, encrypted_key, b"v10", 1003)
5252
pw = get_password(PASSWORD_CMD_DARWIN, "macOS") # may raise error
53-
return decrypt(pw, encrypyed_key, b"v10", 1003)
53+
return decrypt(pw, encrypted_key, b"v10", 1003)
5454
else: # linux
5555
if password:
56-
return decrypt(password, encrypyed_key, b"v11", 1)
56+
return decrypt(password, encrypted_key, b"v11", 1)
5757
elif "safeStorageBackend" in data:
5858
if data["safeStorageBackend"] == "gnome_libsecret":
5959
pw = get_password(PASSWORD_CMD_GNOME, "gnome") # may raise error
60-
pw = get_password(PASSWORD_CMD_KDE, "KDE") # may raise error
61-
return decrypt(password, encrypyed_key, b"v11", 1)
60+
return decrypt(pw, encrypted_key, b"v11", 1)
6261
elif data["safeStorageBackend"] in [
6362
"gnome_libsecret", "kwallet", "kwallet5", "kwallet6"]:
6463
pw = get_password(PASSWORD_CMD_KDE, "KDE") # may raise error
65-
return decrypt(password, encrypyed_key, b"v11", 1)
64+
return decrypt(pw, encrypted_key, b"v11", 1)
6665
else:
6766
secho("Your Signal data key is encrypted, and requires a password.")
6867
secho(f"The safe storage backend is {data['safeStorageBackend']}")
@@ -90,7 +89,7 @@ def get_password(cmd: list[str], system: str) -> Optional[str]:
9089
cmd: shell command as list of words
9190
system: Name of the system we are on, for help message.
9291
Returns:
93-
password if found, None otherwise
92+
password if found
9493
Raises:
9594
nondescript error: if no password was found
9695
"""

0 commit comments

Comments
 (0)