From cf87a2d592ff714b47d37f6d00886ec6f10d2487 Mon Sep 17 00:00:00 2001 From: flashwave Date: Sun, 4 Aug 2024 23:04:06 +0000 Subject: [PATCH] Alternate method for generating codes. --- src/Verifications.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Verifications.php b/src/Verifications.php index e4f5a5a..c2b19b4 100644 --- a/src/Verifications.php +++ b/src/Verifications.php @@ -3,12 +3,14 @@ namespace Mince; use InvalidArgumentException; use RuntimeException; -use Index\Base32; +use Index\XString; use Index\Data\{DbStatementCache,IDbConnection}; use Index\Net\IPAddress; use Ramsey\Uuid\UuidInterface; class Verifications { + private const CODE_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'; + private IDbConnection $dbConn; private DbStatementCache $cache; @@ -18,7 +20,7 @@ class Verifications { } public static function generateCode(): string { - return Base32::encode(random_bytes(6)); + return XString::random(10, self::CODE_CHARS); } public function prune(): void {