Skip to content

Creating a Secret

Đorđe Jocić edited this page Jan 2, 2019 · 1 revision

Generating a secret is quite a straightforward process, it is done upon instantiating an object.

Note: Secret is an encoded 80-bit value used for one-time password generation. It should ideally be unique for each account so you perform an appropriate check before assigning it.

$secret = new Jocic\GoogleAuthenticator\Secret();

echo $secret->getValue();

And if you are not satisfied with the returned value, you can simply generate a new one.

$newSecret = $secret->generateValue();

$secret->setValue($newSecret);
Clone this wiki locally