inforian / drf-pyotp

pyotp extension for Django Rest Framework
Other
6 stars 6 forks source link

use parameters in settings.py for defining expiry times for TOTP and HOTP #13

Open ElijahAhianyo opened 3 years ago

ElijahAhianyo commented 3 years ago

Hi, I was wondering if the application could use variables defined in the settings.py file of the external application(or using defaults set by the system) rather than specifying it when making requests. For making requests for TOTP:

{
  "time": 0
}

and that of HOTP:

{
  "count": 0
}

could be represented by obtaining these values from the settings file as:

OTP_TIME_EXP = 300 #set the OTP expiry time to 300s
OTP_TYPE = 'totp' # sets the type of OTP(either TOTP or HOTP)

#for the case of HOTP
HOTP_COUNT = 5 #set the Hotp counter to 5

where obviously, default values can be set in the application in case these variables are not set in the external application. I can go ahead and create aPR if this is approved

inforian commented 3 years ago

Yes Static settings can be avoided and imported from User declared settings in his own Project. Also this lib is not upgraded to latest Django packages. You can create issues for that too.