UNPKG

@hz-9/a5-authn

Version:

Authentication module for the @hz-9/a5-* series of repositories.

41 lines (40 loc) 1.1 kB
import { A5AuthTokenPairBo, A5AuthnUserPayloadBo } from '../../interfaces/auth'; export interface A5AuthnEmailService { /** * * 基于用户 Payload,获取用户 Token. * * @param user - 用户 Payload */ getTokens(user: A5AuthnUserPayloadBo): Promise<A5AuthTokenPairBo>; /** * * 基于邮箱和验证码,获取用户 Payload. * * 如果状态异常,可直接在函数中抛错,如果返回 null 则表示用户不存在或验证码错误 * * @param email * @param code */ validateEmail(email: string, code: string): Promise<A5AuthnUserPayloadBo | null>; /** * * 验证邮箱验证码. * * 如果验证失败,直接在函数中抛 400 错误。 * * @param email * @param code */ sendEmail(email: string): Promise<void>; /** * * 验证邮箱验证码. * * 如果验证失败,直接在函数中抛 400 错误。 * * @param email * @param code */ verifyEmail(email: string, code: string): Promise<void>; }