15 lines
330 B
TypeScript
15 lines
330 B
TypeScript
'use server'
|
|
|
|
import { generateCaptcha, signCaptcha } from "@/lib/captcha"
|
|
|
|
export interface CaptchaResponse {
|
|
image: string
|
|
hash: string
|
|
}
|
|
|
|
export async function getNewCaptcha(): Promise<CaptchaResponse> {
|
|
const { text, data } = generateCaptcha()
|
|
const hash = signCaptcha(text)
|
|
return { image: data, hash }
|
|
}
|