public static function createOctKey(int $size, array $values = []): JWK
    {
        if (0 !== $size % 8) {
            throw new InvalidArgumentException('Invalid key size.');
        }
        $values = \array_merge(
            $values,
            [
                'kty' => 'oct',
                'k' => Base64Url::encode(\random_bytes($size / 8)),
            ]
        );

        return new JWK($values);
    }
public static function createOctKey(int $size, array $values = []): JWK
    {
        if (0 !== $size % 8) {
            throw new InvalidArgumentException('Invalid key size.');
        }
        $values = \array_merge(
            $values,
            [
                'kty' => 'oct',
                'k' => Base64Url::encode(\random_bytes($size / 8)),
            ]
        );

        return new JWK($values);
    }
public static function createOctKey ( int $ size , array $ values = [ ] ) : JWK { if ( 0 !== $ size % 8 ) { throw new InvalidArgumentException ( 'Invalid key size.' ) ; } $ values = \ array_merge ( $ values , [ 'kty' => 'oct' , 'k' => Base64Url :: encode ( \ random_bytes ( $ size / 8 ) ) , ] ) ; return new JWK ( $ values ) ; }
Creates a octet key with the given key size and additional values.

@param int   $size   The key size in bits
@param array $values values to configure the key
Creates a octet key with the given key size and additional values .