Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

874 B
Raw Blame
import type { TwoFactorEnrollmentUpdate } from '@librechat/data-schemas';

export type PasswordResetUpdate = { password?: string; credentialsChangedAt?: Date | null } & Pick<
  TwoFactorEnrollmentUpdate,
  | 'pendingTotpSecret'
  | 'pendingBackupCodes'
  | 'twoFactorAcknowledgementNonceHash'
  | 'twoFactorFinalizationNonceHash'
>;

/**
 * Retire bearer credentials from the replaced password. Clearing the staged enrollment in this
 * same write prevents an old setup credential from promoting its secret after recovery.
 */
export function createPasswordResetUpdate(
  passwordHash: string,
  resetAt: Date = new Date(),
): PasswordResetUpdate {
  return {
    password: passwordHash,
    credentialsChangedAt: resetAt,
    pendingTotpSecret: null,
    pendingBackupCodes: [],
    twoFactorAcknowledgementNonceHash: null,
    twoFactorFinalizationNonceHash: null,
  };
}