noalyss Version-10
NOALYSS : serveur de comptabilité et ERP (2002)
Loading...
Searching...
No Matches
Noalyss\OTP Class Reference
+ Collaboration diagram for Noalyss\OTP:

Public Member Functions

 __construct ()
 
 build_secret ()
 build a secret key and returns it
 
 compute_code ($secret)
 compute a code for auth.
 
 get_authenticator ()
 
 set_authenticator ($authenticator)
 

Private Attributes

 $authenticator
 

Detailed Description

Definition at line 40 of file otp.class.php.

Constructor & Destructor Documentation

◆ __construct()

Noalyss\OTP::__construct ( )

Definition at line 44 of file otp.class.php.

44 {
45 $options = new AuthenticatorOptions;
46 $options->secret_length = 32;
47 $options->algorithm = AuthenticatorInterface::ALGO_SHA512;
48 $options->digits=6;
49 $this->authenticator = new Authenticator($options);
50 }

Member Function Documentation

◆ build_secret()

Noalyss\OTP::build_secret ( )

build a secret key and returns it

Returns
string random string of 32 char

Definition at line 55 of file otp.class.php.

55 {
56
57 $secret = $this->authenticator->createSecret();
58 return $secret;
59
60 }

References $secret.

◆ compute_code()

Noalyss\OTP::compute_code ( $secret)

compute a code for auth.

for the user passed in parameter

Parameters
$secret(string) secret stored in AC_USER

Definition at line 66 of file otp.class.php.

67 {
68
69 $this->authenticator->setSecret($secret);
70 return $this->authenticator->code();
71 }

References $secret.

◆ get_authenticator()

Noalyss\OTP::get_authenticator ( )

Definition at line 72 of file otp.class.php.

72 {
74 }

References $authenticator.

◆ set_authenticator()

Noalyss\OTP::set_authenticator ( $authenticator)

Definition at line 76 of file otp.class.php.

76 {
77 $this->authenticator = $authenticator;
78 return $this;
79 }

References $authenticator.

Field Documentation

◆ $authenticator

Noalyss\OTP::$authenticator
private

Definition at line 42 of file otp.class.php.

Referenced by set_authenticator().


The documentation for this class was generated from the following file: