Psecio\Jwt\Jwt::encrypt PHP Метод

encrypt() публичный Метод

Encrypt the data with the given key (and algorithm/IV)
public encrypt ( string $algorithm, string $iv, $key ) : string
$algorithm string Algorithm to use for encryption
$iv string IV for encrypting data
Результат string Encrypted string
    public function encrypt($algorithm, $iv, $key)
    {
        if (!function_exists('openssl_encrypt')) {
            throw new \RuntimeException('Cannot encrypt data, OpenSSL not enabled');
        }
        $data = json_encode($this->getClaims()->toArray(), JSON_UNESCAPED_SLASHES);
        $claims = $this->base64Encode(openssl_encrypt($data, $algorithm, $key, false, $iv));
        return $this->encode($claims);
    }