PHP Interface OTPHP\OTPInterface

Afficher le fichier Open project: spomky-labs/otphp Interface Usage Examples

Méthodes publiques

Méthode 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 méthode

public at ( integer $input ) : string
$input integer
Résultat string Return the OTP at the specified input

getDigest() public méthode

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

getDigits() public méthode

public getDigits ( ) : integer
Résultat integer Number of digits in the OTP

getIssuer() public méthode

public getIssuer ( ) : string
Résultat string The issuer

getLabel() public méthode

public getLabel ( ) : string
Résultat string The label of the OTP

getParameter() public méthode

public getParameter ( string $parameter ) : null | mixed
$parameter string
Résultat null | mixed

getParameters() public méthode

public getParameters ( ) : array
Résultat array

getProvisioningUri() public méthode

public getProvisioningUri ( ) : string
Résultat string Get the provisioning URI

getQrCodeUri() public méthode

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}.
Résultat string Get the provisioning URI

getSecret() public méthode

public getSecret ( ) : string
Résultat string The secret of the OTP

hasParameter() public méthode

public hasParameter ( string $parameter ) : boolean
$parameter string
Résultat boolean

isIssuerIncludedAsParameter() public méthode

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

setIssuer() public méthode

public setIssuer ( string $issuer )
$issuer string

setIssuerIncludedAsParameter() public méthode

public setIssuerIncludedAsParameter ( boolean $issuer_included_as_parameter )
$issuer_included_as_parameter boolean

setParameter() public méthode

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

verify() public méthode

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
Résultat boolean