How to use the pyotp.utils.build_uri function in pyotp

To help you get started, we’ve selected a few pyotp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github projectarkc / arkc-server / arkcserver / pyotp / totp.py View on Github external
def provisioning_uri(self, name, issuer_name=None):
        """
        Returns the provisioning URI for the OTP
        This can then be encoded in a QR Code and used
        to provision the Google Authenticator app
        @param [String] name of the account
        @return [String] provisioning uri
        """
        return utils.build_uri(self.secret, name, issuer_name=issuer_name)
github hiroaki-yamamoto / django-good-otp / django_otp / views.py View on Github external
def get(self, req, secret):
        """GET request."""
        result = bytes()
        otp_uri_kwargs = {
            key: value for (key, value) in req.GET.items() if key in (
                "name", "issuer_name"
            )
        }
        otp_uri_kwargs.setdefault("name", _("Untitled"))
        with BytesIO() as stream:
            generate_qrcode(
                build_otp_uri(secret, **otp_uri_kwargs), image_factory=svg
            ).save(stream)
            result = stream.getvalue()
        return HttpResponse(
            result, content_type=("image/svg+xml; charset={}").format(
                settings.DEFAULT_CHARSET
            )

pyotp

Python One Time Password Library

MIT
Latest version published 1 year ago

Package Health Score

84 / 100
Full package analysis