Skip to content

Commit

Permalink
changed config filename
Browse files Browse the repository at this point in the history
code style
  • Loading branch information
ericyzhu committed Sep 5, 2020
1 parent 05cf4d6 commit 9247a16
Show file tree
Hide file tree
Showing 17 changed files with 139 additions and 187 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

name: Release

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
9 changes: 4 additions & 5 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<?php

$header = <<<'EOF'
This file is part of Hyperf.
This file is part of hyperf-ext/hashing.
@link https://www.hyperf.io
@document https://hyperf.wiki
@contact [email protected]
@license https://github.com/hyperf/hyperf/blob/master/LICENSE
@link https://github.com/hyperf-ext/hashing
@contact [email protected]
@license https://github.com/hyperf-ext/hashing/blob/master/LICENSE
EOF;

return PhpCsFixer\Config::create()
Expand Down
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
The MIT License (MIT)

Copyright (c) Taylor Otwell
Copyright (c) Eric Zhu

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ composer require hyperf-ext/hashing
php bin/hyperf.php vendor:publish hyperf-ext/hashing
```

> 配置文件位于 `config/autoload/ext-hashing.php`
> 配置文件位于 `config/autoload/hashing.php`
## 默认配置

Expand Down Expand Up @@ -48,7 +48,7 @@ return [
];
```

你可以在 `config/autoload/ext-hashing.php` 配置文件中配置默认哈希驱动程序。目前支持三种驱动程序: Bcrypt 和 Argon2(Argon2i 和 Argon2id variants)。
你可以在 `config/autoload/hashing.php` 配置文件中配置默认哈希驱动程序。目前支持三种驱动程序: Bcrypt 和 Argon2(Argon2i 和 Argon2id variants)。

> 注意:Argon2i 驱动程序需要 PHP 7.2.0 或更高版本,而 Argon2id 驱动程序则需要 PHP 7.3.0 或更高版本。
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"hyperf",
"hashing"
],
"description": "The unofficial Hyperf Hashing package.",
"description": "The Hyperf Hashing package.",
"authors": [
{
"name": "Eric Zhu",
Expand Down
16 changes: 10 additions & 6 deletions publish/ext-hashing.php → publish/hashing.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
<?php

declare(strict_types=1);

/**
* This file is part of hyperf-ext/hashing.
*
* @link https://github.com/hyperf-ext/hashing
* @contact [email protected]
* @license https://github.com/hyperf-ext/hashing/blob/master/LICENSE
*/
return [

/*
|--------------------------------------------------------------------------
| Default Hash Driver
Expand Down Expand Up @@ -31,7 +36,7 @@

'bcrypt' => [
'class' => \HyperfExt\Hashing\Driver\BcryptDriver::class,
'options'=> [
'options' => [
'rounds' => env('BCRYPT_ROUNDS', 10),
],
],
Expand All @@ -49,7 +54,7 @@

'argon2i' => [
'class' => \HyperfExt\Hashing\Driver\Argon2IDriver::class,
'options'=> [
'options' => [
'memory' => 1024,
'threads' => 2,
'time' => 2,
Expand All @@ -58,12 +63,11 @@

'argon2id' => [
'class' => \HyperfExt\Hashing\Driver\Argon2IdDriver::class,
'options'=> [
'options' => [
'memory' => 1024,
'threads' => 2,
'time' => 2,
],
],
],

];
13 changes: 6 additions & 7 deletions src/ConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

declare(strict_types=1);
/**
* This file is part of Hyperf.
* This file is part of hyperf-ext/hashing.
*
* @link https://www.hyperf.io
* @document https://doc.hyperf.io
* @contact [email protected]
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
* @link https://github.com/hyperf-ext/hashing
* @contact [email protected]
* @license https://github.com/hyperf-ext/hashing/blob/master/LICENSE
*/
namespace HyperfExt\Hashing;

Expand All @@ -32,8 +31,8 @@ public function __invoke(): array
[
'id' => 'config',
'description' => 'The config for HyperfExt\\Hashing.',
'source' => __DIR__ . '/../publish/ext-hashing.php',
'destination' => BASE_PATH . '/config/autoload/ext-hashing.php',
'source' => __DIR__ . '/../publish/hashing.php',
'destination' => BASE_PATH . '/config/autoload/hashing.php',
],
],
];
Expand Down
28 changes: 7 additions & 21 deletions src/Contract/DriverInterface.php
Original file line number Diff line number Diff line change
@@ -1,48 +1,34 @@
<?php

declare(strict_types=1);

/**
* This file is part of hyperf-ext/hashing.
*
* @link https://github.com/hyperf-ext/hashing
* @contact [email protected]
* @license https://github.com/hyperf-ext/hashing/blob/master/LICENSE
*/
namespace HyperfExt\Hashing\Contract;

interface DriverInterface
{
/**
* Get information about the given hashed value.
*
* @param string $hashedValue
*
* @return array
*/
public function info(string $hashedValue): array;

/**
* Hash the given value.
*
* @param string $value
* @param array $options
*
* @return string
*/
public function make(string $value, array $options = []): string;

/**
* Check the given plain value against a hash.
*
* @param string $value
* @param string $hashedValue
* @param array $options
*
* @return bool
*/
public function check(string $value, string $hashedValue, array $options = []): bool;

/**
* Check if the given hash has been hashed using the given options.
*
* @param string $hashedValue
* @param array $options
*
* @return bool
*/
public function needsRehash(string $hashedValue, array $options = []): bool;
}
11 changes: 7 additions & 4 deletions src/Contract/HashInterface.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
<?php

declare(strict_types=1);

/**
* This file is part of hyperf-ext/hashing.
*
* @link https://github.com/hyperf-ext/hashing
* @contact [email protected]
* @license https://github.com/hyperf-ext/hashing/blob/master/LICENSE
*/
namespace HyperfExt\Hashing\Contract;

interface HashInterface extends DriverInterface
{
/**
* Get a driver instance.
*
* @param string|null $name
*
* @return \HyperfExt\Hashing\Contract\DriverInterface
*/
public function getDriver(?string $name = null): DriverInterface;

}
18 changes: 7 additions & 11 deletions src/Driver/AbstractDriver.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
<?php

declare(strict_types=1);

/**
* This file is part of hyperf-ext/hashing.
*
* @link https://github.com/hyperf-ext/hashing
* @contact [email protected]
* @license https://github.com/hyperf-ext/hashing/blob/master/LICENSE
*/
namespace HyperfExt\Hashing\Driver;

abstract class AbstractDriver
{
/**
* Get information about the given hashed value.
*
* @param string $hashedValue
*
* @return array
*/
public function info(string $hashedValue): array
{
Expand All @@ -20,12 +22,6 @@ public function info(string $hashedValue): array

/**
* Check the given plain value against a hash.
*
* @param string $value
* @param string $hashedValue
* @param array $options
*
* @return bool
*/
public function check(string $value, string $hashedValue, array $options = []): bool
{
Expand Down
Loading

0 comments on commit 9247a16

Please sign in to comment.