feat: Implement end-to-end encrypted chat with new API routes, crypto utilities, and UI components.

This commit is contained in:
Christopher
2026-01-27 17:59:08 -08:00
parent 5903022f8a
commit 9ee0cbbb9a
20 changed files with 1715 additions and 1525 deletions
+13 -1
View File
@@ -13,7 +13,8 @@ import {
generateKeyPair,
exportPrivateKey,
exportPublicKey,
base64UrlToBase64
base64UrlToBase64,
createSignedAction
} from '@/lib/crypto/user-signing';
export interface UserIdentity {
@@ -117,6 +118,16 @@ export function useUserIdentity() {
setIsUnlocked(false);
};
/**
* Sign a user action
*/
const signUserAction = async (action: string, data: any) => {
if (!identity || !isUnlocked) {
throw new Error('Identity locked');
}
return await createSignedAction(action, data, identity.did, identity.handle);
};
return {
identity,
isUnlocked,
@@ -124,5 +135,6 @@ export function useUserIdentity() {
unlockIdentity,
lockIdentity,
clearIdentity,
signUserAction
};
}