From 80223d1d9d65d7e1747ea760e1569d282141c0e5 Mon Sep 17 00:00:00 2001 From: ehsan shariati Date: Fri, 12 May 2023 01:44:16 -0400 Subject: [PATCH] added new FULA_ENC_V2: tag to all SharedPref keys --- .../src/main/java/land/fx/fula/FulaModule.java | 16 ++++++++-------- package.json | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/android/src/main/java/land/fx/fula/FulaModule.java b/android/src/main/java/land/fx/fula/FulaModule.java index ef866ae..e26d8e5 100755 --- a/android/src/main/java/land/fx/fula/FulaModule.java +++ b/android/src/main/java/land/fx/fula/FulaModule.java @@ -478,8 +478,8 @@ private boolean encrypt_and_store_config() throws Exception { String cid_encrypted = Cryptography.encryptMsg(this.rootConfig.getCid(), this.secretKeyGlobal); String private_ref_encrypted = Cryptography.encryptMsg(this.rootConfig.getPrivate_ref(), this.secretKeyGlobal); - sharedPref.add("cid_encrypted_" + this.identityEncryptedGlobal, cid_encrypted); - sharedPref.add("private_ref_encrypted_" + this.identityEncryptedGlobal, private_ref_encrypted); + sharedPref.add("FULA_ENC_V2:cid_encrypted_" + this.identityEncryptedGlobal, cid_encrypted); + sharedPref.add("FULA_ENC_V2:private_ref_encrypted_" + this.identityEncryptedGlobal, private_ref_encrypted); return true; } else { return false; @@ -497,13 +497,13 @@ private boolean logoutInternal(byte[] identity, String storePath) throws Excepti } SecretKey secretKey = Cryptography.generateKey(identity); String identity_encrypted = Cryptography.encryptMsg(Arrays.toString(identity), secretKey); - sharedPref.remove("cid_encrypted_"+ identity_encrypted); - sharedPref.remove("private_ref_encrypted_"+identity_encrypted); + sharedPref.remove("FULA_ENC_V2:cid_encrypted_"+ identity_encrypted); + sharedPref.remove("FULA_ENC_V2:private_ref_encrypted_"+identity_encrypted); //TODO: Should also remove peerid @Mahdi - sharedPref.remove("cid_encrypted_"+ identity_encrypted); - sharedPref.remove("private_ref_encrypted_"+ identity_encrypted); + sharedPref.remove("FULA_ENC_V2:cid_encrypted_"+ identity_encrypted); + sharedPref.remove("FULA_ENC_V2:private_ref_encrypted_"+ identity_encrypted); this.rootConfig = null; this.secretKeyGlobal = null; @@ -591,8 +591,8 @@ private String[] initInternal(byte[] identity, String storePath, String bloxAddr Log.d("ReactNative", "this.rootCid is empty."); //Load from keystore - String cid_encrypted_fetched = sharedPref.getValue("cid_encrypted_"+ identity_encrypted); - String private_ref_encrypted_fetched = sharedPref.getValue("private_ref_encrypted_"+identity_encrypted); + String cid_encrypted_fetched = sharedPref.getValue("FULA_ENC_V2:cid_encrypted_"+ identity_encrypted); + String private_ref_encrypted_fetched = sharedPref.getValue("FULA_ENC_V2:private_ref_encrypted_"+identity_encrypted); Log.d("ReactNative", "Here1"); String cid = ""; String private_ref = ""; diff --git a/package.json b/package.json index aa52569..826faca 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@functionland/react-native-fula", - "version": "1.2.3", + "version": "1.2.4", "description": "This package is a bridge to use the Fula libp2p protocols in the react-native which is using wnfs", "main": "lib/commonjs/index", "module": "lib/module/index",