PHP Interface OTPHP\OTPInterface

ファイルを表示 Open project: spomky-labs/otphp Interface Usage Examples

Public Methods

Method Description
at ( integer $input ) : string
getDigest ( ) : string
getDigits ( ) : integer
getIssuer ( ) : string
getLabel ( ) : string
getParameter ( string $parameter ) : null | mixed
getParameters ( ) : array
getProvisioningUri ( ) : string
getQrCodeUri ( string $uri = 'https://chart.googleapis.com/chart?chs=200x200&chld=M|0&cht=qr&chl={PROVISIONING_URI}', string $placeholder = '{PROVISIONING_URI}' ) : string
getSecret ( ) : string
hasParameter ( string $parameter ) : boolean
isIssuerIncludedAsParameter ( ) : boolean
setIssuer ( string $issuer )
setIssuerIncludedAsParameter ( boolean $issuer_included_as_parameter )
setParameter ( string $parameter, mixed $value )
verify ( string $otp, integer | null $input = null, integer | null $window = null ) : boolean Verify that the OTP is valid with the specified input.

Method Details

at() public method

public at ( integer $input ) : string
$input integer
return string Return the OTP at the specified input

getDigest() public method

public getDigest ( ) : string
return string Digest algorithm used to calculate the OTP. Possible values are 'md5', 'sha1', 'sha256' and 'sha512'

getDigits() public method

public getDigits ( ) : integer
return integer Number of digits in the OTP

getIssuer() public method

public getIssuer ( ) : string
return string The issuer

getLabel() public method

public getLabel ( ) : string
return string The label of the OTP

getParameter() public method

public getParameter ( string $parameter ) : null | mixed
$parameter string
return null | mixed

getParameters() public method

public getParameters ( ) : array
return array

getProvisioningUri() public method

public getProvisioningUri ( ) : string
return string Get the provisioning URI

getQrCodeUri() public method

public getQrCodeUri ( string $uri = 'https://chart.googleapis.com/chart?chs=200x200&chld=M|0&cht=qr&chl={PROVISIONING_URI}', string $placeholder = '{PROVISIONING_URI}' ) : string
$uri string The Uri of the QRCode generator with all parameters. By default the Googgle Chart API is used. This Uri MUST contain a placeholder that will be replaced by the method.
$placeholder string The placeholder to be replaced in the QR Code generator URI. Default value is {PROVISIONING_URI}.
return string Get the provisioning URI

getSecret() public method

public getSecret ( ) : string
return string The secret of the OTP

hasParameter() public method

public hasParameter ( string $parameter ) : boolean
$parameter string
return boolean

isIssuerIncludedAsParameter() public method

public isIssuerIncludedAsParameter ( ) : boolean
return boolean If true, the issuer will be added as a parameter in the provisioning URI

setIssuer() public method

public setIssuer ( string $issuer )
$issuer string

setIssuerIncludedAsParameter() public method

public setIssuerIncludedAsParameter ( boolean $issuer_included_as_parameter )
$issuer_included_as_parameter boolean

setParameter() public method

public setParameter ( string $parameter, mixed $value )
$parameter string
$value mixed

verify() public method

If no input is provided, the input is set to a default value or false is returned.
public verify ( string $otp, integer | null $input = null, integer | null $window = null ) : boolean
$otp string
$input integer | null
$window integer | null
return boolean