mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
16 lines
530 B
TypeScript
16 lines
530 B
TypeScript
import { createSpeechmaticsJWT } from "@speechmatics/auth";
|
|
|
|
// WARNING: This function is used for the purpose of this example only.
|
|
// In a real-world scenario, you should not expose your API key in your client-side code.
|
|
// Instead, you should create a server-side endpoint that generates the JWT for you.
|
|
export async function getFlowAPIJwt(apiKey: string) {
|
|
if (!apiKey) {
|
|
throw new Error("API key is required.");
|
|
}
|
|
return await createSpeechmaticsJWT({
|
|
type: "flow",
|
|
apiKey,
|
|
ttl: 60, // 1 minute
|
|
});
|
|
}
|