Bitrix API

TotpAlgorithm extends OtpAlgorithm

Table of Contents

Constants

SYNC_WINDOW  = 180

Methods

__construct()  : mixed
generateOTP()  : string
Main method, generate OTP value for provided counter
generateUri()  : string
Generate provision URI according to KeyUriFormat
getAppScheme()  : string
Return algorithm scheme Mostly used for generate provision URI
getDigest()  : string
Returns digest algorithm used to calculate the OTP.
getDigits()  : int
Return digits (password length)
getSecret()  : string
Return used secret (binary)
getSyncParameters()  : string
Return synchronized user params for provided inputs
getType()  : string
Return OtpAlgorithm type
isTwoCodeRequired()  : bool
Require or not _two_ code for synchronize parameters
setInterval()  : $this
setSecret()  : $this
Set new secret
setWindow()  : $this
timecode()  : int
Make OTP counter from provided timestamp
verify()  : array<string|int, mixed>
Verify provided input

Constants

Methods

__construct()

public __construct([array<string|int, mixed> $initParams = [] ]) : mixed
Parameters
$initParams : array<string|int, mixed> = []

generateOTP()

Main method, generate OTP value for provided counter

public generateOTP(string|int $counter) : string
Parameters
$counter : string|int

Counter.

Return values
string

generateUri()

Generate provision URI according to KeyUriFormat

public generateUri(mixed $label[, array<string|int, mixed> $opts = [] ]) : string
Parameters
$label : mixed

User label.

$opts : array<string|int, mixed> = []

Additional URI parameters, e.g. ['image' => 'http://example.com/my_logo.png'] .

Tags
inheritDoc
Return values
string

getAppScheme()

Return algorithm scheme Mostly used for generate provision URI

public getAppScheme() : string
Return values
string

getDigest()

Returns digest algorithm used to calculate the OTP.

public getDigest() : string

Mostly used for generate provision URI

Return values
string

getDigits()

Return digits (password length)

public getDigits() : int
Return values
int

getSecret()

Return used secret (binary)

public getSecret() : string
Return values
string

getSyncParameters()

Return synchronized user params for provided inputs

public getSyncParameters(mixed $inputA, mixed $inputB) : string
Parameters
$inputA : mixed

First code.

$inputB : mixed

Second code. Must be provided if current OtpAlgorithm required it (see isTwoCodeRequired).

Tags
inheritDoc
Return values
string

getType()

Return OtpAlgorithm type

public getType() : string
Return values
string

isTwoCodeRequired()

Require or not _two_ code for synchronize parameters

public isTwoCodeRequired() : bool
Return values
bool

setInterval()

public setInterval(int $interval) : $this
Parameters
$interval : int
Return values
$this

setSecret()

Set new secret

public setSecret(string $secret) : $this
Parameters
$secret : string

Secret (binary).

Return values
$this

setWindow()

public setWindow(int $window) : $this
Parameters
$window : int
Return values
$this

timecode()

Make OTP counter from provided timestamp

public timecode(int $timestamp) : int
Parameters
$timestamp : int

Timestamp.

Return values
int

verify()

Verify provided input

public verify(mixed $input[, mixed $params = null ][, mixed $time = null ]) : array<string|int, mixed>
Parameters
$input : mixed

Input received from user.

$params : mixed = null

Synchronized user params, saved for this algorithm (see getSyncParameters).

$time : mixed = null
Tags
inheritDoc
Return values
array<string|int, mixed>

[ bool isSuccess (Valid input or not), string newParams (Updated user params for this OtpAlgorithm) ]


        
On this page

Search results