18 lines
611 B
TypeScript
18 lines
611 B
TypeScript
import { z } from "zod";
|
|
|
|
import { userProfileSchema } from "../shared/entities";
|
|
|
|
export const authResponseSchema = z.object({
|
|
user: userProfileSchema,
|
|
tokens: z.object({
|
|
accessToken: z.string().min(1, "Access token is required"),
|
|
refreshToken: z.string().min(1, "Refresh token is required"),
|
|
expiresAt: z.string().min(1, "Access token expiry required"),
|
|
refreshExpiresAt: z.string().min(1, "Refresh token expiry required"),
|
|
tokenType: z.literal("Bearer"),
|
|
}),
|
|
});
|
|
|
|
export type AuthResponse = z.infer<typeof authResponseSchema>;
|
|
export type AuthTokensSchema = AuthResponse["tokens"];
|