Add remote key fetch proxy and improve chat reliability
Introduces an API route to proxy remote key bundle fetches, improving CORS handling for secure chat. Updates chat UI to handle error states and retries, enhances key/identity synchronization, and refactors message sending to support remote node domains. Also adds CORS preflight support to the .well-known chat route and improves in-memory key store management.
This commit is contained in:
@@ -18,12 +18,15 @@ import { v4 as uuidv4 } from 'uuid';
|
||||
export interface KeyStore {
|
||||
setPrivateKey(key: CryptoKey): void;
|
||||
getPrivateKey(): CryptoKey | null;
|
||||
setIdentity(data: { did: string; handle: string; publicKey: string }): void;
|
||||
getIdentity(): { did: string; handle: string; publicKey: string } | null;
|
||||
clear(): void;
|
||||
}
|
||||
|
||||
class InMemoryKeyStore implements KeyStore {
|
||||
private static instance: InMemoryKeyStore;
|
||||
private privateKey: CryptoKey | null = null;
|
||||
private identity: { did: string; handle: string; publicKey: string } | null = null;
|
||||
|
||||
private constructor() { }
|
||||
|
||||
@@ -45,8 +48,17 @@ class InMemoryKeyStore implements KeyStore {
|
||||
return this.privateKey;
|
||||
}
|
||||
|
||||
setIdentity(data: { did: string; handle: string; publicKey: string }): void {
|
||||
this.identity = data;
|
||||
}
|
||||
|
||||
getIdentity() {
|
||||
return this.identity;
|
||||
}
|
||||
|
||||
clear(): void {
|
||||
this.privateKey = null;
|
||||
this.identity = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user