Clarify that cryptography's Fernet accepts text keys (#4061)

* Clarify that cryptography's Fernet accepts text keys

* simplify code

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
This commit is contained in:
Jakub Stasiak
2020-05-25 03:44:36 +02:00
committed by GitHub
parent 8f6fd0e05a
commit 8827f84763

View File

@@ -1,9 +1,9 @@
from typing import List, Optional
from typing import List, Optional, Union, Text
class InvalidToken(Exception): ...
class Fernet(object):
def __init__(self, key: bytes) -> None: ...
def __init__(self, key: Union[bytes, Text]) -> None: ...
def decrypt(self, token: bytes, ttl: Optional[int] = ...) -> bytes: ...
def encrypt(self, data: bytes) -> bytes: ...
def extract_timestamp(self, token: bytes) -> int: ...