feat: started with proper E2EE ;)

This commit is contained in:
Ruben Talstra 2025-02-15 21:26:40 +01:00
parent e3b5c59949
commit 18d019d8b3
No known key found for this signature in database
GPG key ID: 2A5A7174A60F3BEA
13 changed files with 380 additions and 1 deletions

View file

@ -237,3 +237,5 @@ export const addTagToConversation = (conversationId: string) =>
export const userTerms = () => '/api/user/terms';
export const acceptUserTerms = () => '/api/user/terms/accept';
export const banner = () => '/api/banner';
export const encryption = () => '/api/user/encryption';

View file

@ -774,3 +774,9 @@ export function acceptTerms(): Promise<t.TAcceptTermsResponse> {
export function getBanner(): Promise<t.TBannerResponse> {
return request.get(endpoints.banner());
}
export const updateUserEncryption = (
payload: t.UpdateUserEncryptionRequest,
): Promise<t.UpdateUserEncryptionResponse> => {
return request.put(endpoints.encryption(), payload);
};

View file

@ -67,4 +67,5 @@ export enum MutationKeys {
deleteAgentAction = 'deleteAgentAction',
deleteUser = 'deleteUser',
updateRole = 'updateRole',
updateUserEncryption = 'updateUserEncryption',
}

View file

@ -111,6 +111,10 @@ export type TUser = {
plugins?: string[];
createdAt: string;
updatedAt: string;
encryptionPublicKey?: string;
encryptedPrivateKey?: string; // Encrypted as a Base64 string
encryptionSalt?: string; // Base64 encoded salt used for PBKDF2
encryptionIV?: string; // Base64 encoded IV for AES-GCM
};
export type TGetConversationsResponse = {
@ -473,3 +477,21 @@ export type TAcceptTermsResponse = {
};
export type TBannerResponse = TBanner | null;
/**
* Request type for updating user encryption keys.
*/
export type UpdateUserEncryptionRequest = {
encryptionPublicKey: string;
encryptedPrivateKey: string;
encryptionSalt: string;
encryptionIV: string;
};
/**
* Response type for updating user encryption keys.
*/
export type UpdateUserEncryptionResponse = {
success: boolean;
message?: string;
};