This commit is contained in:
baodev0
2026-09-23 15:17:18 +07:00
parent cd38c5d6d0
commit 82a71244ca
107 changed files with 3332 additions and 3306 deletions
+12
View File
@@ -7,4 +7,16 @@ use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase
{
use CreatesApplication;
/**
* Header `x-access-token` như portal-client gửi (xem ClientAccessTokenCheck).
*/
protected function buildClientAccessToken(?int $timestamp = null, ?string $ip = null): string
{
$key = hex2bin((string) config('services.client_api.key'));
$payload = ['s' => (string) config('services.client_api.secret'), 't' => $timestamp ?? time()] + ($ip ? ['ip' => $ip] : []);
$iv = random_bytes(16);
return base64_encode($iv . openssl_encrypt(json_encode($payload), 'aes-256-cbc', $key, OPENSSL_RAW_DATA, $iv));
}
}