Reputation: 1963
I am using php artisan key:generate
for generating AES key,but it updating env file each time.
I need to generate a unique AES key for a chatroom.
Any suggestion will be appreciated.
Upvotes: 4
Views: 326
Reputation: 33196
If you take a look at the source of this command, you can find the function that is used to generate this key. If you want to use this key for something else, you can reuse this function.
protected function generateRandomKey()
{
return 'base64:'.base64_encode(
Encrypter::generateKey($this->laravel['config']['app.cipher'])
);
}
Upvotes: 2
Reputation: 7824
This will not update the env file:
php artisan key:generate --show
Upvotes: 2