ecjia / auto-login
The Ecjia Auto-login package.
Installs: 2 297
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
pkg:composer/ecjia/auto-login
Requires
- php: ^7.1|^8.0
- illuminate/encryption: ^5.8|^6.0|^7.0|^8.0
README
Encrypt
默认使用系统自带的加密key进行加密,默认使用app.auth_key
$params = [
'admin_token' => 'xxxxxxxxxxxxxx',
'store_id' => '11',
];
$authcode = (new AuthLoginEncrypt($params))->encrypt();
使用自定义的加密key进行加密,$cipher是加密算法,默认取app.cipher
$params = [
'admin_token' => 'xxxxxxxxxxxxxx',
'store_id' => '11',
];
$encrypter = new AuthEncrypter($auth_key, $cipher);
$authcode = (new AuthLoginEncrypt($params, $encrypter))->encrypt();
Decrypt
默认使用系统自带的加密key进行加密,默认使用app.auth_key
$params = (new AuthLoginDecrypt($authcode))->decrypt();
使用自定义的加密key进行加密,$cipher是加密算法,默认取app.cipher
$encrypter = new AuthEncrypter($auth_key, $cipher);
$params = (new AuthLoginDecrypt($authcode, $encrypter))->decrypt();
默认超时时间30秒,如需自定义,实例对象的添加$timeout参数
$encrypter = new AuthEncrypter($auth_key, $cipher);
$params = (new AuthLoginDecrypt($authcode, $encrypter, 60))->decrypt();