javareact-nativekeychainreact-native-keychain

React native keychain error when using setGenericPassword function


I am using keychain package to store credentials. After I build the app this package doesn't work but throws an error. This is the error:

Attempt to invoke virtual method 'void com.oblador.keychain.cipherStorage.CipherStorageFacebookConceal.throwIfInsufficientLevel(com.oblador.keychain.SecurityLevel)' on a null object reference

The same code works fine when it is compiled on my friend's pc. SO, why is that? We build the same app on the same phone and I got this error. How can I solve this?


Solution

  • I resolved the problem by defining the STORAGE_TYPE

    let options: Keychain.Options = { storage:Keychain.STORAGE_TYPE.FB};
    

    you can select that will use FB ,AES or RSA

    Keychain.setGenericPassword('user', "password", options).then(console.log)
    

    options