The root @veap/auth export includes actions such as signIn, signUp, finalizeLogin, and signOut. The implementation wraps service calls in the kernel's Result helpers and maps thrown errors through handleActionError.
Sign in#
"use server";
import { signIn } from "@veap/auth";
import type { LoginInput } from "@veap/auth/validation";
export async function loginAction(input: LoginInput) {
// Validate and normalize untrusted input before calling the action.
return signIn(input);
}The LoginInput type is exported from the validation entry point. Follow its actual schema for required fields; do not assume a particular set of fields beyond the declaration.
Sign up#
"use server";
import { signUp } from "@veap/auth";
import type { RegisterInput } from "@veap/auth/validation";
export async function registerAction(input: RegisterInput) {
return signUp(input);
}Sign out#
"use server";
import { signOut } from "@veap/auth";
export async function logoutAction() {
return signOut();
}Handle result values safely#
These functions return typed results. Use the installed Result declaration to branch on success and failure. Convert failures to safe UI messages; never display internal exception text, tokens, or sensitive metadata to a user.
Important boundary#
A Server Action is still a public server endpoint. Validate inputs, enforce authorization for the requested operation, and use CSRF/session protections appropriate to your Next.js deployment. Do not call finalizeLogin from arbitrary untrusted input; it is a lower-level action that takes a user ID and session flags and should only be used by trusted server-side flow logic.