Refactor chat encryption to use sodium, update API
Replaces legacy chat encryption modules with new sodium-based implementation. Adds and updates API routes for chat key management and debugging, introduces new hooks and scripts for sodium chat, and updates related database schema and configuration. Removes old crypto modules and updates dependencies accordingly.
This commit is contained in:
@@ -27,6 +27,7 @@ class InMemoryKeyStore implements KeyStore {
|
||||
private static instance: InMemoryKeyStore;
|
||||
private privateKey: CryptoKey | null = null;
|
||||
private identity: { did: string; handle: string; publicKey: string } | null = null;
|
||||
private storageKey: Uint8Array | null = null; // For encrypting chat keys
|
||||
|
||||
private constructor() { }
|
||||
|
||||
@@ -56,9 +57,18 @@ class InMemoryKeyStore implements KeyStore {
|
||||
return this.identity;
|
||||
}
|
||||
|
||||
setStorageKey(key: Uint8Array): void {
|
||||
this.storageKey = key;
|
||||
}
|
||||
|
||||
getStorageKey(): Uint8Array | null {
|
||||
return this.storageKey;
|
||||
}
|
||||
|
||||
clear(): void {
|
||||
this.privateKey = null;
|
||||
this.identity = null;
|
||||
this.storageKey = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user