Accidentally leaked .env file

We accidentally shared a production .env file with a freelancer that had the following tokens:


Is there a way to regenerate these with Strapi or could someone kindly point me in the right direction?

I found this post on SO that detailed a method to manually generate some of the new keys, but was hoping to find something official on the format and requirements for Strapi related JWT keys.

Thank you!

To me your linked post looks completely right.

Just create new, fresh & clean strapi project. Start it.
Change the values in .env-File to abcd and restart to validate. (I wasn’t in need for this up to this point, but that would be my way how I would do it)

For generation of new keys you might want to look into supercharge/strings.

const Str = require('@supercharge/strings')

const random = Str.random()  
// 'zONHF73w_4M3cmv7GZpXG'

const random_WithFiftySymbols = Str.random(50)  
// 'iO3quoYg265hlzq30E8RelQc0LOKle4R0yk6CMbgeHgGNcm_mR'


Thanks for the response! So there are no requirements to the random strings, they can be anything? Do you know if they have length or format requirements?