Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

(no description)

File Size: 123 lines (3 kb)
Included or required: 2 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

OTPInterface:: (17 methods):
  at()
  verify()
  getSecret()
  setLabel()
  getLabel()
  getIssuer()
  setIssuer()
  isIssuerIncludedAsParameter()
  setIssuerIncludedAsParameter()
  getDigits()
  getDigest()
  getParameter()
  hasParameter()
  getParameters()
  setParameter()
  getProvisioningUri()
  getQrCodeUri()


Interface: OTPInterface  - X-Ref

at(int $timestamp)   X-Ref

param: int $timestamp
return: string Return the OTP at the specified timestamp

verify(string $otp, $input = null, $window = null)   X-Ref
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.

param: string   $otp
param: int|null $input
param: int|null $window
return: bool

getSecret()   X-Ref

return: string The secret of the OTP

setLabel(string $label)   X-Ref

param: string $label The label of the OTP

getLabel()   X-Ref

return: string|null The label of the OTP

getIssuer()   X-Ref

return: string|null The issuer

setIssuer(string $issuer)   X-Ref

param: string $issuer

isIssuerIncludedAsParameter()   X-Ref

return: bool If true, the issuer will be added as a parameter in the provisioning URI

setIssuerIncludedAsParameter(bool $issuer_included_as_parameter)   X-Ref

param: bool $issuer_included_as_parameter
return: $this

getDigits()   X-Ref

return: int Number of digits in the OTP

getDigest()   X-Ref

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

getParameter(string $parameter)   X-Ref

param: string $parameter
return: null|mixed

hasParameter(string $parameter)   X-Ref

param: string $parameter
return: bool

getParameters()   X-Ref

return: array

setParameter(string $parameter, $value)   X-Ref

param: string $parameter
param: mixed  $value
return: $this

getProvisioningUri()   X-Ref

return: string Get the provisioning URI

getQrCodeUri(string $uri = 'https:)   X-Ref

param: string $uri         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.
param: string $placeholder The placeholder to be replaced in the QR Code generator URI. Default value is {PROVISIONING_URI}.
return: string Get the provisioning URI