cacheFolderPath

This commit is contained in:
Marcos Rodriguez Velez 2024-04-09 17:53:57 -04:00
parent 2294c851cb
commit abf2ea148f
No known key found for this signature in database
GPG key ID: 6030B2F48CCE86D7
3 changed files with 7 additions and 7 deletions

View file

@ -236,12 +236,12 @@ export class AppStorage {
* Database file is deterministically derived from encryption key.
*/
async getRealm() {
const tempFolderPath = RNFS.TemporaryDirectoryPath; // Path to temporary folder
const cacheFolderPath = RNFS.CachesDirectoryPath; // Path to cache folder
const password = this.hashIt(this.cachedPassword || 'fyegjitkyf[eqjnc.lf');
const buf = Buffer.from(this.hashIt(password) + this.hashIt(password), 'hex');
const encryptionKey = Int8Array.from(buf);
const fileName = this.hashIt(this.hashIt(password)) + '-wallettransactions.realm';
const path = `${tempFolderPath}/${fileName}`; // Use temporary folder path
const path = `${cacheFolderPath}/${fileName}`; // Use cache folder path
const schema = [
{
@ -270,7 +270,7 @@ export class AppStorage {
* @returns {Promise<Realm>}
*/
async openRealmKeyValue(): Promise<Realm> {
const tempFolderPath = RNFS.TemporaryDirectoryPath; // Path to temporary folder
const cacheFolderPath = RNFS.CachesDirectoryPath; // Path to cache folder
const service = 'realm_encryption_key';
let password;
const credentials = await Keychain.getGenericPassword({ service });
@ -284,7 +284,7 @@ export class AppStorage {
const buf = Buffer.from(password, 'hex');
const encryptionKey = Int8Array.from(buf);
const path = `${tempFolderPath}/keyvalue.realm`; // Use temporary folder path
const path = `${cacheFolderPath}/keyvalue.realm`; // Use cache folder path
const schema = [
{

View file

@ -109,11 +109,11 @@ let _realm: Realm | undefined;
async function _getRealm() {
if (_realm) return _realm;
const tempFolderPath = RNFS.CachesDirectoryPath; // Path to temporary folder
const cacheFolderPath = RNFS.CachesDirectoryPath; // Path to cache folder
const password = bitcoin.crypto.sha256(Buffer.from('fyegjitkyf[eqjnc.lf')).toString('hex');
const buf = Buffer.from(password + password, 'hex');
const encryptionKey = Int8Array.from(buf);
const path = `${tempFolderPath}/electrumcache.realm`; // Use temporary folder path
const path = `${cacheFolderPath}/electrumcache.realm`; // Use cache folder path
const schema = [
{

View file

@ -227,7 +227,7 @@ export const WalletCarouselItem = ({ item, _, onPress, handleLongPress, isSelect
<Text
numberOfLines={1}
key={balance} // force component recreation on balance change. To fix right-to-left languages, like Farsi
ellipsizeMode='middle'
ellipsizeMode="middle"
style={[iStyles.balance, { color: colors.inverseForegroundColor }]}
>
{`${balance} `}