mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-02-17 02:41:13 +01:00
Add otp_type property when returning an OTP object
This commit is contained in:
parent
c27bef1819
commit
f19fb0adad
@ -7,6 +7,9 @@ class OtpDto
|
||||
/* @var integer */
|
||||
public string $password;
|
||||
|
||||
/* @var integer */
|
||||
public string $otp_type;
|
||||
|
||||
/* @var integer */
|
||||
public ?int $generated_at;
|
||||
|
||||
|
@ -132,12 +132,14 @@ public function getOTP($data) : OtpDto
|
||||
if ( $this->tokenOtpType() === 'totp' ) {
|
||||
|
||||
$OtpDto->generated_at = time();
|
||||
$OtpDto->otp_type = 'totp';
|
||||
$OtpDto->password = $this->token->at($OtpDto->generated_at);
|
||||
$OtpDto->valid_for = $this->token->getParameter('period');
|
||||
}
|
||||
else if ( $this->tokenOtpType() === 'hotp' ) {
|
||||
|
||||
$counter = $this->token->getCounter();
|
||||
$OtpDto->otp_type = 'hotp';
|
||||
$OtpDto->password = $this->token->at($counter);
|
||||
$OtpDto->counter = $counter + 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user