otp-gen-agent
Version:
A small and secure one time password (otp) generator for Javascript based on nanoid
20 lines (17 loc) • 864 B
text/typescript
declare const WEBHOOK_EVENTS: {
readonly OTP_GENERATED: "otp-generated";
readonly OTP_BULK_GENERATED: "bulk-otp-generated";
};
type WebhookEvent = typeof WEBHOOK_EVENTS[keyof typeof WEBHOOK_EVENTS];
interface OtpOptions {
length?: number;
chars?: string;
}
interface BulkOtpOptions extends OtpOptions {
}
type WebhookHandler = (event: WebhookEvent, data: Record<string, unknown>) => void | Promise<void>;
declare const setWebhookHandler: (handler: WebhookHandler) => void;
declare const otpGen: () => Promise<string>;
declare const customOtpGen: ({ length, chars, }?: OtpOptions) => Promise<string>;
declare const bulkOtpGen: (count?: number, opts?: BulkOtpOptions) => Promise<string[]>;
export { type BulkOtpOptions, type OtpOptions, WEBHOOK_EVENTS, type WebhookEvent, type WebhookHandler, bulkOtpGen, customOtpGen, otpGen, setWebhookHandler };