linotp.model.token module

class linotp.model.token.Token(serial)

Bases: TokenSchema

LinOtpCount
LinOtpCountWindow
LinOtpCreationDate
LinOtpFailCount
LinOtpIdResClass
LinOtpIdResolver
LinOtpIsactive
LinOtpKeyEnc
LinOtpKeyIV
LinOtpLastAuthMatch
LinOtpLastAuthSuccess
LinOtpMaxFail
LinOtpOtpLen
LinOtpPinHash
LinOtpSeed
LinOtpSyncWindow
LinOtpTokenDesc
LinOtpTokenId
LinOtpTokenInfo
LinOtpTokenPinSO
LinOtpTokenPinSOIV
LinOtpTokenPinUser
LinOtpTokenPinUserIV
LinOtpTokenSerialnumber
LinOtpTokenType
LinOtpUserid
static copy_pin(src: Any, target: Any) → None
deleteToken() → bool
get(key: Optional[str] = None, fallback: Optional[Any] = None, save: bool = False) → Any

simulate the dict behaviour to make challenge processing easier, as this will have to deal as well with ‘dict only challenges’

Parameters
  • key – the attribute name - in case key is not provided, a dict of all class attributes is returned

  • fallback – if the attribute is not found, the fallback is returned

  • save – in case all attributes are returned and save==True, the timestamp is converted to a string representation

getCountWindow() → int
getDescription() → str
getInfo() → str
getOtpCounter() → int
getRealmNames() → list
getRealms() → str
getSerial() → str
getSyncWindow() → int
getType() → str
getUserPin() → Tuple[bytes, bytes]
get_encrypted_pin() → Tuple[bytes, bytes]
get_encrypted_seed() → Tuple[bytes, bytes]
get_hashed_pin() → Tuple[bytes, bytes]
get_vars(save: bool = False) → dict
isPinEncrypted(pin: Optional[str] = None) → bool
realms
setCountWindow(counter: int) → None
setDescription(desc: str) → str
setInfo(info: str) → None
setOtpLen(otplen: Union[str, int]) → None
setRealms(realms: list) → None
setSoPin(enc_soPin: bytes, iv: bytes) → None
setType(typ: str) → None
setUserPin(enc_userPin: bytes, iv: bytes) → None
set_encrypted_pin(pin: bytes, iv: bytes) → None
set_encrypted_seed(encrypted_seed: bytes, iv: bytes, reset_failcount: bool = True, reset_counter: bool = True) → None

set_encrypted_seed - save the encrypted token seed / secret

Parameters
  • encrypted_seed – the encrypted seed / secret

  • iv – the initialization value / salt

  • reset_failcount – reset the failcount on token update

  • reset_counter – reset the otp counter on token update

set_hashed_pin(pin: bytes, iv: bytes) → None
storeToken() → bool
linotp.model.token.createToken(serial: str) → Token