/** * This Source Code is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Copyright (c) Infonomic Company Limited */ import { z } from 'zod'; /** * Stable error codes emitted by `passwordSchema`. The schema yields * these as the Zod issue message rather than free-form English so * client callers can translate them at render time. Server-side * consumers that don't translate (the defensive request-shape * validation in admin command handlers) will see the code itself — * acceptable because the form-level validation catches the same * case first, so the server message is only surfaced when a * malformed payload reaches the API outside the normal flow. * * Adding a new code: extend the union and add a matching key in the * admin-side translator map (`@byline/admin/lib/translate-validation-error`). * The same map shape is the recommended pattern for future schemas in * this file — emit codes here, translate in `@byline/admin`. */ export declare const PASSWORD_ERROR_CODES: { readonly TOO_SHORT: 'password.tooShort'; readonly TOO_LONG: 'password.tooLong'; readonly COMPLEXITY: 'password.complexity'; }; /** * Standard password policy — 8 to 128 characters, must contain at least * one uppercase, one lowercase, one digit, and one character from the * set `#?!@$%^&*-`. The 128-char cap leaves room for passphrase-style * entries while still bounding argon2 input size (hashing a 1 MiB * password is a DoS vector). The regex runs after `.min` / `.max` so * the user sees length errors first and character-class errors only * once length is acceptable. */ export declare const passwordSchema: z.ZodString; /** * UUID with a descriptive error message. Equivalent to `z.uuid()` but * the message is caller-friendly for forms that surface field errors * directly. */ export declare const uuidSchema: z.ZodUUID; /** Login accepts existing passwords regardless of current enrollment complexity policy. */ export declare const passwordSignInSchema: z.ZodObject<{ email: z.ZodString; password: z.ZodString; }, z.core.$strip>;