react-native-encrypted-storage icon indicating copy to clipboard operation
react-native-encrypted-storage copied to clipboard

Would be great to have `kSecAttrAccessible` param

Open therobertgrigorian opened this issue 3 years ago • 1 comments

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-encrypted-storage/android/build.gradle b/node_modules/react-native-encrypted-storage/android/build.gradle
index b762894..dd8f5ff 100644
--- a/node_modules/react-native-encrypted-storage/android/build.gradle
+++ b/node_modules/react-native-encrypted-storage/android/build.gradle
@@ -125,8 +125,8 @@ dependencies {

   testImplementation 'junit:junit:4.13.1'

-  androidTestImplementation 'androidx.test.ext:junit:1.1.2'
+  androidTestImplementation 'androidx.test.ext:junit:1.1.3'
   //noinspection GradleDependency
-  androidTestImplementation 'org.mockito:mockito-android:3.4.6'
-  androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
+  androidTestImplementation 'org.mockito:mockito-android:4.6.1'
+  androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
 }
diff --git a/node_modules/react-native-encrypted-storage/ios/RNEncryptedStorage.m b/node_modules/react-native-encrypted-storage/ios/RNEncryptedStorage.m
index 9ad4b23..987b731 100644
--- a/node_modules/react-native-encrypted-storage/ios/RNEncryptedStorage.m
+++ b/node_modules/react-native-encrypted-storage/ios/RNEncryptedStorage.m
@@ -41,7 +41,8 @@ + (BOOL)requiresMainQueueSetup
     NSDictionary* storeQuery = @{
         (__bridge id)kSecClass : (__bridge id)kSecClassGenericPassword,
         (__bridge id)kSecAttrAccount : key,
-        (__bridge id)kSecValueData : dataFromValue
+        (__bridge id)kSecValueData : dataFromValue,
+        (__bridge id)kSecAttrAccessible : kSecAttrAccessibleAfterFirstUnlock
     };

     // Deletes the existing item prior to inserting the new one

This issue body was partially generated by patch-package.

therobertgrigorian avatar Dec 15 '22 13:12 therobertgrigorian

this fix won't compile for ios,

should be (__bridge id)kSecAttrAccessible : (__bridge id) kSecAttrAccessibleAfterFirstUnlock

r0ssIV avatar Mar 18 '23 06:03 r0ssIV