linotp.tokens.motp package

lib to handle mobileOTP - Implementation inspired by: https://github.com/neush/otpn900/blob/master/src/test_motp.c

class linotp.tokens.motp.mTimeOtp(secObj=None, secPin=None, oldtime=0, digits=6, key=None, pin=None)

Bases: object

implements the motp timebased check_otp - s. https://github.com/neush/otpn900/blob/master/src/test_motp.c

calcOtp(counter, key=None, pin=None)

calculate an otp value from counter/time, key and pin

Parameters
  • counter – counter/time to be checked

  • key – the secret key

  • pin – the secret pin

Returns

the otp value

Return type

string

checkOtp(anOtpVal, window=10, options=None)

check a provided otp value

Parameters
  • anOtpVal – the to be tested otp value

  • window – the +/- window around the test time

  • options – generic container for additional values

Returns

-1 for fail else the identified counter/time

linotp.tokens.motp.motp_test()
Testvector from

https://github.com/neush/otpn900/blob/master/src/test_motp.c