PHP Class OTPHP\OTP

Inheritance: implements otphp\OTPInterface
ファイルを表示 Open project: spomky-labs/otphp Class Usage Examples

Public Methods

Method Description
__construct ( string $label, string | null $secret, string $digest, integer $digits ) OTP constructor.
at ( $input )
getQrCodeUri ( $uri = 'https://chart.googleapis.com/chart?chs=200x200&chld=M|0&cht=qr&chl={PROVISIONING_URI}', $placeholder = '{PROVISIONING_URI}' )

Protected Methods

Method Description
compareOTP ( string $safe, string $user ) : boolean
filterOptions ( array &$options )
generateOTP ( integer $input ) : string
generateURI ( string $type, array $options ) : string

Private Methods

Method Description
getDecodedSecret ( ) : string
intToByteString ( integer $int ) : string

Method Details

__construct() public method

OTP constructor.
public __construct ( string $label, string | null $secret, string $digest, integer $digits )
$label string
$secret string | null
$digest string
$digits integer

at() public method

public at ( $input )

compareOTP() protected method

protected compareOTP ( string $safe, string $user ) : boolean
$safe string
$user string
return boolean

filterOptions() protected method

protected filterOptions ( array &$options )
$options array

generateOTP() protected method

protected generateOTP ( integer $input ) : string
$input integer
return string The OTP at the specified input

generateURI() protected method

protected generateURI ( string $type, array $options ) : string
$type string
$options array
return string

getQrCodeUri() public method

public getQrCodeUri ( $uri = 'https://chart.googleapis.com/chart?chs=200x200&chld=M|0&cht=qr&chl={PROVISIONING_URI}', $placeholder = '{PROVISIONING_URI}' )