test and validate signup with dispersable keypad and login with non-dispersable keypad
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, model_validator
|
||||
|
||||
from src.models import KeypadSize
|
||||
from src.utils import generate_random_nonrepeating_list
|
||||
@@ -9,6 +9,13 @@ class CustomerAttributes(BaseModel):
|
||||
set_vals: list[int]
|
||||
keypad_size: KeypadSize
|
||||
|
||||
@model_validator(mode='after')
|
||||
def check_keys_vs_attrs(self):
|
||||
if self.keypad_size.is_dispersable:
|
||||
raise ValueError("number of keys must be less than the number of "
|
||||
"attributes per key to be dispersion resistant")
|
||||
return self
|
||||
|
||||
@staticmethod
|
||||
def new(keypad_size: KeypadSize):
|
||||
assert (keypad_size.numb_of_keys <= 256)
|
||||
|
||||
Reference in New Issue
Block a user