Zitadel PHP API

TOTP
in package

Set up a TOTP generator for a user

Table of Contents

Properties

$secret  : string
$settings  : array<string|int, mixed>
$totpUri  : string
$userid  : int

Methods

__construct()  : mixed
Initialize the TOTP setup
getQRCode()  : string
Get the TOTP QR-Code ready for any Authenticator-App
getSecret()  : string
Get the TOTP Secret
getURI()  : string
Get the TOTP URI
setUserId()  : void
Set the userid
start()  : void
Set up a TOTP token for a user.
verify()  : bool
Verify the TOTP method creation. You can only use this function to finish the TOTP setup. To verify the Code after login, use the 'Create' class in 'Session'.

Properties

$secret

private string $secret

$settings

private array<string|int, mixed> $settings

$totpUri

private string $totpUri

$userid

private int $userid

Methods

__construct()

Initialize the TOTP setup

public __construct(mixed $settings) : mixed
Parameters
$settings : mixed

array The settings array

getQRCode()

Get the TOTP QR-Code ready for any Authenticator-App

public getQRCode() : string
Return values
string

Base64 encoded SVG image url e.g. data:image/svg+xml;base64,PD94...

getSecret()

Get the TOTP Secret

public getSecret() : string
Return values
string

TOTP secret

getURI()

Get the TOTP URI

public getURI() : string
Return values
string

TOTP URI

setUserId()

Set the userid

public setUserId(mixed $userid) : void
Parameters
$userid : mixed

int User id

start()

Set up a TOTP token for a user.

public start() : void

You can get the URI via the getURI() command, the TOTP secret via the getSecret() command or the QR-Code via the getQRCode() command

Tags
throws
Exception

verify()

Verify the TOTP method creation. You can only use this function to finish the TOTP setup. To verify the Code after login, use the 'Create' class in 'Session'.

public verify(mixed $verifyCode) : bool
Parameters
$verifyCode : mixed
Return values
bool

Is the TOTP code correct?


        
On this page

Search results