diff --git a/src/Factory.php b/src/Factory.php index dc98c76eee442e7b93475491dcf0a3f78212db94..d5c60cc34a5e973e37c206304af0daa3c1189b62 100644 --- a/src/Factory.php +++ b/src/Factory.php @@ -62,12 +62,12 @@ final class Factory implements FactoryInterface { switch ($parsed_url->getHost()) { case 'totp': - $totp = TOTP::create($parsed_url->getSecret()); + $totp = TOTP::createFromSecret($parsed_url->getSecret()); $totp->setLabel(self::getLabel($parsed_url->getPath())); return $totp; case 'hotp': - $hotp = HOTP::create($parsed_url->getSecret()); + $hotp = HOTP::createFromSecret($parsed_url->getSecret()); $hotp->setLabel(self::getLabel($parsed_url->getPath())); return $hotp; diff --git a/src/HOTPInterface.php b/src/HOTPInterface.php index 011f86abe9a2ada58bfc39b2f22344ce4c455f3c..aa1f004dc41d036cf831ab86b083117241d2da04 100644 --- a/src/HOTPInterface.php +++ b/src/HOTPInterface.php @@ -15,6 +15,8 @@ interface HOTPInterface extends OTPInterface * Create a new HOTP object. * * If the secret is null, a random 64 bytes secret will be generated. + * + * @deprecated Deprecated since v11.1, use ::createFromSecret or ::generate instead */ public static function create( null|string $secret = null, diff --git a/src/TOTPInterface.php b/src/TOTPInterface.php index 550e9ff08d7088ddeca9ca760fcc0866ad758181..d0f05d3e4feff7389ffa25684fd3632d575ce1d2 100644 --- a/src/TOTPInterface.php +++ b/src/TOTPInterface.php @@ -10,6 +10,8 @@ interface TOTPInterface extends OTPInterface * Create a new TOTP object. * * If the secret is null, a random 64 bytes secret will be generated. + * + * @deprecated Deprecated since v11.1, use ::createFromSecret or ::generate instead */ public static function create( null|string $secret = null, diff --git a/src/Url.php b/src/Url.php index f3dce71f83c966b467d56caebafbd14344f38d4e..387d54fa5d5c3da89d0d827280ce5d554047d077 100644 --- a/src/Url.php +++ b/src/Url.php @@ -13,6 +13,9 @@ use function is_string; */ final class Url { + /** + * @param non-empty-string $secret + */ public function __construct( private readonly string $scheme, private readonly string $host, @@ -38,6 +41,9 @@ final class Url return $this->path; } + /** + * @return non-empty-string + */ public function getSecret(): string { return $this->secret;