manifold/web/lib/api/api-key.ts

10 lines
278 B
TypeScript
Raw Normal View History

2022-08-26 16:54:13 +00:00
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)
}