1 from typing import Text
3 class InvalidToken(Exception): ...
6 def __init__(self, key: bytes | Text) -> None: ...
7 def decrypt(self, token: bytes, ttl: int | None = ...) -> bytes: ...
8 # decrypt_at_time accepts None ttl at runtime but it's an implementtion detail and it doesn't really
9 # make sense for the client code to use it like that, so the parameter is typed as int as opposed to
11 def decrypt_at_time(self, token: bytes, ttl: int, current_time: int) -> bytes: ...
12 def encrypt(self, data: bytes) -> bytes: ...
13 def encrypt_at_time(self, data: bytes, current_time: int) -> bytes: ...
14 def extract_timestamp(self, token: bytes) -> int: ...
16 def generate_key(cls) -> bytes: ...
18 class MultiFernet(object):
19 def __init__(self, fernets: list[Fernet]) -> None: ...
20 def decrypt(self, token: bytes, ttl: int | None = ...) -> bytes: ...
21 # See a note above on the typing of the ttl parameter.
22 def decrypt_at_time(self, token: bytes, ttl: int, current_time: int) -> bytes: ...
23 def encrypt(self, data: bytes) -> bytes: ...
24 def encrypt_at_time(self, data: bytes, current_time: int) -> bytes: ...
25 def rotate(self, msg: bytes) -> bytes: ...