Island: Check type of 'key' in EncryptionKey32Bytes

This commit is contained in:
Shreya Malviya 2022-07-19 19:01:47 +05:30
parent 74cb986e36
commit 6000fdcaf1
1 changed files with 3 additions and 1 deletions

View File

@ -1,6 +1,8 @@
class EncryptionKey32Bytes(bytes):
def __init__(self, key: bytes):
if not isinstance(key, bytes):
raise TypeError("Key is not of type `bytes`")
if len(key) == 32:
self.key = key
else:
raise ValueError("Key size should be 32 bytes.")
raise ValueError("Key size should be 32 bytes")