This commit is contained in:
2026-04-18 23:11:35 +02:00
commit f7cfd2a86e
196 changed files with 35538 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
import { base64FromBytes, bytesFromBase64, type SecretStore } from '@chat-app/shared/auth';
// M1 dev-only impl: persists secrets as base64 in localStorage.
// Swap this out for a tauri-plugin-stronghold implementation before release.
// The SecretStore interface stays identical so callers won't notice.
const PREFIX = 'chatapp.secret:';
export const devLocalSecretStore: SecretStore = {
async getSecret(key: string): Promise<Uint8Array | null> {
const raw = window.localStorage.getItem(PREFIX + key);
if (!raw) return null;
return bytesFromBase64(raw);
},
async setSecret(key: string, value: Uint8Array): Promise<void> {
const encoded = await base64FromBytes(value);
window.localStorage.setItem(PREFIX + key, encoded);
},
async removeSecret(key: string): Promise<void> {
window.localStorage.removeItem(PREFIX + key);
},
};