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: 217 lines (5 kb)
Included or required: 2 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

TOTP:: (15 methods):
  __construct()
  create()
  setPeriod()
  getPeriod()
  setEpoch()
  getEpoch()
  at()
  now()
  verify()
  verifyOtpWithWindow()
  getTimestamp()
  getProvisioningUri()
  timecode()
  getParameterMap()
  filterOptions()


Class: TOTP  - X-Ref

__construct($secret, int $period, string $digest, int $digits, int $epoch = 0)   X-Ref
TOTP constructor.

param: string|null $secret
param: int         $period
param: string      $digest
param: int         $digits
param: int         $epoch

create($secret = null, int $period = 30, string $digest = 'sha1', int $digits = 6, int $epoch = 0)   X-Ref
TOTP constructor.

param: string|null $secret
param: int         $period
param: string      $digest
param: int         $digits
param: int         $epoch
return: self

setPeriod(int $period)   X-Ref

param: int $period

getPeriod()   X-Ref
{@inheritdoc}


setEpoch(int $epoch)   X-Ref

param: int $epoch

getEpoch()   X-Ref
{@inheritdoc}


at(int $timestamp)   X-Ref
{@inheritdoc}


now()   X-Ref
{@inheritdoc}


verify(string $otp, $timestamp = null, $window = null)   X-Ref
If no timestamp is provided, the OTP is verified at the actual timestamp
{@inheritdoc}


verifyOtpWithWindow(string $otp, int $timestamp, int $window)   X-Ref

param: string $otp
param: int    $timestamp
param: int    $window
return: bool

getTimestamp($timestamp)   X-Ref

param: int|null $timestamp
return: int

getProvisioningUri()   X-Ref
{@inheritdoc}


timecode(int $timestamp)   X-Ref

param: int $timestamp
return: int

getParameterMap()   X-Ref
{@inheritdoc}


filterOptions(array &$options)   X-Ref
{@inheritdoc}