From e2d21d7d6e386f8bdf786f88e2f93570c22e647f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Sun, 15 May 2022 06:53:26 +0000 Subject: [PATCH] PR review changes --- Dockerfile | 3 +- src/Appwrite/Auth/Auth.php | 12 +++--- .../Auth/Hash/{BCrypt.php => Bcrypt.php} | 2 +- src/Appwrite/Auth/Hash/{MD5.php => Md5.php} | 2 +- .../Auth/Hash/{PHPass.php => Phpass.php} | 2 +- src/Appwrite/Auth/Hash/PlainText.php | 42 ------------------- .../Auth/Hash/{SCrypt.php => Scrypt.php} | 2 +- ...{SCryptModified.php => Scryptmodified.php} | 2 +- src/Appwrite/Auth/Hash/{SHA.php => Sha.php} | 2 +- src/Appwrite/Utopia/Response/Model/User.php | 2 +- 10 files changed, 15 insertions(+), 56 deletions(-) rename src/Appwrite/Auth/Hash/{BCrypt.php => Bcrypt.php} (97%) rename src/Appwrite/Auth/Hash/{MD5.php => Md5.php} (97%) rename src/Appwrite/Auth/Hash/{PHPass.php => Phpass.php} (99%) delete mode 100644 src/Appwrite/Auth/Hash/PlainText.php rename src/Appwrite/Auth/Hash/{SCrypt.php => Scrypt.php} (97%) rename src/Appwrite/Auth/Hash/{SCryptModified.php => Scryptmodified.php} (98%) rename src/Appwrite/Auth/Hash/{SHA.php => Sha.php} (98%) diff --git a/Dockerfile b/Dockerfile index 80e68b38e..21d7d3a46 100755 --- a/Dockerfile +++ b/Dockerfile @@ -33,6 +33,7 @@ ENV PHP_REDIS_VERSION=5.3.7 \ PHP_MONGODB_VERSION=1.9.1 \ PHP_SWOOLE_VERSION=v4.8.7 \ PHP_IMAGICK_VERSION=3.7.0 \ + PHP_SCRYPT_VERSION=v1.4.2 \ PHP_YAML_VERSION=2.2.2 \ PHP_MAXMINDDB_VERSION=v1.11.0 @@ -97,7 +98,7 @@ RUN \ ## Scrypt Extension FROM compile AS scrypt RUN \ - git clone --depth 1 --branch master https://github.com/DomBlack/php-scrypt.git && \ + git clone --depth 1 --branch $PHP_SCRYPT_VERSION https://github.com/DomBlack/php-scrypt.git && \ cd php-scrypt && \ phpize && \ ./configure --enable-scrypt && \ diff --git a/src/Appwrite/Auth/Auth.php b/src/Appwrite/Auth/Auth.php index 031f500bf..c25a674ca 100644 --- a/src/Appwrite/Auth/Auth.php +++ b/src/Appwrite/Auth/Auth.php @@ -10,12 +10,12 @@ class Auth const SUPPORTED_ALGOS = [ 'argon2' => 'Argon2', - 'bcrypt' => 'BCrypt', - 'md5' => 'MD5', - 'sha' => 'SHA', - 'phpass' => 'PHPass', - 'scrypt' => 'SCrypt', - 'scrypt_mod' => 'SCryptModified', + 'bcrypt' => 'Bcrypt', + 'md5' => 'Md5', + 'sha' => 'Sha', + 'phpass' => 'Phpass', + 'scrypt' => 'Scrypt', + 'scrypt_mod' => 'Scryptmodified', 'plaintext' => '' // This is alias for DX purposes. It is translated to default algo ]; diff --git a/src/Appwrite/Auth/Hash/BCrypt.php b/src/Appwrite/Auth/Hash/Bcrypt.php similarity index 97% rename from src/Appwrite/Auth/Hash/BCrypt.php rename to src/Appwrite/Auth/Hash/Bcrypt.php index 297be7157..46d1841a3 100644 --- a/src/Appwrite/Auth/Hash/BCrypt.php +++ b/src/Appwrite/Auth/Hash/Bcrypt.php @@ -11,7 +11,7 @@ use Appwrite\Auth\Hash; * * Refference: https://www.php.net/manual/en/password.constants.php */ -class BCrypt extends Hash +class Bcrypt extends Hash { /** * @param string $password Input password to hash diff --git a/src/Appwrite/Auth/Hash/MD5.php b/src/Appwrite/Auth/Hash/Md5.php similarity index 97% rename from src/Appwrite/Auth/Hash/MD5.php rename to src/Appwrite/Auth/Hash/Md5.php index 66c2166f0..f3d50162b 100644 --- a/src/Appwrite/Auth/Hash/MD5.php +++ b/src/Appwrite/Auth/Hash/Md5.php @@ -9,7 +9,7 @@ use Appwrite\Auth\Hash; * * Refference: https://www.php.net/manual/en/function.md5.php */ -class MD5 extends Hash +class Md5 extends Hash { /** * @param string $password Input password to hash diff --git a/src/Appwrite/Auth/Hash/PHPass.php b/src/Appwrite/Auth/Hash/Phpass.php similarity index 99% rename from src/Appwrite/Auth/Hash/PHPass.php rename to src/Appwrite/Auth/Hash/Phpass.php index 7520a2a33..0e309468a 100644 --- a/src/Appwrite/Auth/Hash/PHPass.php +++ b/src/Appwrite/Auth/Hash/Phpass.php @@ -32,7 +32,7 @@ use Appwrite\Auth\Hash; * * Refference: */ -class PHPass extends Hash +class Phpass extends Hash { /** * Alphabet used in itoa64 conversions. diff --git a/src/Appwrite/Auth/Hash/PlainText.php b/src/Appwrite/Auth/Hash/PlainText.php deleted file mode 100644 index a57c96270..000000000 --- a/src/Appwrite/Auth/Hash/PlainText.php +++ /dev/null @@ -1,42 +0,0 @@ - self::TYPE_STRING, 'description' => 'Password hashing algorithm.', 'default' => '', - 'example' => 'bcrypt', + 'example' => 'argon2', ]) ->addRule('hashOptions', [ 'type' => self::TYPE_STRING,