mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-02-15 23:18:09 +01:00
Merge branch 'main' into feat/webauthn
This commit is contained in:
commit
8173f5fca1
132 changed files with 5513 additions and 769 deletions
|
|
@ -237,3 +237,11 @@ export const addTagToConversation = (conversationId: string) =>
|
|||
export const userTerms = () => '/api/user/terms';
|
||||
export const acceptUserTerms = () => '/api/user/terms/accept';
|
||||
export const banner = () => '/api/banner';
|
||||
|
||||
// Two-Factor Endpoints
|
||||
export const enableTwoFactor = () => '/api/auth/2fa/enable';
|
||||
export const verifyTwoFactor = () => '/api/auth/2fa/verify';
|
||||
export const confirmTwoFactor = () => '/api/auth/2fa/confirm';
|
||||
export const disableTwoFactor = () => '/api/auth/2fa/disable';
|
||||
export const regenerateBackupCodes = () => '/api/auth/2fa/backup/regenerate';
|
||||
export const verifyTwoFactorTemp = () => '/api/auth/2fa/verify-temp';
|
||||
|
|
@ -621,6 +621,7 @@ export const alternateName = {
|
|||
[EModelEndpoint.custom]: 'Custom',
|
||||
[EModelEndpoint.bedrock]: 'AWS Bedrock',
|
||||
[KnownEndpoints.ollama]: 'Ollama',
|
||||
[KnownEndpoints.deepseek]: 'DeepSeek',
|
||||
[KnownEndpoints.xai]: 'xAI',
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -774,3 +774,33 @@ export function acceptTerms(): Promise<t.TAcceptTermsResponse> {
|
|||
export function getBanner(): Promise<t.TBannerResponse> {
|
||||
return request.get(endpoints.banner());
|
||||
}
|
||||
|
||||
export function enableTwoFactor(): Promise<t.TEnable2FAResponse> {
|
||||
return request.get(endpoints.enableTwoFactor());
|
||||
}
|
||||
|
||||
export function verifyTwoFactor(
|
||||
payload: t.TVerify2FARequest,
|
||||
): Promise<t.TVerify2FAResponse> {
|
||||
return request.post(endpoints.verifyTwoFactor(), payload);
|
||||
}
|
||||
|
||||
export function confirmTwoFactor(
|
||||
payload: t.TVerify2FARequest,
|
||||
): Promise<t.TVerify2FAResponse> {
|
||||
return request.post(endpoints.confirmTwoFactor(), payload);
|
||||
}
|
||||
|
||||
export function disableTwoFactor(): Promise<t.TDisable2FAResponse> {
|
||||
return request.post(endpoints.disableTwoFactor());
|
||||
}
|
||||
|
||||
export function regenerateBackupCodes(): Promise<t.TRegenerateBackupCodesResponse> {
|
||||
return request.post(endpoints.regenerateBackupCodes());
|
||||
}
|
||||
|
||||
export function verifyTwoFactorTemp(
|
||||
payload: t.TVerify2FATempRequest,
|
||||
): Promise<t.TVerify2FATempResponse> {
|
||||
return request.post(endpoints.verifyTwoFactorTemp(), payload);
|
||||
}
|
||||
|
|
@ -149,6 +149,9 @@ export const codeTypeMapping: { [key: string]: string } = {
|
|||
ts: 'application/typescript',
|
||||
tar: 'application/x-tar',
|
||||
zip: 'application/zip',
|
||||
yml: 'application/x-yaml',
|
||||
yaml: 'application/x-yaml',
|
||||
log: 'text/plain',
|
||||
};
|
||||
|
||||
export const retrievalMimeTypes = [
|
||||
|
|
|
|||
|
|
@ -67,4 +67,6 @@ export enum MutationKeys {
|
|||
deleteAgentAction = 'deleteAgentAction',
|
||||
deleteUser = 'deleteUser',
|
||||
updateRole = 'updateRole',
|
||||
enableTwoFactor = 'enableTwoFactor',
|
||||
verifyTwoFactor = 'verifyTwoFactor',
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,6 +91,9 @@ axios.interceptors.response.use(
|
|||
return Promise.reject(error);
|
||||
}
|
||||
|
||||
if (originalRequest.url?.includes('/api/auth/2fa') === true) {
|
||||
return Promise.reject(error);
|
||||
}
|
||||
if (originalRequest.url?.includes('/api/auth/logout') === true) {
|
||||
return Promise.reject(error);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ export type TUpdateUserPlugins = {
|
|||
auth?: unknown;
|
||||
};
|
||||
|
||||
// TODO `label` needs to be changed to the proper `TranslationKeys`
|
||||
export type TCategory = {
|
||||
id?: string;
|
||||
value: string;
|
||||
|
|
@ -104,6 +105,12 @@ export type TPasskey = {
|
|||
publicKey: Buffer;
|
||||
counter: number;
|
||||
transports: string[];
|
||||
};
|
||||
|
||||
export type TBackupCode = {
|
||||
codeHash: string;
|
||||
used: boolean;
|
||||
usedAt: Date | null;
|
||||
};
|
||||
|
||||
export type TUser = {
|
||||
|
|
@ -116,6 +123,7 @@ export type TUser = {
|
|||
provider: string;
|
||||
plugins?: string[];
|
||||
passkeys?: TPasskey[];
|
||||
backupCodes?: TBackupCode[];
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
};
|
||||
|
|
@ -292,11 +300,61 @@ export type TRegisterUser = {
|
|||
export type TLoginUser = {
|
||||
email: string;
|
||||
password: string;
|
||||
token?: string;
|
||||
backupCode?: string;
|
||||
};
|
||||
|
||||
export type TLoginResponse = {
|
||||
token: string;
|
||||
user: TUser;
|
||||
token?: string;
|
||||
user?: TUser;
|
||||
twoFAPending?: boolean;
|
||||
tempToken?: string;
|
||||
};
|
||||
|
||||
export type TEnable2FAResponse = {
|
||||
otpauthUrl: string;
|
||||
backupCodes: string[];
|
||||
message?: string;
|
||||
};
|
||||
|
||||
export type TVerify2FARequest = {
|
||||
token?: string;
|
||||
backupCode?: string;
|
||||
};
|
||||
|
||||
export type TVerify2FAResponse = {
|
||||
message: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* For verifying 2FA during login with a temporary token.
|
||||
*/
|
||||
export type TVerify2FATempRequest = {
|
||||
tempToken: string;
|
||||
token?: string;
|
||||
backupCode?: string;
|
||||
};
|
||||
|
||||
export type TVerify2FATempResponse = {
|
||||
token?: string;
|
||||
user?: TUser;
|
||||
message?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Response from disabling 2FA.
|
||||
*/
|
||||
export type TDisable2FAResponse = {
|
||||
message: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Response from regenerating backup codes.
|
||||
*/
|
||||
export type TRegenerateBackupCodesResponse = {
|
||||
message: string;
|
||||
backupCodes: string[];
|
||||
backupCodesHash: string[];
|
||||
};
|
||||
|
||||
export type TRequestPasswordReset = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue