Created
October 19, 2023 15:37
-
-
Save ciao1092/57e982336d27965cd31530214135be29 to your computer and use it in GitHub Desktop.
Windows script to generate a secret key (requires node to be present in path!)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@set "code=console.log(require('crypto'^).randomBytes(64^).toString('hex'^)^);" | |
:randomFileName | |
@set "tempFileName=%temp%\%random%%random%%random%.js" | |
@(@if exist "%tempFileName%" (@goto :randomFileName) else ((@echo %code%) > "%tempFileName%")) && (@node "%tempFileName%" | @clip) && (@del "%tempFileName%") && @exit /b 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It will generate a key and copy it to the clipboard.
Node needs to be installed and in the %PATH%.