diff --git a/PHPGangsta/GoogleAuthenticator.php b/PHPGangsta/GoogleAuthenticator.php index bf7d116..db491f7 100644 --- a/PHPGangsta/GoogleAuthenticator.php +++ b/PHPGangsta/GoogleAuthenticator.php @@ -112,6 +112,22 @@ public function getQRCodeGoogleUrl($name, $secret, $title = null, $params = arra return "https://api.qrserver.com/v1/create-qr-code/?data=$urlencoded&size=${width}x${height}&ecc=$level"; } + /** + * Get OTP:// - Url + * @param string $name + * @param string $secret + * @param string $title + * + * @return string + */ + public function getOTPUrl($name,$secret,$title = null){ + $url = 'otpauth://totp/'.$name.'?secret='.$secret; + if (isset($title)) { + $url .= "&issuer=$title"; + } + return ($url); + } + /** * Check if the code is correct. This will accept codes starting from $discrepancy*30sec ago to $discrepancy*30sec from now. *