- Copy the private key to clipboard
- Run command
pbpaste | base64 | pbcopy
- The private key is now base64 encoded in the clipboard. Paste it to env variable e.g. to heroku or to .env file
const private_key = new Buffer(process.env.PRIVATE_KEY, 'base64').toString('ascii');
You can always conveniently encode using notepad++ MIME Tools as well:
https://www.technipages.com/how-to-base64-encode-and-decode-in-notepad/