diff --git a/src/nacl/bindings/crypto_secretstream.py b/src/nacl/bindings/crypto_secretstream.py index d7c6725e..59b074c5 100644 --- a/src/nacl/bindings/crypto_secretstream.py +++ b/src/nacl/bindings/crypto_secretstream.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import ByteString, Optional, Tuple, cast +from typing import Optional, Tuple, Union, cast from nacl import exceptions as exc from nacl._sodium import ffi, lib @@ -73,6 +73,7 @@ class crypto_secretstream_xchacha20poly1305_state: def __init__(self) -> None: """Initialize a clean state object.""" + ByteString = Union[bytes, bytearray, memoryview] self.statebuf: ByteString = ffi.new( "unsigned char[]", crypto_secretstream_xchacha20poly1305_STATEBYTES, diff --git a/tests/test_secretstream.py b/tests/test_secretstream.py index d1b72739..9a847bb4 100644 --- a/tests/test_secretstream.py +++ b/tests/test_secretstream.py @@ -16,7 +16,7 @@ import json import os import random -from typing import ByteString, List, Optional, Tuple +from typing import List, Optional, Tuple, Union from _pytest._code import ExceptionInfo from _pytest.monkeypatch import MonkeyPatch @@ -219,6 +219,7 @@ def test_it_like_libsodium(): header = crypto_secretstream_xchacha20poly1305_init_push(state, k) + ByteString = Union[bytes, bytearray, memoryview] state_save: ByteString = ffi.buffer(state.statebuf)[:] c1 = crypto_secretstream_xchacha20poly1305_push(