Remove Encrypted Storage

This commit is contained in:
KoalaSat 2022-10-31 00:39:14 +01:00
parent 302176ac3c
commit 7d266023e3
No known key found for this signature in database
GPG Key ID: 2F7F61C6146AB157
6 changed files with 13 additions and 17 deletions

View File

@ -10,7 +10,7 @@ import { StyleSheet } from 'react-native';
import { AppContext } from '../../Contexts/AppContext';
import Icon from 'react-native-vector-icons/FontAwesome5';
import { useTranslation } from 'react-i18next';
import EncryptedStorage from 'react-native-encrypted-storage';
// import EncryptedStorage from 'react-native-encrypted-storage';
import { dropTables } from '../../Functions/DatabaseFunctions';
import { RelayPoolContext } from '../../Contexts/RelayPoolContext';
@ -35,10 +35,10 @@ export const ConfigPage: React.FC = () => {
setPrivateKey(undefined);
setPublicKey(undefined);
dropTables(database).then(() => {
EncryptedStorage.removeItem('privateKey').then(() => {
// EncryptedStorage.removeItem('privateKey').then(() => {
init();
goToPage('landing', true);
});
// });
});
}
};

View File

@ -8,7 +8,7 @@ import Relay from '../../../lib/nostr/Relay';
import { Event, EventKind } from '../../../lib/nostr/Events';
import { AppContext } from '../../../Contexts/AppContext';
import { insertUserContact } from '../../../Functions/DatabaseFunctions/Users';
import EncryptedStorage from 'react-native-encrypted-storage';
// import EncryptedStorage from 'react-native-encrypted-storage';
export const Logger: React.FC = () => {
const { database, goToPage } = useContext(AppContext);
@ -97,7 +97,7 @@ export const Logger: React.FC = () => {
setLoading(true);
setPrivateKey(inputValue);
setStatus(1);
EncryptedStorage.setItem('privateKey', inputValue);
// EncryptedStorage.setItem('privateKey', inputValue);
}
};

View File

@ -3,7 +3,7 @@ import { SQLiteDatabase } from 'react-native-sqlite-storage';
import { initDatabase } from '../Functions/DatabaseFunctions';
import { createInitDatabase } from '../Functions/DatabaseFunctions/Migrations';
import FlashMessage from 'react-native-flash-message';
import EncryptedStorage from 'react-native-encrypted-storage';
// import EncryptedStorage from 'react-native-encrypted-storage';
export interface AppContextProps {
page: string;
@ -33,7 +33,8 @@ export const AppContextProvider = ({ children }: AppContextProviderProps): JSX.E
const [loadingDb, setLoadingDb] = useState<boolean>(initialAppContext.loadingDb);
const init: () => void = () => {
EncryptedStorage.getItem('privateKey').then((result) => {
const result = '';
// EncryptedStorage.getItem('privateKey').then((result) => {
const db = initDatabase();
setDatabase(db);
if (!result || result === '') {
@ -43,7 +44,7 @@ export const AppContextProvider = ({ children }: AppContextProviderProps): JSX.E
} else {
setLoadingDb(false);
}
});
// });
};
useEffect(init, []);

View File

@ -6,7 +6,7 @@ import { AppContext } from './AppContext';
import { storeEvent } from '../Functions/DatabaseFunctions/Events';
import { getRelays, Relay as RelayEntity, storeRelay } from '../Functions/DatabaseFunctions/Relays';
import { showMessage } from 'react-native-flash-message';
import EncryptedStorage from 'react-native-encrypted-storage';
// import EncryptedStorage from 'react-native-encrypted-storage';
import { getPublickey } from '../lib/nostr/Bip';
export interface RelayPoolContextProps {
@ -105,7 +105,8 @@ export const RelayPoolContextProvider = ({
}, [page]);
useEffect(() => {
EncryptedStorage.getItem('privateKey').then((result) => {
const result = ''
// EncryptedStorage.getItem('privateKey').then((result) => {
if (result && result !== '') {
loadRelayPool();
goToPage('home', true);
@ -114,7 +115,7 @@ export const RelayPoolContextProvider = ({
} else {
goToPage('landing', true);
}
});
// });
}, []);
return (

View File

@ -27,7 +27,6 @@
"react-native": "0.70.4",
"react-native-action-button": "^2.8.5",
"react-native-bidirectional-infinite-scroll": "^0.3.3",
"react-native-encrypted-storage": "^4.0.2",
"react-native-flash-message": "^0.3.1",
"react-native-markdown-display": "^7.0.0-alpha.2",
"react-native-sqlite-storage": "^6.0.1",

View File

@ -6311,11 +6311,6 @@ react-native-codegen@^0.70.6:
jscodeshift "^0.13.1"
nullthrows "^1.1.1"
react-native-encrypted-storage@^4.0.2:
version "4.0.2"
resolved "https://registry.yarnpkg.com/react-native-encrypted-storage/-/react-native-encrypted-storage-4.0.2.tgz#c7d59b1d3ff2f80d572be3e85aaab3fdee16744a"
integrity sha512-vneDkHGDuTvLQjUBztqb2YI8QoH1zxdJonPGTS+g57lfJZff9fAjoLSSb6NgMBebpXFcK3I3sEresGyL+3AArw==
react-native-eva-icons@^1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/react-native-eva-icons/-/react-native-eva-icons-1.3.1.tgz#1e6e019b0fd3cb1669db50bd6bbdaa6d89327593"