newInstanceWithoutConstructor(); (new ReflectionProperty(SessionGuard::class, 'name'))->setValue($guard, 'web-guard'); $id = str_repeat('F', 40); $cookie = static fn ($name, $value) => rawurlencode($cipher->encryptString(CookieValuePrefix::create($name, $key).$value)); $fixtures = []; foreach (['json', 'php'] as $serialization) { foreach ([false, true] as $encrypted) { $handler = new ArraySessionHandler(129600); $store = $encrypted ? new EncryptedStore('2fauth_session', $handler, $cipher, $id, $serialization) : new Store('2fauth_session', $handler, $id, $serialization); $store->start(); $store->put('_token', 'real-php-csrf-🔐'); $store->put($guard->getName(), 7); $store->put('preferences', ['language' => 'fr', 'enabled' => true]); $store->save(); $fixtures[] = [ 'php_version' => PHP_VERSION, 'framework_version' => Composer\InstalledVersions::getPrettyVersion('laravel/framework'), 'app_key' => $key, 'serialization' => $serialization, 'encrypted' => $encrypted, 'session_id' => $id, 'login_key' => $guard->getName(), 'recaller_name' => $guard->getRecallerName(), 'payload' => $handler->read($id), 'database_payload' => base64_encode($handler->read($id)), 'session_cookie' => $cookie('2fauth_session', $id), 'csrf_cookie' => $cookie('XSRF-TOKEN', $store->token()), 'recaller_cookie' => $cookie($guard->getRecallerName(), '7|remember-fixture|password-hash'), 'csrf' => $store->token(), ]; } } echo json_encode($fixtures, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)."\n";