Skip to content

Commit 8f5e481

Browse files
committed
安装时初始化JWT密钥(64位随机字符串)
1 parent d049d92 commit 8f5e481

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/Install.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public static function installByRelation()
5353
}
5454

5555
/**
56-
* 安装时初始化JWT密钥(32位随机字符串
56+
* 安装时初始化JWT密钥(64位随机字符串
5757
* @param string $configFile
5858
* @return void
5959
*/
@@ -73,8 +73,8 @@ protected static function initJwtSecrets(string $configFile): void
7373
}
7474

7575
try {
76-
$accessKey = bin2hex(random_bytes(16));
77-
$refreshKey = bin2hex(random_bytes(16));
76+
$accessKey = bin2hex(random_bytes(32));
77+
$refreshKey = bin2hex(random_bytes(32));
7878
} catch (\Exception $e) {
7979
return;
8080
}

src/config/plugin/tinywan/jwt/app.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
/** 算法类型 HS256、HS384、HS512、RS256、RS384、RS512、ES256、ES384、ES512、PS256、PS384、PS512 */
77
'algorithms' => 'HS256',
88

9-
/** access令牌秘钥(安装时自动生成32位随机值) */
9+
/** access令牌秘钥(安装时自动生成64位随机值) */
1010
'access_secret_key' => '__JWT_ACCESS_SECRET_KEY__',
1111

1212
/** access令牌过期时间,单位:秒。默认 2 小时 */
1313
'access_exp' => 7200,
1414

15-
/** refresh令牌秘钥(安装时自动生成32位随机值) */
15+
/** refresh令牌秘钥(安装时自动生成64位随机值) */
1616
'refresh_secret_key' => '__JWT_REFRESH_SECRET_KEY__',
1717

1818
/** refresh令牌过期时间,单位:秒。默认 7 天 */

0 commit comments

Comments
 (0)