Files
pynkode/src/models.py

32 lines
736 B
Python

from dataclasses import dataclass
@dataclass
class EncipheredNKode:
code: str
mask: str
@dataclass
class NKodePolicy:
max_nkode_len: int = 10
min_nkode_len: int = 4
distinct_positions: int = 0
distinct_properties: int = 4
byte_len: int = 2 # Todo: this should change the total number of bytes an properties or set value can be
lock_out: int = 5
expiration: int = -1 # in seconds -1 means nKode never expires
@dataclass
class KeypadSize:
props_per_key: int
numb_of_keys: int
@property
def total_props(self) -> int:
return self.props_per_key * self.numb_of_keys
@property
def is_dispersable(self) -> bool:
return self.props_per_key <= self.numb_of_keys