6.1.1.3.2.14. linotp.lib.mOTP module

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

class linotp.lib.mOTP.mTimeOtp(secObj=None, secPin=None, oldtime=0, digits=6, key=None, pin=None)[source]

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)[source]

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)[source]

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 here only used for seltest: setting the initTime
Returns:

-1 for fail else the identified counter/time

linotp.lib.mOTP.motp_test()[source]

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