tempest-express-sdk 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -2771,12 +2771,62 @@ declare const authResponseSchema: z.ZodObject<{
2771
2771
  expiresIn: number;
2772
2772
  };
2773
2773
  }>;
2774
+ /** MFA enrollment response (`POST /auth/mfa/enroll`). */
2775
+ declare const mfaEnrollResponseSchema: z.ZodObject<{
2776
+ secret: z.ZodString;
2777
+ otpauthUri: z.ZodString;
2778
+ }, "strip", z.ZodTypeAny, {
2779
+ secret: string;
2780
+ otpauthUri: string;
2781
+ }, {
2782
+ secret: string;
2783
+ otpauthUri: string;
2784
+ }>;
2785
+ /** A 6-digit MFA code body (`POST /auth/mfa/confirm|disable`). */
2786
+ declare const mfaCodeSchema: z.ZodObject<{
2787
+ code: z.ZodString;
2788
+ }, "strip", z.ZodTypeAny, {
2789
+ code: string;
2790
+ }, {
2791
+ code: string;
2792
+ }>;
2793
+ /** Activation body (`POST /auth/activate`). */
2794
+ declare const activationSchema: z.ZodObject<{
2795
+ token: z.ZodString;
2796
+ }, "strip", z.ZodTypeAny, {
2797
+ token: string;
2798
+ }, {
2799
+ token: string;
2800
+ }>;
2801
+ /** Password-reset request body (`POST /auth/password-reset/request`). */
2802
+ declare const passwordResetRequestSchema: z.ZodObject<{
2803
+ email: z.ZodString;
2804
+ }, "strip", z.ZodTypeAny, {
2805
+ email: string;
2806
+ }, {
2807
+ email: string;
2808
+ }>;
2809
+ /** Password-reset confirm body (`POST /auth/password-reset/confirm`). */
2810
+ declare const passwordResetConfirmSchema: z.ZodObject<{
2811
+ token: z.ZodString;
2812
+ password: z.ZodString;
2813
+ }, "strip", z.ZodTypeAny, {
2814
+ password: string;
2815
+ token: string;
2816
+ }, {
2817
+ password: string;
2818
+ token: string;
2819
+ }>;
2774
2820
  type SignupInput = z.infer<typeof signupSchema>;
2775
2821
  type LoginInput = z.infer<typeof loginSchema>;
2776
2822
  type RefreshInput = z.infer<typeof refreshSchema>;
2777
2823
  type TokenPair = z.infer<typeof tokenPairSchema>;
2778
2824
  type UserPublic = z.infer<typeof userPublicSchema>;
2779
2825
  type AuthResponse = z.infer<typeof authResponseSchema>;
2826
+ type MfaCodeInput = z.infer<typeof mfaCodeSchema>;
2827
+ type ActivationInput = z.infer<typeof activationSchema>;
2828
+ type PasswordResetRequestInput = z.infer<typeof passwordResetRequestSchema>;
2829
+ type PasswordResetConfirmInput = z.infer<typeof passwordResetConfirmSchema>;
2780
2830
 
2781
2831
  /**
2782
2832
  * User authentication service, mirroring `auth.service.UserAuthService`.
@@ -2871,6 +2921,197 @@ declare class UserAuthService {
2871
2921
  refresh(refreshToken: string): Promise<AuthResponse>;
2872
2922
  }
2873
2923
 
2924
+ /**
2925
+ * TOTP MFA enrollment/verification, mirroring the FastAPI SDK MFA flow.
2926
+ *
2927
+ * Orchestrates {@link TOTPHelper} over a pluggable {@link MfaStore}: enroll
2928
+ * (generate + persist a secret, return the provisioning URI), confirm (verify a
2929
+ * code and flip MFA on), verify (login step) and disable.
2930
+ */
2931
+
2932
+ /** Persistence port for MFA secrets/state. */
2933
+ interface MfaStore {
2934
+ /** Persist a user's TOTP secret (pending until confirmed). */
2935
+ setSecret(userId: string, secret: string): Promise<void>;
2936
+ /** Read a user's TOTP secret, or `null`. */
2937
+ getSecret(userId: string): Promise<string | null>;
2938
+ /** Flip the MFA-enabled flag. */
2939
+ setEnabled(userId: string, enabled: boolean): Promise<void>;
2940
+ /** Whether MFA is enabled for the user. */
2941
+ isEnabled(userId: string): Promise<boolean>;
2942
+ }
2943
+ /** The result of starting enrollment. */
2944
+ interface MfaEnrollment {
2945
+ /** The base32 secret (persist server-side; also shown once for manual entry). */
2946
+ secret: string;
2947
+ /** The `otpauth://` URI to render as a QR code. */
2948
+ otpauthUri: string;
2949
+ }
2950
+ /** Options for {@link MfaService}. */
2951
+ interface MfaServiceOptions {
2952
+ /** The MFA persistence port. */
2953
+ store: MfaStore;
2954
+ /** The TOTP helper (issuer preconfigured). */
2955
+ totp: TOTPHelper;
2956
+ }
2957
+ declare class MfaService {
2958
+ private readonly store;
2959
+ private readonly totp;
2960
+ /**
2961
+ * @param options - Store and TOTP helper.
2962
+ */
2963
+ constructor(options: MfaServiceOptions);
2964
+ /**
2965
+ * Begin enrollment: generate and persist a secret, return the QR URI.
2966
+ *
2967
+ * @param userId - The enrolling user.
2968
+ * @param accountName - Label shown in the authenticator (usually the email).
2969
+ * @returns The secret and provisioning URI.
2970
+ */
2971
+ enroll(userId: string, accountName: string): Promise<MfaEnrollment>;
2972
+ /**
2973
+ * Confirm enrollment by verifying a code, enabling MFA on success.
2974
+ *
2975
+ * @param userId - The user.
2976
+ * @param code - The 6-digit code from the authenticator.
2977
+ * @throws {ValidationException} When no secret is pending or the code is wrong.
2978
+ */
2979
+ confirm(userId: string, code: string): Promise<void>;
2980
+ /**
2981
+ * Verify a code (login step). Returns `false` without throwing.
2982
+ *
2983
+ * @param userId - The user.
2984
+ * @param code - The submitted code.
2985
+ * @returns `true` when the code is valid.
2986
+ */
2987
+ verify(userId: string, code: string): Promise<boolean>;
2988
+ /**
2989
+ * Disable MFA after verifying a code.
2990
+ *
2991
+ * @param userId - The user.
2992
+ * @param code - The submitted code.
2993
+ * @throws {ValidationException} When the code is invalid.
2994
+ */
2995
+ disable(userId: string, code: string): Promise<void>;
2996
+ }
2997
+
2998
+ /**
2999
+ * Email-activation flow, mirroring the FastAPI SDK activation flow.
3000
+ *
3001
+ * Issues a single-use opaque token (only its SHA-256 hash is stored), emails
3002
+ * the plaintext to the user, and activates the account when the link is opened.
3003
+ */
3004
+ /** Persistence port for activation tokens. */
3005
+ interface ActivationStore {
3006
+ /** Persist a token hash + expiry (epoch ms) for a user. */
3007
+ saveActivationToken(userId: string, tokenHash: string, expiresAt: number): Promise<void>;
3008
+ /** Look up a token hash, returning the owner + expiry, or `null`. */
3009
+ findActivationToken(tokenHash: string): Promise<{
3010
+ userId: string;
3011
+ expiresAt: number;
3012
+ } | null>;
3013
+ /** Remove a token hash (single-use). */
3014
+ clearActivationToken(tokenHash: string): Promise<void>;
3015
+ /** Mark a user active. */
3016
+ activate(userId: string): Promise<void>;
3017
+ }
3018
+ /** Options for {@link ActivationService}. */
3019
+ interface ActivationServiceOptions {
3020
+ /** The activation persistence port. */
3021
+ store: ActivationStore;
3022
+ /** Token lifetime in seconds. Default 86400 (24h). */
3023
+ ttlSeconds?: number;
3024
+ }
3025
+ declare class ActivationService {
3026
+ private readonly store;
3027
+ private readonly ttlSeconds;
3028
+ /**
3029
+ * @param options - Store and token TTL.
3030
+ */
3031
+ constructor(options: ActivationServiceOptions);
3032
+ /**
3033
+ * Start activation: issue a token and persist its hash.
3034
+ *
3035
+ * @param userId - The user to activate.
3036
+ * @returns The one-time plaintext token (embed in the activation link).
3037
+ */
3038
+ start(userId: string): Promise<string>;
3039
+ /**
3040
+ * Activate an account from a token.
3041
+ *
3042
+ * @param token - The plaintext token from the activation link.
3043
+ * @returns The activated user id.
3044
+ * @throws {InvalidTokenException} When the token is unknown or expired.
3045
+ */
3046
+ activate(token: string): Promise<string>;
3047
+ }
3048
+
3049
+ /**
3050
+ * Password-reset flow, mirroring the FastAPI SDK reset flow.
3051
+ *
3052
+ * `request` issues a single-use opaque token (hash stored) for a known email,
3053
+ * returning it so the caller can email the reset link — without leaking whether
3054
+ * the email exists. `confirm` validates the token + new password and rehashes.
3055
+ */
3056
+
3057
+ /** Persistence port for password resets. */
3058
+ interface PasswordResetStore {
3059
+ /** Resolve a (lowercased) email to a user id, or `null`. */
3060
+ findUserIdByEmail(email: string): Promise<string | null>;
3061
+ /** Persist a reset token hash + expiry (epoch ms). */
3062
+ saveResetToken(userId: string, tokenHash: string, expiresAt: number): Promise<void>;
3063
+ /** Look up a reset token hash, returning owner + expiry, or `null`. */
3064
+ findResetToken(tokenHash: string): Promise<{
3065
+ userId: string;
3066
+ expiresAt: number;
3067
+ } | null>;
3068
+ /** Remove a reset token hash (single-use). */
3069
+ clearResetToken(tokenHash: string): Promise<void>;
3070
+ /** Overwrite a user's password hash. */
3071
+ updatePassword(userId: string, passwordHash: string): Promise<void>;
3072
+ }
3073
+ /** Options for {@link PasswordResetService}. */
3074
+ interface PasswordResetServiceOptions {
3075
+ /** The reset persistence port. */
3076
+ store: PasswordResetStore;
3077
+ /** Password hasher. */
3078
+ password: PasswordUtils;
3079
+ /** Token lifetime in seconds. Default 3600 (1h). */
3080
+ ttlSeconds?: number;
3081
+ /** Minimum new-password length. Default 12. */
3082
+ passwordMinLength?: number;
3083
+ }
3084
+ declare class PasswordResetService {
3085
+ private readonly store;
3086
+ private readonly password;
3087
+ private readonly ttlSeconds;
3088
+ private readonly passwordMinLength;
3089
+ /**
3090
+ * @param options - Store, password hasher and policy.
3091
+ */
3092
+ constructor(options: PasswordResetServiceOptions);
3093
+ /**
3094
+ * Request a reset for `email`.
3095
+ *
3096
+ * Returns the plaintext token only when the email maps to a user; otherwise
3097
+ * `null`. Callers should respond with the same success shape either way to
3098
+ * avoid user enumeration — email the token only when present.
3099
+ *
3100
+ * @param email - The account email.
3101
+ * @returns The one-time token, or `null` when no user matches.
3102
+ */
3103
+ request(email: string): Promise<string | null>;
3104
+ /**
3105
+ * Confirm a reset: validate the token + new password and rehash.
3106
+ *
3107
+ * @param token - The plaintext reset token.
3108
+ * @param newPassword - The new plaintext password.
3109
+ * @throws {ValidationException} When the new password is too short.
3110
+ * @throws {InvalidTokenException} When the token is unknown or expired.
3111
+ */
3112
+ confirm(token: string, newPassword: string): Promise<void>;
3113
+ }
3114
+
2874
3115
  /**
2875
3116
  * JWT auth middleware + role guards, mirroring `api.dependencies.auth`.
2876
3117
  *
@@ -2978,6 +3219,15 @@ interface AuthRouterOptions {
2978
3219
  prefix?: string;
2979
3220
  /** When provided, OpenAPI paths are registered for Swagger/Redoc. */
2980
3221
  registry?: OpenAPIRegistry;
3222
+ /** Mount `POST /auth/activate` when provided. */
3223
+ activation?: ActivationService;
3224
+ /** Mount `POST /auth/password-reset/{request,confirm}` when provided. */
3225
+ passwordReset?: PasswordResetService;
3226
+ /**
3227
+ * Mount guarded `POST /auth/mfa/{enroll,confirm,disable}` when provided. The
3228
+ * enrolling account label defaults to the `email` claim (falls back to `sub`).
3229
+ */
3230
+ mfa?: MfaService;
2981
3231
  }
2982
3232
  /**
2983
3233
  * Build the auth router.
@@ -3219,6 +3469,6 @@ interface RunServerOptions {
3219
3469
  declare function runServer(app: Express, options?: RunServerOptions): Promise<Server>;
3220
3470
 
3221
3471
  /** The installed SDK version. Single source of truth for the barrel + CLI. */
3222
- declare const VERSION = "0.6.0";
3472
+ declare const VERSION = "0.7.0";
3223
3473
 
3224
- export { type AdminField, type AdminListQuery, type AdminListResult, type AdminResource, type AdminRouterOptions, AdminSite, AppException, type AppExceptionHandlerOptions, type AppExceptionOptions, type AttachWebSocketOptions, AttemptThrottle, type AttemptThrottleOptions, type AuthResponse, type AuthRouterOptions, type AuthUser, type BaseAppSettings, BaseController, BaseModel, type BaseResponse, BaseService, type BrokerManager, CEP_PATTERN, CNPJ_PATTERN, CPF_PATTERN, type CPUMetrics, type CacheManager, type CachedOptions, type CatalogData, CircuitOpenError, type ClientIpOptions, CompositeFeatureFlagBackend, ConflictException, type CreateAppOpenApi, type CreateAppOptions, type CursorPaginationFilter, DEFAULT_LOCALE, type EmailMessage, type EmailOptions, EmailUtils, type Enum, type EnumHelpers, type EnumSpec, EnvFeatureFlagBackend, EventStream, type EventStreamOptions, type ExceptionDetails, ExpiredTokenException, type FeatureFlagBackend, FeatureFlags, type FlagContext, ForbiddenException, type GenerateOpenApiOptions, HTTPClient, type HTTPClientOptions, HTTP_500_MARKER, type HandshakeInfo, type HealthCheck, type HealthRouterOptions, type InboundHandler, type InboundMessage, InvalidTokenException, type IssuedSession, JSONLogger, JWTUtils, type JWTUtilsOptions, type JwtAuthOptions, type JwtClaims, LocalUploadStorage, type LocalUploadStorageOptions, type LogExtra, type LogLevel, type LoginInput, type MediaKind, MemoryBroker, MemoryCacheManager, MemoryFeatureFlagBackend, type MemoryMetrics, MemorySessionStore, MemoryThrottleBackend, MessageCatalog, type MessageHandler, type MessagingProvider, MetricsUtils, NotFoundException, type OpenApiDocument, type OpenApiInfo, type OutboundMedia, type OutboundResult, PHONE_BR_PATTERN, type PaginationFilter, PasswordUtils, REQUEST_ID_HEADER, RabbitBroker, type RabbitBrokerOptions, RedisCacheManager, type RedisLike, type RedocOptions, type RefreshInput, Region, type RegionValue, type RegisterExceptionHandlersOptions, type RequestContext, type ResponseMapper, RetryPolicy, type RunServerOptions, SSEBroker, type SaveOptions, type SendOptions, ServerSentEvent, type ServerSentEventInit, type Session, type SessionMiddlewareOptions, SessionService, type SessionServiceOptions, type SessionStore, type SignupInput, type StateBR, type SwaggerOptions, type SystemMetrics, TOTPHelper, type TOTPOptions, type TaskHandler, TaskManager, type TaskManagerOptions, TelegramProvider, type TelegramProviderOptions, type ThrottleBackend, type ThrottleStatus, type ToDictOptions, type TokenPair, TooManyRequestsException, type TooManyRequestsOptions, TwilioSmsProvider, type TwilioSmsProviderOptions, type TwilioWebhookOptions, UF, type UFValue, UnauthorizedException, type UnhandledExceptionHandlerOptions, type UploadResult, type UploadStorage, UserAuthService, type UserAuthServiceOptions, type UserPublic, type UserStore, VERSION, ValidationException, type WSEnvelope, WebPushDispatcher, type WebPushDispatcherOptions, WebPushError, WebPushGoneError, type WebPushKeys, type WebPushPayload, type WebPushSubscription, type WebSocketConnection, WebSocketHub, type WebSocketHubOptions, type WebSocketLike, WhatsAppProvider, type WhatsAppProviderOptions, type WhatsAppWebhookOptions, attachWebSocketHub, authResponseSchema, baseAppSettingsSchema, baseAppSettingsShape, baseResponseSchema, bearerToken, buildContentDisposition, cached, cepField, citiesByUf, cnpjField, coerceFlag, configureLogging, corsSettingsShape, cpfField, cpfOrCnpjField, createApp, createOpenApiRegistry, createdByColumn, cursorPaginationFilterSchema, cursorPaginationSchema, databaseSettingsShape, decodeCursor, defaultMessageCatalog, defineEnum, deletedAtColumn, encodeCursor, generateOpaqueToken, generateOpenApiDocument, getAuth, getClientIp, getConditions, getPaginationConditions, getRequestId, getState, hashOpaqueToken, inboundMessageSchema, isValidCep, isValidCity, isValidCnpj, isValidCpf, isValidCpfCnpj, isValidPhoneBr, isValidUf, listStates, loadSettings, loginSchema, makeAdminRouter, makeAppExceptionHandler, makeAuthRouter, makeFlagGuard, makeHealthRouter, makeJwtAuthMiddleware, makeSessionMiddleware, makeTwilioWebhookRouter, makeUnhandledExceptionHandler, makeWhatsAppWebhookRouter, modifyDict, mountOpenApiJson, mountRedoc, mountSwaggerUi, normalizeCep, normalizeCnpj, normalizeCpf, normalizeCpfCnpj, normalizePhoneBr, normalizeUf, notFoundHandler, onlyDigits, paginationFilterSchema, paginationSchema, parseAcceptLanguage, parseCookies, phoneBrField, refreshSchema, registerExceptionHandlers, requestIdMiddleware, requireRoles, runServer, runWithRequestContext, serverSettingsShape, sessionCookie, setRequestId, signupSchema, sseResponse, statesByRegion, tableNameFor, toDict, toUtc, tokenFromUrl, tokenPairSchema, ufField, updatedByColumn, userPublicSchema, utcnow, validateTwilioSignature, verifyOpaqueToken, webPushKeysSchema, webPushPayloadSchema, webPushSubscriptionSchema, wsEnvelopeSchema };
3474
+ export { type ActivationInput, ActivationService, type ActivationServiceOptions, type ActivationStore, type AdminField, type AdminListQuery, type AdminListResult, type AdminResource, type AdminRouterOptions, AdminSite, AppException, type AppExceptionHandlerOptions, type AppExceptionOptions, type AttachWebSocketOptions, AttemptThrottle, type AttemptThrottleOptions, type AuthResponse, type AuthRouterOptions, type AuthUser, type BaseAppSettings, BaseController, BaseModel, type BaseResponse, BaseService, type BrokerManager, CEP_PATTERN, CNPJ_PATTERN, CPF_PATTERN, type CPUMetrics, type CacheManager, type CachedOptions, type CatalogData, CircuitOpenError, type ClientIpOptions, CompositeFeatureFlagBackend, ConflictException, type CreateAppOpenApi, type CreateAppOptions, type CursorPaginationFilter, DEFAULT_LOCALE, type EmailMessage, type EmailOptions, EmailUtils, type Enum, type EnumHelpers, type EnumSpec, EnvFeatureFlagBackend, EventStream, type EventStreamOptions, type ExceptionDetails, ExpiredTokenException, type FeatureFlagBackend, FeatureFlags, type FlagContext, ForbiddenException, type GenerateOpenApiOptions, HTTPClient, type HTTPClientOptions, HTTP_500_MARKER, type HandshakeInfo, type HealthCheck, type HealthRouterOptions, type InboundHandler, type InboundMessage, InvalidTokenException, type IssuedSession, JSONLogger, JWTUtils, type JWTUtilsOptions, type JwtAuthOptions, type JwtClaims, LocalUploadStorage, type LocalUploadStorageOptions, type LogExtra, type LogLevel, type LoginInput, type MediaKind, MemoryBroker, MemoryCacheManager, MemoryFeatureFlagBackend, type MemoryMetrics, MemorySessionStore, MemoryThrottleBackend, MessageCatalog, type MessageHandler, type MessagingProvider, MetricsUtils, type MfaCodeInput, type MfaEnrollment, MfaService, type MfaServiceOptions, type MfaStore, NotFoundException, type OpenApiDocument, type OpenApiInfo, type OutboundMedia, type OutboundResult, PHONE_BR_PATTERN, type PaginationFilter, type PasswordResetConfirmInput, type PasswordResetRequestInput, PasswordResetService, type PasswordResetServiceOptions, type PasswordResetStore, PasswordUtils, REQUEST_ID_HEADER, RabbitBroker, type RabbitBrokerOptions, RedisCacheManager, type RedisLike, type RedocOptions, type RefreshInput, Region, type RegionValue, type RegisterExceptionHandlersOptions, type RequestContext, type ResponseMapper, RetryPolicy, type RunServerOptions, SSEBroker, type SaveOptions, type SendOptions, ServerSentEvent, type ServerSentEventInit, type Session, type SessionMiddlewareOptions, SessionService, type SessionServiceOptions, type SessionStore, type SignupInput, type StateBR, type SwaggerOptions, type SystemMetrics, TOTPHelper, type TOTPOptions, type TaskHandler, TaskManager, type TaskManagerOptions, TelegramProvider, type TelegramProviderOptions, type ThrottleBackend, type ThrottleStatus, type ToDictOptions, type TokenPair, TooManyRequestsException, type TooManyRequestsOptions, TwilioSmsProvider, type TwilioSmsProviderOptions, type TwilioWebhookOptions, UF, type UFValue, UnauthorizedException, type UnhandledExceptionHandlerOptions, type UploadResult, type UploadStorage, UserAuthService, type UserAuthServiceOptions, type UserPublic, type UserStore, VERSION, ValidationException, type WSEnvelope, WebPushDispatcher, type WebPushDispatcherOptions, WebPushError, WebPushGoneError, type WebPushKeys, type WebPushPayload, type WebPushSubscription, type WebSocketConnection, WebSocketHub, type WebSocketHubOptions, type WebSocketLike, WhatsAppProvider, type WhatsAppProviderOptions, type WhatsAppWebhookOptions, activationSchema, attachWebSocketHub, authResponseSchema, baseAppSettingsSchema, baseAppSettingsShape, baseResponseSchema, bearerToken, buildContentDisposition, cached, cepField, citiesByUf, cnpjField, coerceFlag, configureLogging, corsSettingsShape, cpfField, cpfOrCnpjField, createApp, createOpenApiRegistry, createdByColumn, cursorPaginationFilterSchema, cursorPaginationSchema, databaseSettingsShape, decodeCursor, defaultMessageCatalog, defineEnum, deletedAtColumn, encodeCursor, generateOpaqueToken, generateOpenApiDocument, getAuth, getClientIp, getConditions, getPaginationConditions, getRequestId, getState, hashOpaqueToken, inboundMessageSchema, isValidCep, isValidCity, isValidCnpj, isValidCpf, isValidCpfCnpj, isValidPhoneBr, isValidUf, listStates, loadSettings, loginSchema, makeAdminRouter, makeAppExceptionHandler, makeAuthRouter, makeFlagGuard, makeHealthRouter, makeJwtAuthMiddleware, makeSessionMiddleware, makeTwilioWebhookRouter, makeUnhandledExceptionHandler, makeWhatsAppWebhookRouter, mfaCodeSchema, mfaEnrollResponseSchema, modifyDict, mountOpenApiJson, mountRedoc, mountSwaggerUi, normalizeCep, normalizeCnpj, normalizeCpf, normalizeCpfCnpj, normalizePhoneBr, normalizeUf, notFoundHandler, onlyDigits, paginationFilterSchema, paginationSchema, parseAcceptLanguage, parseCookies, passwordResetConfirmSchema, passwordResetRequestSchema, phoneBrField, refreshSchema, registerExceptionHandlers, requestIdMiddleware, requireRoles, runServer, runWithRequestContext, serverSettingsShape, sessionCookie, setRequestId, signupSchema, sseResponse, statesByRegion, tableNameFor, toDict, toUtc, tokenFromUrl, tokenPairSchema, ufField, updatedByColumn, userPublicSchema, utcnow, validateTwilioSignature, verifyOpaqueToken, webPushKeysSchema, webPushPayloadSchema, webPushSubscriptionSchema, wsEnvelopeSchema };
package/dist/index.d.ts CHANGED
@@ -2771,12 +2771,62 @@ declare const authResponseSchema: z.ZodObject<{
2771
2771
  expiresIn: number;
2772
2772
  };
2773
2773
  }>;
2774
+ /** MFA enrollment response (`POST /auth/mfa/enroll`). */
2775
+ declare const mfaEnrollResponseSchema: z.ZodObject<{
2776
+ secret: z.ZodString;
2777
+ otpauthUri: z.ZodString;
2778
+ }, "strip", z.ZodTypeAny, {
2779
+ secret: string;
2780
+ otpauthUri: string;
2781
+ }, {
2782
+ secret: string;
2783
+ otpauthUri: string;
2784
+ }>;
2785
+ /** A 6-digit MFA code body (`POST /auth/mfa/confirm|disable`). */
2786
+ declare const mfaCodeSchema: z.ZodObject<{
2787
+ code: z.ZodString;
2788
+ }, "strip", z.ZodTypeAny, {
2789
+ code: string;
2790
+ }, {
2791
+ code: string;
2792
+ }>;
2793
+ /** Activation body (`POST /auth/activate`). */
2794
+ declare const activationSchema: z.ZodObject<{
2795
+ token: z.ZodString;
2796
+ }, "strip", z.ZodTypeAny, {
2797
+ token: string;
2798
+ }, {
2799
+ token: string;
2800
+ }>;
2801
+ /** Password-reset request body (`POST /auth/password-reset/request`). */
2802
+ declare const passwordResetRequestSchema: z.ZodObject<{
2803
+ email: z.ZodString;
2804
+ }, "strip", z.ZodTypeAny, {
2805
+ email: string;
2806
+ }, {
2807
+ email: string;
2808
+ }>;
2809
+ /** Password-reset confirm body (`POST /auth/password-reset/confirm`). */
2810
+ declare const passwordResetConfirmSchema: z.ZodObject<{
2811
+ token: z.ZodString;
2812
+ password: z.ZodString;
2813
+ }, "strip", z.ZodTypeAny, {
2814
+ password: string;
2815
+ token: string;
2816
+ }, {
2817
+ password: string;
2818
+ token: string;
2819
+ }>;
2774
2820
  type SignupInput = z.infer<typeof signupSchema>;
2775
2821
  type LoginInput = z.infer<typeof loginSchema>;
2776
2822
  type RefreshInput = z.infer<typeof refreshSchema>;
2777
2823
  type TokenPair = z.infer<typeof tokenPairSchema>;
2778
2824
  type UserPublic = z.infer<typeof userPublicSchema>;
2779
2825
  type AuthResponse = z.infer<typeof authResponseSchema>;
2826
+ type MfaCodeInput = z.infer<typeof mfaCodeSchema>;
2827
+ type ActivationInput = z.infer<typeof activationSchema>;
2828
+ type PasswordResetRequestInput = z.infer<typeof passwordResetRequestSchema>;
2829
+ type PasswordResetConfirmInput = z.infer<typeof passwordResetConfirmSchema>;
2780
2830
 
2781
2831
  /**
2782
2832
  * User authentication service, mirroring `auth.service.UserAuthService`.
@@ -2871,6 +2921,197 @@ declare class UserAuthService {
2871
2921
  refresh(refreshToken: string): Promise<AuthResponse>;
2872
2922
  }
2873
2923
 
2924
+ /**
2925
+ * TOTP MFA enrollment/verification, mirroring the FastAPI SDK MFA flow.
2926
+ *
2927
+ * Orchestrates {@link TOTPHelper} over a pluggable {@link MfaStore}: enroll
2928
+ * (generate + persist a secret, return the provisioning URI), confirm (verify a
2929
+ * code and flip MFA on), verify (login step) and disable.
2930
+ */
2931
+
2932
+ /** Persistence port for MFA secrets/state. */
2933
+ interface MfaStore {
2934
+ /** Persist a user's TOTP secret (pending until confirmed). */
2935
+ setSecret(userId: string, secret: string): Promise<void>;
2936
+ /** Read a user's TOTP secret, or `null`. */
2937
+ getSecret(userId: string): Promise<string | null>;
2938
+ /** Flip the MFA-enabled flag. */
2939
+ setEnabled(userId: string, enabled: boolean): Promise<void>;
2940
+ /** Whether MFA is enabled for the user. */
2941
+ isEnabled(userId: string): Promise<boolean>;
2942
+ }
2943
+ /** The result of starting enrollment. */
2944
+ interface MfaEnrollment {
2945
+ /** The base32 secret (persist server-side; also shown once for manual entry). */
2946
+ secret: string;
2947
+ /** The `otpauth://` URI to render as a QR code. */
2948
+ otpauthUri: string;
2949
+ }
2950
+ /** Options for {@link MfaService}. */
2951
+ interface MfaServiceOptions {
2952
+ /** The MFA persistence port. */
2953
+ store: MfaStore;
2954
+ /** The TOTP helper (issuer preconfigured). */
2955
+ totp: TOTPHelper;
2956
+ }
2957
+ declare class MfaService {
2958
+ private readonly store;
2959
+ private readonly totp;
2960
+ /**
2961
+ * @param options - Store and TOTP helper.
2962
+ */
2963
+ constructor(options: MfaServiceOptions);
2964
+ /**
2965
+ * Begin enrollment: generate and persist a secret, return the QR URI.
2966
+ *
2967
+ * @param userId - The enrolling user.
2968
+ * @param accountName - Label shown in the authenticator (usually the email).
2969
+ * @returns The secret and provisioning URI.
2970
+ */
2971
+ enroll(userId: string, accountName: string): Promise<MfaEnrollment>;
2972
+ /**
2973
+ * Confirm enrollment by verifying a code, enabling MFA on success.
2974
+ *
2975
+ * @param userId - The user.
2976
+ * @param code - The 6-digit code from the authenticator.
2977
+ * @throws {ValidationException} When no secret is pending or the code is wrong.
2978
+ */
2979
+ confirm(userId: string, code: string): Promise<void>;
2980
+ /**
2981
+ * Verify a code (login step). Returns `false` without throwing.
2982
+ *
2983
+ * @param userId - The user.
2984
+ * @param code - The submitted code.
2985
+ * @returns `true` when the code is valid.
2986
+ */
2987
+ verify(userId: string, code: string): Promise<boolean>;
2988
+ /**
2989
+ * Disable MFA after verifying a code.
2990
+ *
2991
+ * @param userId - The user.
2992
+ * @param code - The submitted code.
2993
+ * @throws {ValidationException} When the code is invalid.
2994
+ */
2995
+ disable(userId: string, code: string): Promise<void>;
2996
+ }
2997
+
2998
+ /**
2999
+ * Email-activation flow, mirroring the FastAPI SDK activation flow.
3000
+ *
3001
+ * Issues a single-use opaque token (only its SHA-256 hash is stored), emails
3002
+ * the plaintext to the user, and activates the account when the link is opened.
3003
+ */
3004
+ /** Persistence port for activation tokens. */
3005
+ interface ActivationStore {
3006
+ /** Persist a token hash + expiry (epoch ms) for a user. */
3007
+ saveActivationToken(userId: string, tokenHash: string, expiresAt: number): Promise<void>;
3008
+ /** Look up a token hash, returning the owner + expiry, or `null`. */
3009
+ findActivationToken(tokenHash: string): Promise<{
3010
+ userId: string;
3011
+ expiresAt: number;
3012
+ } | null>;
3013
+ /** Remove a token hash (single-use). */
3014
+ clearActivationToken(tokenHash: string): Promise<void>;
3015
+ /** Mark a user active. */
3016
+ activate(userId: string): Promise<void>;
3017
+ }
3018
+ /** Options for {@link ActivationService}. */
3019
+ interface ActivationServiceOptions {
3020
+ /** The activation persistence port. */
3021
+ store: ActivationStore;
3022
+ /** Token lifetime in seconds. Default 86400 (24h). */
3023
+ ttlSeconds?: number;
3024
+ }
3025
+ declare class ActivationService {
3026
+ private readonly store;
3027
+ private readonly ttlSeconds;
3028
+ /**
3029
+ * @param options - Store and token TTL.
3030
+ */
3031
+ constructor(options: ActivationServiceOptions);
3032
+ /**
3033
+ * Start activation: issue a token and persist its hash.
3034
+ *
3035
+ * @param userId - The user to activate.
3036
+ * @returns The one-time plaintext token (embed in the activation link).
3037
+ */
3038
+ start(userId: string): Promise<string>;
3039
+ /**
3040
+ * Activate an account from a token.
3041
+ *
3042
+ * @param token - The plaintext token from the activation link.
3043
+ * @returns The activated user id.
3044
+ * @throws {InvalidTokenException} When the token is unknown or expired.
3045
+ */
3046
+ activate(token: string): Promise<string>;
3047
+ }
3048
+
3049
+ /**
3050
+ * Password-reset flow, mirroring the FastAPI SDK reset flow.
3051
+ *
3052
+ * `request` issues a single-use opaque token (hash stored) for a known email,
3053
+ * returning it so the caller can email the reset link — without leaking whether
3054
+ * the email exists. `confirm` validates the token + new password and rehashes.
3055
+ */
3056
+
3057
+ /** Persistence port for password resets. */
3058
+ interface PasswordResetStore {
3059
+ /** Resolve a (lowercased) email to a user id, or `null`. */
3060
+ findUserIdByEmail(email: string): Promise<string | null>;
3061
+ /** Persist a reset token hash + expiry (epoch ms). */
3062
+ saveResetToken(userId: string, tokenHash: string, expiresAt: number): Promise<void>;
3063
+ /** Look up a reset token hash, returning owner + expiry, or `null`. */
3064
+ findResetToken(tokenHash: string): Promise<{
3065
+ userId: string;
3066
+ expiresAt: number;
3067
+ } | null>;
3068
+ /** Remove a reset token hash (single-use). */
3069
+ clearResetToken(tokenHash: string): Promise<void>;
3070
+ /** Overwrite a user's password hash. */
3071
+ updatePassword(userId: string, passwordHash: string): Promise<void>;
3072
+ }
3073
+ /** Options for {@link PasswordResetService}. */
3074
+ interface PasswordResetServiceOptions {
3075
+ /** The reset persistence port. */
3076
+ store: PasswordResetStore;
3077
+ /** Password hasher. */
3078
+ password: PasswordUtils;
3079
+ /** Token lifetime in seconds. Default 3600 (1h). */
3080
+ ttlSeconds?: number;
3081
+ /** Minimum new-password length. Default 12. */
3082
+ passwordMinLength?: number;
3083
+ }
3084
+ declare class PasswordResetService {
3085
+ private readonly store;
3086
+ private readonly password;
3087
+ private readonly ttlSeconds;
3088
+ private readonly passwordMinLength;
3089
+ /**
3090
+ * @param options - Store, password hasher and policy.
3091
+ */
3092
+ constructor(options: PasswordResetServiceOptions);
3093
+ /**
3094
+ * Request a reset for `email`.
3095
+ *
3096
+ * Returns the plaintext token only when the email maps to a user; otherwise
3097
+ * `null`. Callers should respond with the same success shape either way to
3098
+ * avoid user enumeration — email the token only when present.
3099
+ *
3100
+ * @param email - The account email.
3101
+ * @returns The one-time token, or `null` when no user matches.
3102
+ */
3103
+ request(email: string): Promise<string | null>;
3104
+ /**
3105
+ * Confirm a reset: validate the token + new password and rehash.
3106
+ *
3107
+ * @param token - The plaintext reset token.
3108
+ * @param newPassword - The new plaintext password.
3109
+ * @throws {ValidationException} When the new password is too short.
3110
+ * @throws {InvalidTokenException} When the token is unknown or expired.
3111
+ */
3112
+ confirm(token: string, newPassword: string): Promise<void>;
3113
+ }
3114
+
2874
3115
  /**
2875
3116
  * JWT auth middleware + role guards, mirroring `api.dependencies.auth`.
2876
3117
  *
@@ -2978,6 +3219,15 @@ interface AuthRouterOptions {
2978
3219
  prefix?: string;
2979
3220
  /** When provided, OpenAPI paths are registered for Swagger/Redoc. */
2980
3221
  registry?: OpenAPIRegistry;
3222
+ /** Mount `POST /auth/activate` when provided. */
3223
+ activation?: ActivationService;
3224
+ /** Mount `POST /auth/password-reset/{request,confirm}` when provided. */
3225
+ passwordReset?: PasswordResetService;
3226
+ /**
3227
+ * Mount guarded `POST /auth/mfa/{enroll,confirm,disable}` when provided. The
3228
+ * enrolling account label defaults to the `email` claim (falls back to `sub`).
3229
+ */
3230
+ mfa?: MfaService;
2981
3231
  }
2982
3232
  /**
2983
3233
  * Build the auth router.
@@ -3219,6 +3469,6 @@ interface RunServerOptions {
3219
3469
  declare function runServer(app: Express, options?: RunServerOptions): Promise<Server>;
3220
3470
 
3221
3471
  /** The installed SDK version. Single source of truth for the barrel + CLI. */
3222
- declare const VERSION = "0.6.0";
3472
+ declare const VERSION = "0.7.0";
3223
3473
 
3224
- export { type AdminField, type AdminListQuery, type AdminListResult, type AdminResource, type AdminRouterOptions, AdminSite, AppException, type AppExceptionHandlerOptions, type AppExceptionOptions, type AttachWebSocketOptions, AttemptThrottle, type AttemptThrottleOptions, type AuthResponse, type AuthRouterOptions, type AuthUser, type BaseAppSettings, BaseController, BaseModel, type BaseResponse, BaseService, type BrokerManager, CEP_PATTERN, CNPJ_PATTERN, CPF_PATTERN, type CPUMetrics, type CacheManager, type CachedOptions, type CatalogData, CircuitOpenError, type ClientIpOptions, CompositeFeatureFlagBackend, ConflictException, type CreateAppOpenApi, type CreateAppOptions, type CursorPaginationFilter, DEFAULT_LOCALE, type EmailMessage, type EmailOptions, EmailUtils, type Enum, type EnumHelpers, type EnumSpec, EnvFeatureFlagBackend, EventStream, type EventStreamOptions, type ExceptionDetails, ExpiredTokenException, type FeatureFlagBackend, FeatureFlags, type FlagContext, ForbiddenException, type GenerateOpenApiOptions, HTTPClient, type HTTPClientOptions, HTTP_500_MARKER, type HandshakeInfo, type HealthCheck, type HealthRouterOptions, type InboundHandler, type InboundMessage, InvalidTokenException, type IssuedSession, JSONLogger, JWTUtils, type JWTUtilsOptions, type JwtAuthOptions, type JwtClaims, LocalUploadStorage, type LocalUploadStorageOptions, type LogExtra, type LogLevel, type LoginInput, type MediaKind, MemoryBroker, MemoryCacheManager, MemoryFeatureFlagBackend, type MemoryMetrics, MemorySessionStore, MemoryThrottleBackend, MessageCatalog, type MessageHandler, type MessagingProvider, MetricsUtils, NotFoundException, type OpenApiDocument, type OpenApiInfo, type OutboundMedia, type OutboundResult, PHONE_BR_PATTERN, type PaginationFilter, PasswordUtils, REQUEST_ID_HEADER, RabbitBroker, type RabbitBrokerOptions, RedisCacheManager, type RedisLike, type RedocOptions, type RefreshInput, Region, type RegionValue, type RegisterExceptionHandlersOptions, type RequestContext, type ResponseMapper, RetryPolicy, type RunServerOptions, SSEBroker, type SaveOptions, type SendOptions, ServerSentEvent, type ServerSentEventInit, type Session, type SessionMiddlewareOptions, SessionService, type SessionServiceOptions, type SessionStore, type SignupInput, type StateBR, type SwaggerOptions, type SystemMetrics, TOTPHelper, type TOTPOptions, type TaskHandler, TaskManager, type TaskManagerOptions, TelegramProvider, type TelegramProviderOptions, type ThrottleBackend, type ThrottleStatus, type ToDictOptions, type TokenPair, TooManyRequestsException, type TooManyRequestsOptions, TwilioSmsProvider, type TwilioSmsProviderOptions, type TwilioWebhookOptions, UF, type UFValue, UnauthorizedException, type UnhandledExceptionHandlerOptions, type UploadResult, type UploadStorage, UserAuthService, type UserAuthServiceOptions, type UserPublic, type UserStore, VERSION, ValidationException, type WSEnvelope, WebPushDispatcher, type WebPushDispatcherOptions, WebPushError, WebPushGoneError, type WebPushKeys, type WebPushPayload, type WebPushSubscription, type WebSocketConnection, WebSocketHub, type WebSocketHubOptions, type WebSocketLike, WhatsAppProvider, type WhatsAppProviderOptions, type WhatsAppWebhookOptions, attachWebSocketHub, authResponseSchema, baseAppSettingsSchema, baseAppSettingsShape, baseResponseSchema, bearerToken, buildContentDisposition, cached, cepField, citiesByUf, cnpjField, coerceFlag, configureLogging, corsSettingsShape, cpfField, cpfOrCnpjField, createApp, createOpenApiRegistry, createdByColumn, cursorPaginationFilterSchema, cursorPaginationSchema, databaseSettingsShape, decodeCursor, defaultMessageCatalog, defineEnum, deletedAtColumn, encodeCursor, generateOpaqueToken, generateOpenApiDocument, getAuth, getClientIp, getConditions, getPaginationConditions, getRequestId, getState, hashOpaqueToken, inboundMessageSchema, isValidCep, isValidCity, isValidCnpj, isValidCpf, isValidCpfCnpj, isValidPhoneBr, isValidUf, listStates, loadSettings, loginSchema, makeAdminRouter, makeAppExceptionHandler, makeAuthRouter, makeFlagGuard, makeHealthRouter, makeJwtAuthMiddleware, makeSessionMiddleware, makeTwilioWebhookRouter, makeUnhandledExceptionHandler, makeWhatsAppWebhookRouter, modifyDict, mountOpenApiJson, mountRedoc, mountSwaggerUi, normalizeCep, normalizeCnpj, normalizeCpf, normalizeCpfCnpj, normalizePhoneBr, normalizeUf, notFoundHandler, onlyDigits, paginationFilterSchema, paginationSchema, parseAcceptLanguage, parseCookies, phoneBrField, refreshSchema, registerExceptionHandlers, requestIdMiddleware, requireRoles, runServer, runWithRequestContext, serverSettingsShape, sessionCookie, setRequestId, signupSchema, sseResponse, statesByRegion, tableNameFor, toDict, toUtc, tokenFromUrl, tokenPairSchema, ufField, updatedByColumn, userPublicSchema, utcnow, validateTwilioSignature, verifyOpaqueToken, webPushKeysSchema, webPushPayloadSchema, webPushSubscriptionSchema, wsEnvelopeSchema };
3474
+ export { type ActivationInput, ActivationService, type ActivationServiceOptions, type ActivationStore, type AdminField, type AdminListQuery, type AdminListResult, type AdminResource, type AdminRouterOptions, AdminSite, AppException, type AppExceptionHandlerOptions, type AppExceptionOptions, type AttachWebSocketOptions, AttemptThrottle, type AttemptThrottleOptions, type AuthResponse, type AuthRouterOptions, type AuthUser, type BaseAppSettings, BaseController, BaseModel, type BaseResponse, BaseService, type BrokerManager, CEP_PATTERN, CNPJ_PATTERN, CPF_PATTERN, type CPUMetrics, type CacheManager, type CachedOptions, type CatalogData, CircuitOpenError, type ClientIpOptions, CompositeFeatureFlagBackend, ConflictException, type CreateAppOpenApi, type CreateAppOptions, type CursorPaginationFilter, DEFAULT_LOCALE, type EmailMessage, type EmailOptions, EmailUtils, type Enum, type EnumHelpers, type EnumSpec, EnvFeatureFlagBackend, EventStream, type EventStreamOptions, type ExceptionDetails, ExpiredTokenException, type FeatureFlagBackend, FeatureFlags, type FlagContext, ForbiddenException, type GenerateOpenApiOptions, HTTPClient, type HTTPClientOptions, HTTP_500_MARKER, type HandshakeInfo, type HealthCheck, type HealthRouterOptions, type InboundHandler, type InboundMessage, InvalidTokenException, type IssuedSession, JSONLogger, JWTUtils, type JWTUtilsOptions, type JwtAuthOptions, type JwtClaims, LocalUploadStorage, type LocalUploadStorageOptions, type LogExtra, type LogLevel, type LoginInput, type MediaKind, MemoryBroker, MemoryCacheManager, MemoryFeatureFlagBackend, type MemoryMetrics, MemorySessionStore, MemoryThrottleBackend, MessageCatalog, type MessageHandler, type MessagingProvider, MetricsUtils, type MfaCodeInput, type MfaEnrollment, MfaService, type MfaServiceOptions, type MfaStore, NotFoundException, type OpenApiDocument, type OpenApiInfo, type OutboundMedia, type OutboundResult, PHONE_BR_PATTERN, type PaginationFilter, type PasswordResetConfirmInput, type PasswordResetRequestInput, PasswordResetService, type PasswordResetServiceOptions, type PasswordResetStore, PasswordUtils, REQUEST_ID_HEADER, RabbitBroker, type RabbitBrokerOptions, RedisCacheManager, type RedisLike, type RedocOptions, type RefreshInput, Region, type RegionValue, type RegisterExceptionHandlersOptions, type RequestContext, type ResponseMapper, RetryPolicy, type RunServerOptions, SSEBroker, type SaveOptions, type SendOptions, ServerSentEvent, type ServerSentEventInit, type Session, type SessionMiddlewareOptions, SessionService, type SessionServiceOptions, type SessionStore, type SignupInput, type StateBR, type SwaggerOptions, type SystemMetrics, TOTPHelper, type TOTPOptions, type TaskHandler, TaskManager, type TaskManagerOptions, TelegramProvider, type TelegramProviderOptions, type ThrottleBackend, type ThrottleStatus, type ToDictOptions, type TokenPair, TooManyRequestsException, type TooManyRequestsOptions, TwilioSmsProvider, type TwilioSmsProviderOptions, type TwilioWebhookOptions, UF, type UFValue, UnauthorizedException, type UnhandledExceptionHandlerOptions, type UploadResult, type UploadStorage, UserAuthService, type UserAuthServiceOptions, type UserPublic, type UserStore, VERSION, ValidationException, type WSEnvelope, WebPushDispatcher, type WebPushDispatcherOptions, WebPushError, WebPushGoneError, type WebPushKeys, type WebPushPayload, type WebPushSubscription, type WebSocketConnection, WebSocketHub, type WebSocketHubOptions, type WebSocketLike, WhatsAppProvider, type WhatsAppProviderOptions, type WhatsAppWebhookOptions, activationSchema, attachWebSocketHub, authResponseSchema, baseAppSettingsSchema, baseAppSettingsShape, baseResponseSchema, bearerToken, buildContentDisposition, cached, cepField, citiesByUf, cnpjField, coerceFlag, configureLogging, corsSettingsShape, cpfField, cpfOrCnpjField, createApp, createOpenApiRegistry, createdByColumn, cursorPaginationFilterSchema, cursorPaginationSchema, databaseSettingsShape, decodeCursor, defaultMessageCatalog, defineEnum, deletedAtColumn, encodeCursor, generateOpaqueToken, generateOpenApiDocument, getAuth, getClientIp, getConditions, getPaginationConditions, getRequestId, getState, hashOpaqueToken, inboundMessageSchema, isValidCep, isValidCity, isValidCnpj, isValidCpf, isValidCpfCnpj, isValidPhoneBr, isValidUf, listStates, loadSettings, loginSchema, makeAdminRouter, makeAppExceptionHandler, makeAuthRouter, makeFlagGuard, makeHealthRouter, makeJwtAuthMiddleware, makeSessionMiddleware, makeTwilioWebhookRouter, makeUnhandledExceptionHandler, makeWhatsAppWebhookRouter, mfaCodeSchema, mfaEnrollResponseSchema, modifyDict, mountOpenApiJson, mountRedoc, mountSwaggerUi, normalizeCep, normalizeCnpj, normalizeCpf, normalizeCpfCnpj, normalizePhoneBr, normalizeUf, notFoundHandler, onlyDigits, paginationFilterSchema, paginationSchema, parseAcceptLanguage, parseCookies, passwordResetConfirmSchema, passwordResetRequestSchema, phoneBrField, refreshSchema, registerExceptionHandlers, requestIdMiddleware, requireRoles, runServer, runWithRequestContext, serverSettingsShape, sessionCookie, setRequestId, signupSchema, sseResponse, statesByRegion, tableNameFor, toDict, toUtc, tokenFromUrl, tokenPairSchema, ufField, updatedByColumn, userPublicSchema, utcnow, validateTwilioSignature, verifyOpaqueToken, webPushKeysSchema, webPushPayloadSchema, webPushSubscriptionSchema, wsEnvelopeSchema };