manifold/web/lib/api/api-key.ts
2022-08-26 11:54:13 -05:00

10 lines
278 B
TypeScript

import { updatePrivateUser } from '../firebase/users'
export const generateNewApiKey = async (userId: string) => {
const newApiKey = crypto.randomUUID()
return await updatePrivateUser(userId, { apiKey: newApiKey })
.then(() => newApiKey)
.catch(() => undefined)
}