mirror of
https://github.com/formbricks/formbricks.git
synced 2026-02-05 02:58:36 -06:00
20 lines
515 B
TypeScript
20 lines
515 B
TypeScript
import { prisma } from "@formbricks/database";
|
|
import { getHash } from "../crypto";
|
|
import { TApiKey } from "@formbricks/types/v1/apiKeys";
|
|
|
|
export const getApiKey = async (apiKey: string): Promise<TApiKey | null> => {
|
|
return await prisma.apiKey.findUnique({
|
|
where: {
|
|
hashedKey: getHash(apiKey),
|
|
},
|
|
});
|
|
};
|
|
|
|
export const getApiKeyFromKey = async (apiKey: string): Promise<TApiKey | null> => {
|
|
return await prisma.apiKey.findUnique({
|
|
where: {
|
|
hashedKey: getHash(apiKey),
|
|
},
|
|
});
|
|
};
|