Phase 1-3: Domain Layer Foundation - Add value objects: IdentityId, PermissionId, RelayId, WalletId, Nickname, NostrKeyPair - Add rich domain entities: Identity, Permission, Relay with behavior - Add domain events: IdentityCreated, IdentityRenamed, IdentitySelected, etc. - Add repository interfaces for Identity, Permission, Relay - Add infrastructure layer with repository implementations - Add EncryptionService abstraction Phase 4: Ubiquitous Language Cleanup - Rename BrowserSyncData → EncryptedVault (encrypted vault storage) - Rename BrowserSessionData → VaultSession (decrypted session state) - Rename SignerMetaData → ExtensionSettings (extension configuration) - Rename Identity_ENCRYPTED → StoredIdentity (storage DTO) - Rename Identity_DECRYPTED → IdentityData (session DTO) - Similar renames for Permission, Relay, NwcConnection, CashuMint - Add backwards compatibility aliases with @deprecated markers Test Coverage - Add comprehensive tests for all value objects - Add tests for domain entities and their behavior - Add tests for domain events - Fix PermissionChecker to prioritize kind-specific rules over blanket rules - Fix pre-existing component test issues (IconButton, Pubkey) All 113 tests pass. Both Chrome and Firefox builds succeed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
import { ExtensionSettings, SignerMetaHandler } from '@common';
|
|
import browser from 'webextension-polyfill';
|
|
|
|
export class FirefoxMetaHandler extends SignerMetaHandler {
|
|
async loadFullData(): Promise<Partial<Record<string, any>>> {
|
|
const dataWithPossibleAlienProperties = await browser.storage.local.get(
|
|
null
|
|
);
|
|
|
|
if (Object.keys(dataWithPossibleAlienProperties).length === 0) {
|
|
return dataWithPossibleAlienProperties;
|
|
}
|
|
|
|
const data: Partial<Record<string, any>> = {};
|
|
this.metaProperties.forEach((property) => {
|
|
data[property] = dataWithPossibleAlienProperties[property];
|
|
});
|
|
|
|
return data;
|
|
}
|
|
|
|
async saveFullData(data: ExtensionSettings): Promise<void> {
|
|
await browser.storage.local.set(data as Record<string, any>);
|
|
console.log(data);
|
|
}
|
|
|
|
async clearData(keep: string[]): Promise<void> {
|
|
const toBeRemovedProperties: string[] = [];
|
|
|
|
for (const property of this.metaProperties) {
|
|
if (!keep.includes(property)) {
|
|
toBeRemovedProperties.push(property);
|
|
}
|
|
}
|
|
|
|
await browser.storage.local.remove(this.metaProperties);
|
|
}
|
|
}
|