Use this script to generate a mypy.ini where you can enable strict mode based on errors from a current run.
Needs a few improvments:
- output pyproject.toml
- update source files by adding # type: ignore[xxx] instead of ignore_errors
This is a robust implementation that is extensible for anything that requires the use of OTP. Want to use OTP to verify | |
a user? Check! Want to use OTP to validate an order? CHeck! Want to use OTP to reset a password? CHEck! Want to use | |
OTP to verify a device? CHECk! Want to use OTP to fight people? CHECK! | |
I used: Django (framework), Django Rest Framework (a plugin for REST API), PostgreSQL (database) | |
and email (for sending the otp). You can substitute any of these for whatever you want, like using Redis instead of Postgres. | |
While this solution is built to be used for Django, I have added comments to explain the process for developers using | |
other frameworks. | |
Legend: |
Use this script to generate a mypy.ini where you can enable strict mode based on errors from a current run.
Needs a few improvments:
import base64 | |
from cryptography.hazmat.backends import default_backend | |
from cryptography.hazmat.primitives.asymmetric import rsa | |
from cryptography.hazmat.primitives import serialization | |
from cryptography.hazmat.primitives import hashes | |
from cryptography.hazmat.primitives.asymmetric import padding | |
def utf8(s: bytes): | |
return str(s, 'utf-8') |