Backfill api keys

This commit is contained in:
David Corbitt
2023-08-07 13:08:33 -07:00
parent c9f59bfb79
commit 8f49bace53
5 changed files with 167 additions and 1 deletions

View File

@@ -0,0 +1,11 @@
const KEY_LENGTH = 42;
export const generateApiKey = () => {
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
let randomChars = "";
for (let i = 0; i < KEY_LENGTH; i++) {
randomChars += chars.charAt(Math.floor(Math.random() * chars.length));
}
return `opc_${randomChars}`;
};