Files
ChatApp/packages/shared/src/chat/index.ts
T
byGalax 75618637e2
Release desktop app / build (, windows-latest) (push) Has been cancelled
Release desktop app / build (--target universal-apple-darwin --bundles app,updater, macos-14) (push) Has been cancelled
feat(crypto): sender-key per-conversation multi-device E2EE
2026-04-19 19:27:24 +02:00

29 lines
879 B
TypeScript

import type { AppSupabaseClient } from '../supabase/client.js';
export * from './attachments.js';
export * from './conversations.js';
export * from './convKeys.js';
export * from './groups.js';
export * from './messages.js';
export * from './types.js';
// ----- RPC wrappers ---------------------------------------------------------
export async function createDm(
client: AppSupabaseClient,
targetUserId: string,
): Promise<string> {
const { data, error } = await client.rpc('create_dm', { target_user_id: targetUserId });
if (error) throw error;
if (typeof data !== 'string') throw new Error('create_dm returned non-uuid');
return data;
}
export async function acceptDm(
client: AppSupabaseClient,
conversationId: string,
): Promise<void> {
const { error } = await client.rpc('accept_dm', { conversation_id: conversationId });
if (error) throw error;
}