Created
April 20, 2024 08:14
-
-
Save tomarsachin2271/97f14878f847fd6d43d146333806ea57 to your computer and use it in GitHub Desktop.
Script to generate random API Keys
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
import * as shortid from "shortid"; | |
import { v4 as uuidv4 } from "uuid"; | |
const createApiKey = (apiKeyPrefix: string): string => | |
`${apiKeyPrefix}.${uuidv4()}`; | |
function generateApiKey(): string { | |
const apiKeyPrefix = shortid.generate(); | |
return createApiKey(apiKeyPrefix); | |
} | |
let apiKey = generateApiKey(); | |
console.log(`Generated API Key: ${apiKey}`) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment