fix: mask differences in auth duration (#946)

This commit is contained in:
Jeremy 2025-04-21 10:26:58 -07:00 committed by GitHub
parent 6e16f3b30a
commit 4ca93aaf89
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 40 additions and 14 deletions

View file

@ -1,3 +1,5 @@
import { generateDummyPassword } from './utils';
export const isProductionEnvironment = process.env.NODE_ENV === 'production';
export const isTestEnvironment = Boolean(
@ -5,3 +7,5 @@ export const isTestEnvironment = Boolean(
process.env.PLAYWRIGHT ||
process.env.CI_PLAYWRIGHT,
);
export const DUMMY_PASSWORD = generateDummyPassword();

View file

@ -1,16 +1,15 @@
import type {
CoreAssistantMessage,
CoreToolMessage,
Message,
TextStreamPart,
ToolInvocation,
ToolSet,
UIMessage,
import {
generateId,
type CoreAssistantMessage,
type CoreToolMessage,
type Message,
type UIMessage,
} from 'ai';
import { type ClassValue, clsx } from 'clsx';
import { twMerge } from 'tailwind-merge';
import type { DBMessage, Document } from '@/lib/db/schema';
import type { Document } from '@/lib/db/schema';
import { genSaltSync, hashSync } from 'bcrypt-ts';
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
@ -163,3 +162,12 @@ export function getTrailingMessageId({
return trailingMessage.id;
}
export function generateDummyPassword() {
const password = generateId(12);
const salt = genSaltSync(10);
const hash = hashSync(password, salt);
return hash;
}