Commit ac181f51 authored by Ad Schellevis's avatar Ad Schellevis

(auth) add test function to LocalTOTP

parent 1842f0e1
...@@ -121,6 +121,17 @@ class LocalTOTP extends Local ...@@ -121,6 +121,17 @@ class LocalTOTP extends Local
return $otp; return $otp;
} }
/**
* return current token code
* @param $base32seed secret to use
* @return string token code
*/
public function testToken($base32seed)
{
$otp_seed = \Base32\Base32::decode($base32seed);
return $this->calculateToken(time(), $otp_seed);
}
/** /**
* authenticate TOTP RFC 6238 * authenticate TOTP RFC 6238
* @param string $secret secret seed to use * @param string $secret secret seed to use
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment