1
0
Fork 0
mirror of synced 2024-06-03 11:24:48 +12:00

PR review changes

This commit is contained in:
Matej Bačo 2022-05-15 06:53:26 +00:00
parent deb1c95c47
commit e2d21d7d6e
10 changed files with 15 additions and 56 deletions

View file

@ -33,6 +33,7 @@ ENV PHP_REDIS_VERSION=5.3.7 \
PHP_MONGODB_VERSION=1.9.1 \ PHP_MONGODB_VERSION=1.9.1 \
PHP_SWOOLE_VERSION=v4.8.7 \ PHP_SWOOLE_VERSION=v4.8.7 \
PHP_IMAGICK_VERSION=3.7.0 \ PHP_IMAGICK_VERSION=3.7.0 \
PHP_SCRYPT_VERSION=v1.4.2 \
PHP_YAML_VERSION=2.2.2 \ PHP_YAML_VERSION=2.2.2 \
PHP_MAXMINDDB_VERSION=v1.11.0 PHP_MAXMINDDB_VERSION=v1.11.0
@ -97,7 +98,7 @@ RUN \
## Scrypt Extension ## Scrypt Extension
FROM compile AS scrypt FROM compile AS scrypt
RUN \ 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 && \ cd php-scrypt && \
phpize && \ phpize && \
./configure --enable-scrypt && \ ./configure --enable-scrypt && \

View file

@ -10,12 +10,12 @@ class Auth
const SUPPORTED_ALGOS = [ const SUPPORTED_ALGOS = [
'argon2' => 'Argon2', 'argon2' => 'Argon2',
'bcrypt' => 'BCrypt', 'bcrypt' => 'Bcrypt',
'md5' => 'MD5', 'md5' => 'Md5',
'sha' => 'SHA', 'sha' => 'Sha',
'phpass' => 'PHPass', 'phpass' => 'Phpass',
'scrypt' => 'SCrypt', 'scrypt' => 'Scrypt',
'scrypt_mod' => 'SCryptModified', 'scrypt_mod' => 'Scryptmodified',
'plaintext' => '' // This is alias for DX purposes. It is translated to default algo 'plaintext' => '' // This is alias for DX purposes. It is translated to default algo
]; ];

View file

@ -11,7 +11,7 @@ use Appwrite\Auth\Hash;
* *
* Refference: https://www.php.net/manual/en/password.constants.php * 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 * @param string $password Input password to hash

View file

@ -9,7 +9,7 @@ use Appwrite\Auth\Hash;
* *
* Refference: https://www.php.net/manual/en/function.md5.php * 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 * @param string $password Input password to hash

View file

@ -32,7 +32,7 @@ use Appwrite\Auth\Hash;
* *
* Refference: * Refference:
*/ */
class PHPass extends Hash class Phpass extends Hash
{ {
/** /**
* Alphabet used in itoa64 conversions. * Alphabet used in itoa64 conversions.

View file

@ -1,42 +0,0 @@
<?php
namespace Appwrite\Auth\Hash;
use Appwrite\Auth\Hash;
/*
* PlainText accepted options:
* none
*
* Refference: None. Simple plain text stored.
*/
class PlainText extends Hash
{
/**
* @param string $password Input password to hash
*
* @return string hash
*/
public function hash(string $password): string {
return $password;
}
/**
* @param string $password Input password to validate
* @param string $hash Hash to verify password against
*
* @return boolean true if password matches hash
*/
public function verify(string $password, string $hash): bool {
return $password === $hash;
}
/**
* Get default options for specific hashing algo
*
* @return mixed options named array
*/
public function getDefaultOptions(): mixed {
return [];
}
}

View file

@ -14,7 +14,7 @@ use Appwrite\Auth\Hash;
* *
* Refference: https://github.com/DomBlack/php-scrypt/blob/master/scrypt.php#L112-L116 * Refference: https://github.com/DomBlack/php-scrypt/blob/master/scrypt.php#L112-L116
*/ */
class SCrypt extends Hash class Scrypt extends Hash
{ {
/** /**
* @param string $password Input password to hash * @param string $password Input password to hash

View file

@ -13,7 +13,7 @@ use Appwrite\Auth\Hash;
* *
* Refference: https://github.com/DomBlack/php-scrypt/blob/master/scrypt.php#L112-L116 * Refference: https://github.com/DomBlack/php-scrypt/blob/master/scrypt.php#L112-L116
*/ */
class SCryptModified extends Hash class Scryptmodified extends Hash
{ {
/** /**
* @param string $password Input password to hash * @param string $password Input password to hash

View file

@ -13,7 +13,7 @@ use Appwrite\Auth\Hash;
* *
* Refference: https://www.php.net/manual/en/function.hash-algos.php * Refference: https://www.php.net/manual/en/function.hash-algos.php
*/ */
class SHA extends Hash class Sha extends Hash
{ {
/** /**
* @param string $password Input password to hash * @param string $password Input password to hash

View file

@ -33,7 +33,7 @@ class User extends Model
'type' => self::TYPE_STRING, 'type' => self::TYPE_STRING,
'description' => 'Password hashing algorithm.', 'description' => 'Password hashing algorithm.',
'default' => '', 'default' => '',
'example' => 'bcrypt', 'example' => 'argon2',
]) ])
->addRule('hashOptions', [ ->addRule('hashOptions', [
'type' => self::TYPE_STRING, 'type' => self::TYPE_STRING,