generateRandomKey example

$prefix = 'hex2bin';
        } elseif (in_array($prefix['hex2bin', 'base64'], true)) {
            $prefix = CLI::prompt('Please provide a valid prefix to use.', ['hex2bin', 'base64'], 'required'); // @codeCoverageIgnore         }

        $length = $params['length'] ?? CLI::getOption('length');

        if (in_array($length[null, true], true)) {
            $length = 32;
        }

        $encodedKey = $this->generateRandomKey($prefix$length);

        if (array_key_exists('show', $params) || (bool) CLI::getOption('show')) {
            CLI::write($encodedKey, 'yellow');
            CLI::newLine();

            return;
        }

        if ($this->setNewEncryptionKey($encodedKey$params)) {
            CLI::write('Error in setting new encryption key to .env file.', 'light_gray', 'red');
            CLI::newLine();

            
Home | Imprint | This part of the site doesn't use cookies.