Skip to content

Instantly share code, notes, and snippets.

View aryomuzakki's full-sized avatar

Muhammad Aryo Muzakki aryomuzakki

View GitHub Profile
@aryomuzakki
aryomuzakki / generate-secret-nodejs.md
Last active September 14, 2023 14:42 — forked from dehamzah/generate.js
Generate Secret Key with Node JS Crypto

script

require('crypto').randomBytes(64).toString('hex');
// 918fc5da09945d2f4086d2458f514bd4cacf6cab559174420f1e7d2caa8881edfdd78c417b9ad32b3c67a19ef4267bc50ff08cb913df158757b375c7f97371b6

require('crypto').randomBytes(64).toString('base64');
// hJNB4j5SI+mVxrvhoD/cSdHBMSFqWImEKlfWtMRVRSzoHp2uTSbixhBQ6iLaWtFK2mTENOUM6/mD2pD1ufgsAA==

require('crypto').randomBytes(64).toString('base64url');
// aMVKjWq3O0orHGddbW1HYQjD8hFeEtuH0Jrx80ZD0obT_wX8V9atgddDFMI3GS5InYbCoQAPVsMuzxGOJ_zi0g