File manager - Edit - /usr/local/CyberPanel/lib/python3.10/site-packages/pyotp/__pycache__/totp.cpython-310.pyc
Back
o �h � @ s` d dl Z d dlZd dlZd dlZd dlmZmZmZ ddlm Z ddl mZ G dd� de�ZdS )� N)�Any�Optional�Union� )�utils)�OTPc s� e Zd ZdZ ddedededee d ee d eddf� fdd � Zd de ee j f dedefdd�Zdefdd�Zd!dedee j dede fdd�Z d"dee dee dee defdd�Zde j defdd�Z� ZS )#�TOTPz. Handler for time-based OTP counters. � N� �s�digits�digest�name�issuer�interval�returnc s. |du rt j}|| _t� j|||||d� dS )a� :param s: secret in base32 format :param interval: the time interval in seconds for OTP. This defaults to 30. :param digits: number of integers in the OTP. Some apps expect this to be 6 digits, others support more. :param digest: digest function to use in the HMAC (expected to be SHA1) :param name: account name :param issuer: issuer N)r r r r r )�hashlib�sha1r �super�__init__)�selfr r r r r r �� __class__� �@/usr/local/CyberPanel/lib/python3.10/site-packages/pyotp/totp.pyr s z TOTP.__init__r �for_time�counter_offsetc C s0 t |tj�stj�t|��}| �| �|�| �S )a Accepts either a Unix timestamp integer or a datetime object. To get the time until the next timecode change (seconds until the current OTP expires), use this instead: .. code:: python totp = pyotp.TOTP(...) time_remaining = totp.interval - datetime.datetime.now().timestamp() % totp.interval :param for_time: the time to generate an OTP for :param counter_offset: the amount of ticks to add to the time counter :returns: OTP value )� isinstance�datetime� fromtimestamp�int�generate_otp�timecode)r r r r r r �at'