wip: refactor
This commit is contained in:
@@ -3,7 +3,6 @@ import NDK from '@nostr-dev-kit/ndk';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
import TauriAdapter from '@libs/ndk/cache';
|
||||
import { getExplicitRelayUrls } from '@libs/storage';
|
||||
import { useStorage } from '@libs/storage/provider';
|
||||
|
||||
import { FULL_RELAYS } from '@stores/constants';
|
||||
@@ -56,7 +55,7 @@ export const NDKInstance = () => {
|
||||
|
||||
async function initNDK() {
|
||||
let explicitRelayUrls: string[];
|
||||
const explicitRelayUrlsFromDB = await getExplicitRelayUrls();
|
||||
const explicitRelayUrlsFromDB = await db.getExplicitRelayUrls();
|
||||
|
||||
if (explicitRelayUrlsFromDB) {
|
||||
explicitRelayUrls = await verifyRelays(explicitRelayUrlsFromDB);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Database from '@tauri-apps/plugin-sql';
|
||||
import destr from 'destr';
|
||||
import { destr } from 'destr';
|
||||
|
||||
import { parser } from '@utils/parser';
|
||||
import { getParentID } from '@utils/transform';
|
||||
|
||||
@@ -184,6 +184,12 @@ export class LumeStorage {
|
||||
);
|
||||
}
|
||||
|
||||
public async removePrivkey() {
|
||||
return await this.db.execute(
|
||||
`UPDATE accounts SET privkey = "privkey is stored in secure storage" WHERE id = "${this.account.id}";`
|
||||
);
|
||||
}
|
||||
|
||||
public async close() {
|
||||
return this.db.close();
|
||||
}
|
||||
|
||||
@@ -24,10 +24,6 @@ const StorageProvider = ({ children }: PropsWithChildren<object>) => {
|
||||
|
||||
useEffect(() => {
|
||||
if (!db) initLumeStorage();
|
||||
|
||||
return () => {
|
||||
db.close();
|
||||
};
|
||||
}, []);
|
||||
|
||||
if (db) {
|
||||
|
||||
Reference in New Issue
Block a user