mirror of
https://github.com/lnbits/lnbits.git
synced 2025-04-16 07:41:36 +02:00
ignore macaroon type errors
This commit is contained in:
parent
345cf86544
commit
1c543e3a84
@ -76,7 +76,7 @@ class AESCipher(object):
|
||||
def decrypt(self, encrypted: str) -> str: #type: ignore
|
||||
"""Decrypts a string using AES-256-CBC."""
|
||||
passphrase = self.passphrase
|
||||
encrypted = base64.b64decode(encrypted)
|
||||
encrypted = base64.b64decode(encrypted) #type: ignore
|
||||
assert encrypted[0:8] == b"Salted__"
|
||||
salt = encrypted[8:16]
|
||||
key_iv = self.bytes_to_key(passphrase.encode(), salt, 32 + 16)
|
||||
@ -84,7 +84,7 @@ class AESCipher(object):
|
||||
iv = key_iv[32:]
|
||||
aes = AES.new(key, AES.MODE_CBC, iv)
|
||||
try:
|
||||
return self.unpad(aes.decrypt(encrypted[16:])).decode()
|
||||
return self.unpad(aes.decrypt(encrypted[16:])).decode() #type: ignore
|
||||
except UnicodeDecodeError:
|
||||
raise ValueError("Wrong passphrase")
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user