When I invoke something like the following to store a key using the react-native-secure-key-store
package in a React Native project on Android...
RNSecureKeyStore.set("my_key", "some-token-123")
.then(res => {
console.log("Key saved", res);
}, err => {
console.error("Unable to set key", err);
});
...I get an error saying:
RNSecureKeyStore.set got 4 arguments, expected 5
However, looking in the RNSecureKeyStoreModule.java
file it looks like the set
method accepts 4 arguments:
@ReactMethod
public void set(String alias, String input, @Nullable ReadableMap options, Promise promise)
Not really sure what I'm missing here? I've done the usual needle-in-a-haystack things like cleaning and rebuilding the project, removing/reinstalling/re-linking all packages, etc. :)
You should add ACCESSIBLE
Example
import RNSecureKeyStore, {ACCESSIBLE} from "react-native-secure-key-store";
// For storing key
RNSecureKeyStore.set("key1", "value1", {accessible: ACCESSIBLE.ALWAYS_THIS_DEVICE_ONLY})
.then((res) => {
console.log(res);
}, (err) => {
console.log(err);
});