15 public static function create(array $channels = [],
int $userId = 0, array $options = []): array
17 if (empty($channels) && $userId === 0)
22 $ttl = is_integer($options[
'ttl']) && $options[
'ttl'] > 0 ? $options[
'ttl'] :
self::DEFAULT_TTL;
27 'iss' => (string)Config::getHostId(),
33 $data[
'sub'] = (string)$userId;
35 if (!empty($channels))
37 $data[
'chan'] = implode(
',', $channels);
39 $secret = Config::getSignatureKey();
41 return [Main\Web\JWT::encode($data, $secret), $exp];