Git Product home page Git Product logo

rn-secure-storage's Introduction

rn-secure-storage's People

Contributors

akiver avatar bumper-talut-tasgiran avatar chrism-rainn avatar corlissc avatar dependabot[bot] avatar emit2e avatar evo0705 avatar fpkmatthi avatar henryfilho avatar jussikinnula avatar kirin-p avatar mfaridzia avatar msdeibel avatar saeedzhiany avatar talut avatar vinetos avatar vladinator1000 avatar wi-ry avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

rn-secure-storage's Issues

no data

Hello
i tried to save and get them but nothings

my code is
`
import {ReactNative } from 'react-native';
import RNSecureStorage, { ACCESSIBLE } from 'rn-secure-storage'

export function save_user_info(info) {
RNSecureStorage.set("info", JSON.stringify(info), {accessible: ACCESSIBLE.ALWAYS})
.then((res) => {
return true;
}, (err) => {
console.log(err);
return err;
});
};

export function get_user_info() {
RNSecureStorage.get("info").then((val) => {
if(val){
return JSON.parse(val);
}else{
return {"userid": 1,"full_name": "Demo Demo","email":"[email protected]","token":"81e4247f6c5823ada231cbbbd387a380433ed1a8","actived":true,"phone":"99999999"};
}
}, (err) => {
console.log(err);
return {"userid": 1,"full_name": "Demo Demo","email":"[email protected]","token":"81e4247f6c5823ada231cbbbd387a380433ed1a8","actived":true,"phone":"99999999"};
});
};

export default RNSecureStorage;
`

this how i used it
import {save_user_info,get_user_info} from '../ultils/user_info.js';
<Text>{JSON.stringify(save_user_info({ 'userid': '1', 'full_name': 'Demo Demo', 'email':'[email protected]', 'token':'81e4247f6c5823ada231cbbbd387a380433ed1a8', 'actived':'1', 'phone':'99999999' }))}</Text> <Text>{JSON.stringify(get_user_info())}</Text>

thnx

Risk of double resolve/reject in Android version

Looking at RNSecureStorageModule there seems to be some strange logic regarding the set method. After the try-catch block covering if(isRTL...) else there is another try-catch with the same implementation as the else block before. I'm assume that's leftover from the RTL-fix.

    @ReactMethod
    public void set(String key, String value, @Nullable ReadableMap options, Promise promise) {
        if (useKeystore()) {
            try {
                Locale initialLocale = Locale.getDefault();
                if (isRTL(initialLocale)) {
                    Locale.setDefault(Locale.ENGLISH);
                    rnKeyStore.setCipherText(getReactApplicationContext(), key, value);
                    promise.resolve("RNSecureStorage: Key stored/updated successfully");
                    Locale.setDefault(initialLocale);
                } else {
                    rnKeyStore.setCipherText(getReactApplicationContext(), key, value);
                    promise.resolve("RNSecureStorage: Key stored/updated successfully");
                }
            } catch (Exception e) {
                promise.reject(e);
            }
            try {
                rnKeyStore.setCipherText(getReactApplicationContext(), key, value);
                promise.resolve("RNSecureStorage: Key stored/updated successfully");
            } catch (Exception e) {
                promise.reject(e);
            }
        } else {
            try {
                SharedPreferences.Editor editor = prefs.edit();
                editor.putString(key, value);
                editor.apply();
                promise.resolve("RNSecureStorage: Key stored/updated successfully");
            } catch (Exception e) {
                promise.reject(e);
            }
        }
    }```

iOS key does not exists after some days or time

Hi, the issue is that after storing a key in secure storage, after some time it seizes to exists and the get function returns key does not exists, it happens randomly but it is happening to every user on our app. Hoping that someone could explain why it may be happening.

SetState not working ?

Hi ! could you please explain how we can use this !

I have tried using in my class:

class Authorize {
//results are coming from fetch promise...
   RNSecureStorage.set("UserSessionName", results.session_name, {accessible: ACCESSIBLE.WHEN_UNLOCKED})
                .then((res) => {
                    console.log(res);
                }, (err) => {
                    console.log(err);
                });
}

it works in above case but when I use setStat in same function in above class it gives below error:

YellowBox.js:67 Possible Unhandled Promise Rejection (id: 0):
TypeError: _this.setState is not a function
TypeError: _this.setState is not a function

I tried alternative to setState, when we get values:

componentDidMount(){


        RNSecureStorage.get("UserSessionToken").then((value) => {
            this.setState({
                userToken: value
            })
            console.log(this.state.userToken) // in this it gives value
        }).catch((err) => {
            alert(err)
        })

        console.log(this.state.userToken) // but this outside does not give values, it shows same as set in constructor 

        //Authorize.GetUserRole(this.state.userToken)
         
    }

But this also does not works. It give value to console within RNSecureStorage.get but when called outside it gives no value ie: undefined.

Please suggest !

Remove multiple values at a time

Is it possible to remove multiple values by single call?

RNSecureStorage.remove("key1", "key12").then((val) => { console.log(val) }).catch((err) => { console.log(err) });

Use of a Broken or Risky CryptographicAlgorithm

Hello,
I recently used rn-secure-storage for a banking app instead of AsyncStorage but got this error from a veracode scan : Use of a Broken or Risky CryptographicAlgorithm.

Please how do i go about in solving this issue of security?

[Question]: How is the data retrieved on iOS

I would like to know what element of an iOS app is used to retieve its corresponding data. (an id perhaps)
I have done an app transfer after which my App ID has changed but the bundle ID remained the same. After updating the app, I have lost all the data in the secured storage.SO my opinion is that the data is bound to the App ID that is
<teamdID>:<bundleID>.
I am using 2.0.7

Android: cannot find symbol class Nullable

When updating from 1.1.1 to 2.0.1 I am experiencing an issue where Android is failing to build. Looking at the Android studio error it looks like it is caused by an import error in RNSecureStorageModule.java line 5 import androidx.annotation.Nullable;
Screen Shot 2019-08-27 at 10 36 37 AM

[FEATURE REQUEST] Fetch all keys and values api

I'd love to use this library w/ AWS Amplify for secure storage of tokens.

The only functionality that is missing is the ability to query all registered keys and then read those values into memory. I've tried the other keychain implementations and this is the most featured so it would be awesome if it supported a getAll api.

Thank you.

Problems with installation on android

After following the installation guide, I am no longer able to start the application on my android device (I have not tried on IOS yet). In fact, I get the following error (for simplicity I replaced the root directory of my project with the word "mydir"):

> Task :app:mergeDexDebug FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.0.1/userguide/command_line_interface.html#sec:command_line_warnings
206 actionable tasks: 186 executed, 20 up-to-date
Note: mydir\packages\mobile\node_modules\@react-native-community\google-signin\android\src\main\java\co\apptailor\googlesignin\RNGoogleSigninModule.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: mydir\packages\mobile\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerButtonViewManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: mydir\packages\mobile\node_modules\react-native-reanimated\android\src\main\java\com\swmansion\reanimated\NodesManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note:mydir\packages\mobile\node_modules\react-native-reanimated\android\src\main\java\com\swmansion\reanimated\NodesManager.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: mydir\packages\mobile\node_modules\rn-secure-storage\android\src\main\java\com\taluttasgiran\rnsecurestorage\RNKeyStore.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: mydir\packages\mobile\android\app\src\debug\java\com\footprint\ReactNativeFlipper.java uses or overrides a deprecated 
API.
Note: Recompile with -Xlint:deprecation for details.
D8: Cannot fit requested classes in a single dex file (# fields: 67369 > 65536)
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
The number of method references in a .dex file cannot exceed 64K.
Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html
        at com.android.builder.dexing.D8DexArchiveMerger.getExceptionToRethrow(D8DexArchiveMerger.java:131)
        at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:118)
        at com.android.build.gradle.internal.transforms.DexMergerTransformCallable.call(DexMergerTransformCallable.java:102)
        at com.android.build.gradle.internal.tasks.DexMergingTaskRunnable.run(DexMergingTask.kt:444)
        at com.android.build.gradle.internal.tasks.Workers$ActionFacade.run(Workers.kt:335)
        at org.gradle.workers.internal.AdapterWorkAction.execute(AdapterWorkAction.java:50)
        at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:50)
        at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1$1.create(NoIsolationWorkerFactory.java:65)
        at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1$1.create(NoIsolationWorkerFactory.java:61)
        at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:98)
        at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.execute(NoIsolationWorkerFactory.java:61)
        at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:44)
        at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:41)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
        at org.gradle.workers.internal.AbstractWorker.executeWrappedInBuildOperation(AbstractWorker.java:41)
        at org.gradle.workers.internal.NoIsolationWorkerFactory$1.execute(NoIsolationWorkerFactory.java:53)
        at org.gradle.workers.internal.DefaultWorkerExecutor$3.call(DefaultWorkerExecutor.java:217)
        at org.gradle.workers.internal.DefaultWorkerExecutor$3.call(DefaultWorkerExecutor.java:212)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runExecution(DefaultConditionalExecutionQueue.java:215)
        at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runBatch(DefaultConditionalExecutionQueue.java:164)
        at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.run(DefaultConditionalExecutionQueue.java:131)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
        at java.lang.Thread.run(Thread.java:748)
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete
        at com.android.tools.r8.utils.t.a(:55)
        at com.android.tools.r8.D8.run(:11)
        at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:116)
        ... 34 more
Caused by: com.android.tools.r8.utils.AbortException: Error: null, Cannot fit requested classes in a single dex file (# fields: 67369 > 65536)
        at com.android.tools.r8.utils.Reporter.a(:21)
        at com.android.tools.r8.utils.Reporter.a(:7)
        at com.android.tools.r8.dex.VirtualFile.a(:33)
        at com.android.tools.r8.dex.VirtualFile$h.a(:5)
        at com.android.tools.r8.dex.ApplicationWriter.a(:13)
        at com.android.tools.r8.dex.ApplicationWriter.write(:35)
        at com.android.tools.r8.D8.d(:44)
        at com.android.tools.r8.D8.b(:1)
        at com.android.tools.r8.utils.t.a(:23)
        ... 36 more


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDexDebug'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
     The number of method references in a .dex file cannot exceed 64K.
     Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 46s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
Note: mydir\packages\mobile\node_modules\@react-native-community\google-signin\android\src\main\java\co\apptailor\googlesignin\RNGoogleSigninModule.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: mydir\packages\mobile\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerButtonViewManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: mydir\packages\mobile\node_modules\react-native-reanimated\android\src\main\java\com\swmansion\reanimated\NodesManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: mydir\packages\mobile\node_modules\react-native-reanimated\android\src\main\java\com\swmansion\reanimated\NodesManager.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: mydir\packages\mobile\node_modules\rn-secure-storage\android\src\main\java\com\taluttasgiran\rnsecurestorage\RNKeyStore.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: mydir\packages\mobile\android\app\src\debug\java\com\footprint\ReactNativeFlipper.java uses or overrides a deprecated 
API.
Note: Recompile with -Xlint:deprecation for details.
D8: Cannot fit requested classes in a single dex file (# fields: 67369 > 65536)
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
The number of method references in a .dex file cannot exceed 64K.
Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html
        at com.android.builder.dexing.D8DexArchiveMerger.getExceptionToRethrow(D8DexArchiveMerger.java:131)
        at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:118)
        at com.android.build.gradle.internal.transforms.DexMergerTransformCallable.call(DexMergerTransformCallable.java:102)
        at com.android.build.gradle.internal.tasks.DexMergingTaskRunnable.run(DexMergingTask.kt:444)
        at com.android.build.gradle.internal.tasks.Workers$ActionFacade.run(Workers.kt:335)
        at org.gradle.workers.internal.AdapterWorkAction.execute(AdapterWorkAction.java:50)
        at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:50)
        at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1$1.create(NoIsolationWorkerFactory.java:65)
        at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1$1.create(NoIsolationWorkerFactory.java:61)
        at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:98)
        at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.execute(NoIsolationWorkerFactory.java:61)
        at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:44)
        at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:41)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
        at org.gradle.workers.internal.AbstractWorker.executeWrappedInBuildOperation(AbstractWorker.java:41)
        at org.gradle.workers.internal.NoIsolationWorkerFactory$1.execute(NoIsolationWorkerFactory.java:53)
        at org.gradle.workers.internal.DefaultWorkerExecutor$3.call(DefaultWorkerExecutor.java:217)
        at org.gradle.workers.internal.DefaultWorkerExecutor$3.call(DefaultWorkerExecutor.java:212)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runExecution(DefaultConditionalExecutionQueue.java:215)
        at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runBatch(DefaultConditionalExecutionQueue.java:164)
        at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.run(DefaultConditionalExecutionQueue.java:131)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
        at java.lang.Thread.run(Thread.java:748)
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete
        at com.android.tools.r8.utils.t.a(:55)
        at com.android.tools.r8.D8.run(:11)
        at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:116)
        ... 34 more
Caused by: com.android.tools.r8.utils.AbortException: Error: null, Cannot fit requested classes in a single dex file (# fields: 67369 > 65536)
        at com.android.tools.r8.utils.Reporter.a(:21)
        at com.android.tools.r8.utils.Reporter.a(:7)
        at com.android.tools.r8.dex.VirtualFile.a(:33)
        at com.android.tools.r8.dex.VirtualFile$h.a(:5)
        at com.android.tools.r8.dex.ApplicationWriter.a(:13)
        at com.android.tools.r8.dex.ApplicationWriter.write(:35)
        at com.android.tools.r8.D8.d(:44)
        at com.android.tools.r8.D8.b(:1)
        at com.android.tools.r8.utils.t.a(:23)
        ... 36 more


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDexDebug'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
     The number of method references in a .dex file cannot exceed 64K.
     Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 46s

Assuming, with my little experience with android, that the problem stemmed from AndroidX, I also tried to install version 1.1.1 with not different outcomes: after the installation, I can't launch the app anymore, but the error message changes, I report it below.

Task :app:mergeDexDebug FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.0.1/userguide/command_line_interface.html#sec:command_line_warnings
206 actionable tasks: 2 executed, 204 up-to-date
D8: Cannot fit requested classes in a single dex file (# fields: 67369 > 65536)
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
The number of method references in a .dex file cannot exceed 64K.
Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html
        at com.android.builder.dexing.D8DexArchiveMerger.getExceptionToRethrow(D8DexArchiveMerger.java:131)
        at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:118)
        at com.android.build.gradle.internal.transforms.DexMergerTransformCallable.call(DexMergerTransformCallable.java:102)
        at com.android.build.gradle.internal.tasks.DexMergingTaskRunnable.run(DexMergingTask.kt:444)
        at com.android.build.gradle.internal.tasks.Workers$ActionFacade.run(Workers.kt:335)
        at org.gradle.workers.internal.AdapterWorkAction.execute(AdapterWorkAction.java:50)
        at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:50)
        at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1$1.create(NoIsolationWorkerFactory.java:65)
        at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1$1.create(NoIsolationWorkerFactory.java:61)
        at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:98)
        at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.execute(NoIsolationWorkerFactory.java:61)
        at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:44)
        at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:41)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
        at org.gradle.workers.internal.AbstractWorker.executeWrappedInBuildOperation(AbstractWorker.java:41)
        at org.gradle.workers.internal.NoIsolationWorkerFactory$1.execute(NoIsolationWorkerFactory.java:53)
        at org.gradle.workers.internal.DefaultWorkerExecutor$3.call(DefaultWorkerExecutor.java:217)
        at org.gradle.workers.internal.DefaultWorkerExecutor$3.call(DefaultWorkerExecutor.java:212)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runExecution(DefaultConditionalExecutionQueue.java:215)
        at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runBatch(DefaultConditionalExecutionQueue.java:164)
        at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.run(DefaultConditionalExecutionQueue.java:131)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
        at java.lang.Thread.run(Thread.java:748)
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete
        at com.android.tools.r8.utils.t.a(:55)
        at com.android.tools.r8.D8.run(:11)
        at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:116)
        ... 34 more
Caused by: com.android.tools.r8.utils.AbortException: Error: null, Cannot fit requested classes in a single dex file (# fields: 67369 > 65536)
        at com.android.tools.r8.utils.Reporter.a(:21)
        at com.android.tools.r8.utils.Reporter.a(:7)
        at com.android.tools.r8.dex.VirtualFile.a(:33)
        at com.android.tools.r8.dex.VirtualFile$h.a(:5)
        at com.android.tools.r8.dex.ApplicationWriter.a(:13)
        at com.android.tools.r8.dex.ApplicationWriter.write(:35)
        at com.android.tools.r8.D8.d(:44)
        at com.android.tools.r8.D8.b(:1)
        at com.android.tools.r8.utils.t.a(:23)
        ... 36 more


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDexDebug'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
     The number of method references in a .dex file cannot exceed 64K.
     Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 9s

The react-native version I'm using is 0.62.2 and the operating system is windows

Missing Privacy Manifest

According to Apple, starting from the first of May, it won't be able to upload a new build unless the app (and its third party SDK) are compliant with Reason API

Any plan to add this?

Android build fails for AndroidTest with minSdkVersion 17 with react-native 0.64

I'm using Detox for e2e tests and after upgrading to RN 0.64, the app detox build fails.
This issue could concern multiple modules. It's referenced here: wix/Detox#2712

The following command fails after upgrading to RN 0.64
./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug

With the following message:
`

Task :rn-secure-storage:processDebugAndroidTestManifest FAILED
[androidx.vectordrawable:vectordrawable-animated:1.0.0] /root/.gradle/caches/transforms-2/files-2.1/bb05b16f135343eba8fb88851c1f8ee9/vectordrawable-animated-1.0.0/AndroidManifest.xml Warning:
Package name 'androidx.vectordrawable' used in: androidx.vectordrawable:vectordrawable-animated:1.0.0, androidx.vectordrawable:vectordrawable:1.0.1.
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
/builds/application-mobile/node_modules/rn-secure-storage/android/build/intermediates/tmp/manifest/androidTest/debug/manifestMerger1695351036710269372.xml:5:5-74 Error:
uses-sdk:minSdkVersion 16 cannot be smaller than version 21 declared in library [com.facebook.react:react-native:0.64.2] /root/.gradle/caches/transforms-2/files-2.1/83fdc6c83523d4af6406d02587819ec5/jetified-react-native-0.64.2/AndroidManifest.xml as the library might be using APIs not available in 16
Suggestion: use a compatible library with a minSdk of at most 16,
or increase this project's minSdk version to at least 21,
or use tools:overrideLibrary="com.facebook.react" to force usage (may lead to runtime failures)
`

I looked for several solutions but the easiest would be to update the gradle android config of rn-secure-storage, inspired from other gradle file of module like: https://github.com/react-native-async-storage/async-storage/blob/master/android/build.gradle

No definitive way to determine if a value exists

Hey!

rn-secure-storage offers a great way to save and access data securely within a device. Unfortunately, there is no exists method to determine if a key exists within Keychain & Keystore. This makes it difficult to check if a key exists before getting its value in the same manner for every implementation. Currently, either an error will be thrown (which can be difficult to parse) or null is returned, this introduces many outcomes that need to be accounted for. An exists method would account for that by only returning true/false for the provided key depending on if the key exists or not.

save multi value / array

Hello
does this plugin support save array or multi value ?
and does any way to get all values or get multi values on one time ?

thanks

RNSecureStorage is undefined

Hello, I tried as suggested

import RNSecureStorage, { ACCESSIBLE } from 'rn-secure-storage'

somehow the import of the ACCESSIBLE-object arrives, but RNSecureStorage is undefined ?

What can I do here ? I made sure that evrth. is linked
react-native link rn-secure-storage

rnpm-install info Platform 'ios' module rn-secure-storage is already linked
rnpm-install info Platform 'android' module rn-secure-storage is already linked

thx and greets, Andreas

Import build error

I get the following error after installing via npm and autolinking with react-native >0.60

...android\app\build\generated\rncli\src\main\java\com\facebook\react\PackageList.java:27: error: a type with the same simple name is already defined by the single-type-import of RNSecureStoragePackage
import com.taluttasgiran.rnsecurestorage.RNSecureStoragePackage;
^
1 error

FAILURE: Build failed with an exception.

Remove "buildToolsVersion '28.0.2'" from build.gradle file

I get the following warning when using rn-secure-storage:

Configure project :rn-secure-storage
WARNING: The specified Android SDK Build Tools version (28.0.2) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.4.2.
Android SDK Build Tools 28.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '28.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.

IOS only -> Values remain stored even after app reinstall/rebuild

Problem: On iOS (not on Android too) the values stored at keys are persisting even after app reinstall/rebuild. Strangely enough, if I go to Simulator -> Device -> Erase All Content and Settings, the keychain seems to reset but it gets "polluted" again if I delete the app and reinstall it. This wasn't the behavior in the previous version (2.0.8).

Environment: XCode 15.2, iOS 17.2 Emulator

Project: Clean bare-bones React Native Typescript project (without expo) created using command npx react-natie init MyProject --template react-native-template-typescript

Code: App.tsx

import React, { useEffect } from 'react';
import { View } from 'react-native';
import RNSecureStorage, { ACCESSIBLE } from 'rn-secure-storage';

function App(): React.JSX.Element {

  const myFunction = () => {
    RNSecureStorage.getItem("myUniqueItem123456").then((res) => {
      console.log("Value at key is ", res);
    }).catch((err) => {
      console.log("Key doesn't exist, setting value at key now")
      RNSecureStorage.setItem("myUniqueItem123456", "my_value", { accessible: ACCESSIBLE.WHEN_UNLOCKED }).then((res) => {
        console.log("Set result is: ", res);
      }).catch((err) => {
        console.log(err);
      });
    })
  }

  useEffect(() => {
    myFunction()
  }, [])

  return (
    <View>

    </View>
  )
}

export default App;

1. First run behavior (console.logs)

Android:

LOG Running "MyTestProject1" with {"rootTag":11}
LOG Key doesn't exist, setting value at key now
LOG Set result is: Stored successfully

iOS:

LOG Running "MyTestProject1" with {"rootTag":1, "initialProps":{}}
LOG Key doesn't exist, setting value at key now
LOG Set result is: Stored successfully

2. Second run behaviour (after deleting reinstalling the application)

Android:

LOG Running "MyTestProject1" with {"rootTag":11}
LOG Key doesn't exist, setting value at key now
LOG Set result is: Stored successfully

iOS:

LOG Running "MyTestProject1" with {"rootTag":1, "initialProps":{}}
LOG Value at key is my_value // --> value seems 'trapped' after a new fresh install

Also my package.json file

{
  "name": "MyTestProject1",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "lint": "eslint .",
    "start": "react-native start",
    "test": "jest"
  },
  "dependencies": {
    "react": "18.2.0",
    "react-native": "0.73.4",
    "rn-secure-storage": "^3.0.1"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@babel/preset-env": "^7.20.0",
    "@babel/runtime": "^7.20.0",
    "@react-native/babel-preset": "0.73.21",
    "@react-native/eslint-config": "0.73.2",
    "@react-native/metro-config": "0.73.5",
    "@react-native/typescript-config": "0.73.1",
    "@types/react": "^18.2.6",
    "@types/react-test-renderer": "^18.0.0",
    "babel-jest": "^29.6.3",
    "eslint": "^8.19.0",
    "jest": "^29.6.3",
    "prettier": "2.8.8",
    "react-test-renderer": "18.2.0",
    "typescript": "5.0.4"
  },
  "engines": {
    "node": ">=18"
  }
}

App Crash on ios and android

iOS

facebook::react::RCTNativeModule::invoke(unsigned int, folly::dynamic&&, int)::$_0::operator()() const + 68 

Android

Exception com.facebook.react.common.JavascriptException:
  at com.facebook.react.modules.core.ExceptionsManagerModule.reportException (ExceptionsManagerModule.java:72)
  at java.lang.reflect.Method.invoke
  at com.facebook.react.bridge.JavaMethodWrapper.invoke (JavaMethodWrapper.java:372)
  at com.facebook.react.bridge.JavaModuleWrapper.invoke (JavaModuleWrapper.java:188)
  at com.facebook.jni.NativeRunnable.run
  at android.os.Handler.handleCallback (Handler.java:938)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage (MessageQueueThreadHandler.java:27)
  at android.os.Looper.loopOnce (Looper.java:226)
  at android.os.Looper.loop (Looper.java:313)
  at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run (MessageQueueThreadImpl.java:228)
  at java.lang.Thread.run (Thread.java:920)

Behaviour when a key value pair isn't there

With your example -
const getItem = () => { RNSecureStorage.getItem("idToken").then(res => { setMessage(res); setError(null); }).catch(err => { setError(err); setMessage(null); } ); };
This suggests we either get a key or we get an error.
But when I look at the return type, it's Promise<string | null>. Which seems like if the string is there, it returns that or it returns null. So when the string isn't in the store, do we get an error or null?
What should be the correct behaviour?

React-Native 0.70.6 Not Picking up RNSecureStorage.podspec

It looks like React-Native 0.70.6 is not picking up RNSecureStorage.podspec which is placed under ios folder in this library, causing a Type Error when we use the library on JS side.

I'm not aware if prior versions of React-Native have the same issue because I jumped directly from 0.67.5 to 0.70.6.

I have solved the issue by moving RNSecureStorage.podspec back to the root of the repo, and modify the license attribute since it broke.

For anyone struggling from the same issue:

  1. Delete node_modules/ios/RNSecureStorage.podspec.
  2. Create a new file 'node_modules/RNSecureStorage.podspec'.
  3. Copy paste the below config inside of it.
  4. Run in terminal npx patch-package rn-secure-storage (Read more about patch-package)
require 'json'

package = JSON.parse(File.read(File.join(__dir__, 'package.json')))

Pod::Spec.new do |s|
  s.name         = "RNSecureStorage"
  s.version      = package["version"]
  s.summary      = "RNSecureStorage"
  s.description  = package["description"]
  s.homepage     = package["homepage"]
  s.license      = { :type => package["license"], :file => "./LICENSE.md" }
  s.author       = { "Talut Tasgiran" => "[email protected]" }
  s.platform     = :ios, "7.0"
  s.source       = { :git => "https://github.com/talut/rn-secure-storage.git", :tag => "v#{s.version}" }
  s.source_files  = "**/*.{h,m}"
  s.requires_arc = true

  s.dependency "React"

end

I'll submit a PR in this couple of days as well.

Error running on Android

image

null is not an object (evaluating '_rnsecurestorage.default.set')

Anybody can help with that ?

getting error in Google Pre-launch report

Version of rn-secure-storage
2.0.6

Version of react-native
0.63.2

Platforms you faced the error (IOS or Android or both?)
Android

Details:

We are using this library to store user details at app side. The app gets deployed successfully in Google play console with internal/closed track. But we are getting below error in Pre-launch report:
Unsafe Cipher Mode
Your app contains a less secure encryption mode.
com.securepreferences.SecurePreferencesOld.encrypt

Reference link related to issue:
https://support.google.com/faqs/answer/10046138

We checked and found that the native code in library is using 'AES/ECB/PKCS5Padding' encryption which seems to cause the issue.

[Error: Non interactive decryption mode.] in Android

While retrieving the data in android I get [Error: Non interactive decryption mode.] using

 RNSecureStorage.getItem('token')
        .then((res) => {
          console.log(res);
        })
        .catch((err) => {
          console.log(err);
        });

It works fine in iOS

Question about transferring app and loss of keychain

Hi, We have recently transferred our app to a different team, and after uploading a new version of the app we have received this message: https://developer.apple.com/library/archive/qa/qa1726/_index.html

Potential Loss of Keychain Access. The previous version of software has an application-identifier value of 'A1B2C3D4E5.com.company.app' and the new version of software being submitted has an application-identifier of '5E4D3C2B1A.com.company.app'. This will result in a loss of keychain access.

From looking at the code here I see that the library uses the bundle id for keychain access. When we transferred the app the bundle ID has stayed the same, but the team ID has changed.

My question is - Does this library retain keychain access when transferring apps across teams - or if anyone has done this before when transferring the app and retained keychain access?

I have reached out to apple technical support/DTS and they sent me this article - https://developer.apple.com/forums/thread/706128

Worst case scenario for the next release we do something informing users they need to login, but obviously we would like to plan for that. Thanks for the great library.

Installation docs out of date for React Native 0.6

We don't need to react-native link rn-secure-storage anymore, just go to your ios folder and run pod install. On Android it works without any additional steps.

If you don't have CocoaPods installed: sudo gem install cocoapods

Why use ECB mode when is not recommended? but used in this project.

First of all my knowledge of cryptography is limited that's why I ask this questions.

This question is because in a recent Etical Hacking - Static Code Analysis applied to my codebase states that ECB is a weak method CWE-327: Use of a Broken or Risky Cryptographic Algorithm

I read some sites when states that ECB mode is not recommended since for the same input produce identical output. Block cipher mode of operation Furthermore, CWE - 327 encourage not to use algorithms such as MD4, MD5, SHA1, DES. In fact DES is used in combination with ECB.

However I look to the library codebase and find out that RSA/ECB is used. I run my own tests and realize that the SKS_DATA_FILE and SKS_KEY_FILE files have different content for the same input. This tells me that a good approach was implemented when writing the code.

Would anyone provide any explanation about how the library implemented cryptography to have better understanding of ECB in this project?

File not found eror

Hi, I'm trying to set and get an item (just using the example but with await/async and I get this error)
However it works with then/catch

get bb error Error: /data/user/0/info.***.***.test/files/SKS_KEY_FILEkey1 (No such file or directory)

Any idea? πŸ€—

Read values from native code

Is there a way to read values from storage from native code? For example I need to set auth request to the server from native part and auth token is stored by JS code.

Confusing return values for `set`

I don’t understand the β€œExample Fail for Set”, will the promise resolve with that value?

Returning boolean success flags is, in my opinion, very bad api design in JavaScript. Why not reject the promise with a proper error object when the call fails, and resolve it with undefined when the call succeeded?

Android X import issue in release mode

Hi,

I use your librairy and I wil be in production very soon. So I have tried to build my app for Android in release mode.
So when I build I have some androidX import issue inside your library in release mode :

Project/node_modules/rn-secure-storage/android/src/main/java/com/taluttasgiran/rnsecurestorage/RNSecureStorageModule.java:5: error: package android.support.annotation does not exist
import android.support.annotation.Nullable;
                                 ^
Project/node_modules/rn-secure-storage/android/src/main/java/com/taluttasgiran/rnsecurestorage/RNSecureStorageModule.java:44: error: cannot find symbol
    public void set(String key, String value, @Nullable ReadableMap options, Promise promise) {
                                               ^
  symbol:   class Nullable
  location: class RNSecureStorageModule

lib import : "rn-secure-storage": "^2.0.5"
React Native : "react-native": "0.62.2",

Please could you fix the imports ?

Thanks in advance,

b-allard

Stored data does not persist between v2 and v3

First of all thank you for releasing v3 which addresses warnings from Play Store πŸ‘

I have upgraded the library to v 3.0.1 from 2.0.7 and after backwards compatibility tests it would seem like the values do not persist between major release versions, is that expected?

STR

Platform Android (I did not test iOS)

  1. Install build with [email protected] and persist data to storage
  2. Update the build to apk with [email protected]

Actual Result:

Stored data is no longer persisted.

Expected Result:

Stored data should not be affected.

I have will try to debug it and see how actual storage looks like between upgrades.

Obsolete build.gradle

Compiling a React Native app for Android with Windows 10, Gradle 7.2, OpenJDK 11.

Gradle 7.2 doesn't like rn-secure-storage\android\build.gradle:

Could not get unknown property 'compile' for configuration container of type org.gradle.api.internal.artifacts.configurations.DefaultConfigurationContainer.

Offending code:

task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

Property "compile" is deprecated since Gradle 6 and removed since Gradle 7 and it has been replaced by "implementation". This works:

task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.implementation
    into 'libs'
}

The iOS Simulator deployment target is set to 7.0, but the range of supported deployment target versions for this platform is 8.0 to 12.4.99. (in target 'RNSecureStorage')

Hello, I am currently running a iphone X simulator with software version 12.4

Yet i still see this warning

The iOS Simulator deployment target is set to 7.0, but the range of supported deployment target versions for this platform is 8.0 to 12.4.99. (in target 'RNSecureStorage')

Is this accurate? Any steps to remove the warning?

Thanks,

-Dave

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.