Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
OTPHP\OTP Class Reference
Inheritance diagram for OTPHP\OTP:
OTPHP\OTPInterface OTPHP\TOTP

Public Member Functions

 at (int $timestamp)
 {}
 
 getDigest ()
 
 getDigits ()
 
 getIssuer ()
 
 getLabel ()
 
 getParameter (string $parameter)
 
 getParameters ()
 
 getProvisioningUri ()
 
 getQrCodeUri (string $uri='https://chart.googleapis.com/chart?chs=200x200 &chld=M|0 &cht=qr &chl={PROVISIONING_URI}', string $placeholder='{PROVISIONING_URI}')
 {
Parameters
string$uriThe 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.
string$placeholderThe placeholder to be replaced in the QR Code generator URI. Default value is {PROVISIONING_URI}.
Return values
stringGet the provisioning URI
}
 
 getSecret ()
 
 hasParameter (string $parameter)
 
 isIssuerIncludedAsParameter ()
 
 setIssuer (string $issuer)
 
 setIssuerIncludedAsParameter (bool $issuer_included_as_parameter)
 
 setLabel (string $label)
 
 setParameter (string $parameter, $value)
 
 verify (string $otp, $input=null, $window=null)
 Verify that the OTP is valid with the specified input.
 

Protected Member Functions

 __construct ($secret, string $digest, int $digits)
 
 compareOTP (string $safe, string $user)
 
 filterOptions (array &$options)
 
 generateOTP (int $input)
 
 generateURI (string $type, array $options)
 

Member Function Documentation

◆ at()

OTPHP\OTP::at ( int $timestamp)

{}

Implements OTPHP\OTPInterface.

Reimplemented in OTPHP\TOTP.

◆ compareOTP()

OTPHP\OTP::compareOTP ( string $safe,
string $user )
protected
Parameters
string$safe
string$user
Return values
bool

◆ filterOptions()

OTPHP\OTP::filterOptions ( array & $options)
protected
Parameters
array$options

Reimplemented in OTPHP\TOTP.

◆ generateOTP()

OTPHP\OTP::generateOTP ( int $input)
protected
Parameters
int$input
Return values
stringThe OTP at the specified input

◆ generateURI()

OTPHP\OTP::generateURI ( string $type,
array $options )
protected
Parameters
string$type
array$options
Return values
string

◆ getDigest()

OTPHP\OTPInterface::getDigest ( )
inherited
Return values
stringDigest algorithm used to calculate the OTP. Possible values are 'md5', 'sha1', 'sha256' and 'sha512'

◆ getDigits()

OTPHP\OTPInterface::getDigits ( )
inherited
Return values
intNumber of digits in the OTP

◆ getIssuer()

OTPHP\OTPInterface::getIssuer ( )
inherited
Return values
string|nullThe issuer

◆ getLabel()

OTPHP\OTPInterface::getLabel ( )
inherited
Return values
string|nullThe label of the OTP

◆ getParameter()

OTPHP\OTPInterface::getParameter ( string $parameter)
inherited
Parameters
string$parameter
Return values
null|mixed

◆ getParameters()

OTPHP\OTPInterface::getParameters ( )
inherited
Return values
array

◆ getProvisioningUri()

OTPHP\OTPInterface::getProvisioningUri ( )
inherited
Return values
stringGet the provisioning URI

Implemented in OTPHP\TOTP.

◆ getQrCodeUri()

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

{

Parameters
string$uriThe 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.
string$placeholderThe placeholder to be replaced in the QR Code generator URI. Default value is {PROVISIONING_URI}.
Return values
stringGet the provisioning URI
}

Implements OTPHP\OTPInterface.

◆ getSecret()

OTPHP\OTPInterface::getSecret ( )
inherited
Return values
stringThe secret of the OTP

◆ hasParameter()

OTPHP\OTPInterface::hasParameter ( string $parameter)
inherited
Parameters
string$parameter
Return values
bool

◆ isIssuerIncludedAsParameter()

OTPHP\OTPInterface::isIssuerIncludedAsParameter ( )
inherited
Return values
boolIf true, the issuer will be added as a parameter in the provisioning URI

◆ setIssuer()

OTPHP\OTPInterface::setIssuer ( string $issuer)
inherited
Parameters
string$issuer
Exceptions
InvalidArgumentException

◆ setIssuerIncludedAsParameter()

OTPHP\OTPInterface::setIssuerIncludedAsParameter ( bool $issuer_included_as_parameter)
inherited
Parameters
bool$issuer_included_as_parameter
Return values
$this

◆ setLabel()

OTPHP\OTPInterface::setLabel ( string $label)
inherited
Parameters
string$labelThe label of the OTP

◆ setParameter()

OTPHP\OTPInterface::setParameter ( string $parameter,
$value )
inherited
Parameters
string$parameter
mixed$value
Return values
$this

◆ verify()

OTPHP\OTPInterface::verify ( string $otp,
$input = null,
$window = null )
inherited

Verify that the OTP is valid with the specified input.

If no input is provided, the input is set to a default value or false is returned.

Parameters
string$otp
int | null$input
int | null$window
Return values
bool

Implemented in OTPHP\TOTP.


The documentation for this class was generated from the following file: