import type { Request } from 'express'; import type { hooks } from '@balena/pinejs'; import { sbvrUtils } from '@balena/pinejs'; import type { ResolvedUserPayload } from './jwt-passport.js'; import type { User } from '../../balena-model.js'; import type { PickDeferred, Deferred } from '@balena/abstract-sql-to-typescript'; export declare const userHasPermission: (user: undefined | sbvrUtils.Actor, permission: string) => boolean; export type GetNewUserRoleFunction = (user: AnyObject) => string; declare let getNewUserRole: GetNewUserRoleFunction; export declare const setRegistrationRoleFunc: (registerFunc: GetNewUserRoleFunction) => void; export declare const getRegistrationRole: typeof getNewUserRole; export declare const comparePassword: (password: string, hash: string | null) => Promise; export declare const validatePassword: (password: string | undefined) => asserts password is string; export declare const setPassword: (user: Pick, newPassword: string, tx: Tx) => Promise; export declare const updatePasswordIfNeeded: (usernameOrEmail: string, newPassword: string, tx: Tx) => Promise; export declare const checkUserPassword: (password: string, userId: number, tx: Tx) => Promise; export declare const reqHasPermission: (req: Pick, permission: string) => boolean; export declare const userFields: ("id" | "actor" | "jwt_secret")[]; export declare function getUser(req: Request | hooks.HookReq, txParam: Tx | undefined, required?: true): Promise; export declare function getUser(req: Request | hooks.HookReq, txParam: Tx | undefined, required: false): Promise; export declare const defaultFindUser$select: ("id" | "actor" | "username" | "password")[]; export declare function findUser(loginInfo: string, tx: Tx): Promise | undefined>; export declare function findUser>(loginInfo: string, tx: Tx, $select: TProps): Promise | undefined>; export declare const registerUser: (userData: AnyObject & { username: string; email: string | null; password?: string; }, tx: Tx, req?: Request) => Promise<{ [P in keyof User["Read"]]: Deferred; }>; export {};