@mercury-labs/auth
Version:
Mercury framework auth library. It supports local auth, jwt with both bearer token and cookie, basic auth.
30 lines (29 loc) • 962 B
TypeScript
import { JwtSignOptions } from '@nestjs/jwt';
import { ICookieSerializeOptions } from '../helpers';
import { AuthTransferTokenMethod } from './auth-transfer-token-method.enum';
export interface IAuthDefinitions {
basicAuth: {
username: string;
password: string;
realm?: string;
};
jwt: {
secret: string;
signOptions?: Omit<JwtSignOptions, 'expiresIn'>;
expiresIn: string | number;
refreshTokenExpiresIn: string | number;
};
impersonate?: {
isEnabled: boolean;
cipher: string;
password: string;
};
redactedFields?: string[];
ignoredRoutes?: string[];
hashingSecretKey: string;
transferTokenMethod: AuthTransferTokenMethod;
cookieOptions?: Pick<ICookieSerializeOptions, 'domain' | 'path' | 'sameSite' | 'signed' | 'httpOnly' | 'secure'>;
usernameField?: string;
passwordField?: string;
httpAdaptorType: 'fastify' | 'express';
}