Island: Check type of 'key' in EncryptionKey32Bytes
This commit is contained in:
parent
74cb986e36
commit
6000fdcaf1
|
@ -1,6 +1,8 @@
|
||||||
class EncryptionKey32Bytes(bytes):
|
class EncryptionKey32Bytes(bytes):
|
||||||
def __init__(self, key: bytes):
|
def __init__(self, key: bytes):
|
||||||
|
if not isinstance(key, bytes):
|
||||||
|
raise TypeError("Key is not of type `bytes`")
|
||||||
if len(key) == 32:
|
if len(key) == 32:
|
||||||
self.key = key
|
self.key = key
|
||||||
else:
|
else:
|
||||||
raise ValueError("Key size should be 32 bytes.")
|
raise ValueError("Key size should be 32 bytes")
|
||||||
|
|
Loading…
Reference in New Issue