From e36903860934c961f189bf844fc94a1f6a89f5ff Mon Sep 17 00:00:00 2001 From: flashwave Date: Fri, 21 Jul 2023 21:56:09 +0000 Subject: [PATCH] Updated Index Serialiser usage. --- composer.lock | 4 ++-- misuzu.php | 1 - src/AuthToken.php | 6 +++--- src/TOTP.php | 6 +++--- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/composer.lock b/composer.lock index f2a9bf7..608ce65 100644 --- a/composer.lock +++ b/composer.lock @@ -348,7 +348,7 @@ "source": { "type": "git", "url": "https://git.flash.moe/flash/index.git", - "reference": "fc55b73ba177bdec96fdd5d494c2c990475a4cc5" + "reference": "4aae77900be26fccb23a7508744ef17d6b217e5f" }, "require": { "ext-mbstring": "*", @@ -386,7 +386,7 @@ ], "description": "Composer package for the common library for my projects.", "homepage": "https://railgun.sh/index", - "time": "2023-07-21T18:42:55+00:00" + "time": "2023-07-21T21:47:41+00:00" }, { "name": "matomo/device-detector", diff --git a/misuzu.php b/misuzu.php index cab932f..73cdf48 100644 --- a/misuzu.php +++ b/misuzu.php @@ -1,7 +1,6 @@ getTimestamp()); $data = $prefix . hash_hmac('sha3-256', $prefix . $data, self::$secretKey, true) . $data; if($base64) - $data = Serialiser::uriBase64()->serialise($data); + $data = UriBase64::encode($data); return $data; } @@ -108,7 +108,7 @@ class AuthToken { if(empty($data)) return $obj; if($base64) - $data = Serialiser::uriBase64()->deserialise($data); + $data = UriBase64::decode($data); if(empty($data)) return $obj; diff --git a/src/TOTP.php b/src/TOTP.php index acbc5dc..5ad08bf 100644 --- a/src/TOTP.php +++ b/src/TOTP.php @@ -1,7 +1,7 @@ serialise(random_bytes(16)); + return Base32::encode(random_bytes(16)); } public static function timecode(?int $timestamp = null, int $interval = self::INTERVAL): int { @@ -24,7 +24,7 @@ class TOTP { } public function generate(?int $timestamp = null): string { - $hash = hash_hmac(self::HASH_ALGO, pack('J', self::timecode($timestamp)), Serialiser::base32()->deserialise($this->secretKey), true); + $hash = hash_hmac(self::HASH_ALGO, pack('J', self::timecode($timestamp)), Base32::decode($this->secretKey), true); $offset = ord($hash[strlen($hash) - 1]) & 0x0F; $bin = 0;