Skip to content

Commit 31086d2

Browse files
fix: Compatibility with cryptography 2.* (#150)
* provide default backend for compatibility * use default_backend function
1 parent 0d33502 commit 31086d2

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ dev =
5555
pytest-mock==3.6.1
5656
pytest-timeout==2.1.0
5757
pytest-xdist==2.5.0
58+
types-cryptography==3.3.18
5859

5960
[options.package_data]
6061
firebolt = py.typed

src/firebolt/common/token_storage.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@
99

1010
from appdirs import user_data_dir
1111
from cryptography.fernet import Fernet, InvalidToken
12-
from cryptography.hazmat.primitives import hashes
13-
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
12+
from cryptography.hazmat.backends import default_backend # type: ignore
13+
from cryptography.hazmat.primitives import hashes # type: ignore
14+
from cryptography.hazmat.primitives.kdf.pbkdf2 import (
15+
PBKDF2HMAC, # type: ignore
16+
)
1417

1518
APPNAME = "firebolt"
1619

@@ -114,6 +117,7 @@ def __init__(self, salt: str, username: str, password: str):
114117
salt=b64decode(salt),
115118
length=32,
116119
iterations=39000,
120+
backend=default_backend(),
117121
)
118122
self.fernet = Fernet(
119123
urlsafe_b64encode(

0 commit comments

Comments
 (0)