GithubHelp home page GithubHelp logo

pradeep1991singh / react-native-secure-key-store Goto Github PK

View Code? Open in Web Editor NEW
239.0 5.0 68.0 1.76 MB

React Native Library for securely storing keys to iOS KeyChain and Android KeyStore.

License: ISC License

Java 24.56% JavaScript 15.14% Objective-C 49.92% Ruby 2.49% Starlark 7.90%
react-native ios android keychain-services device-security keystore-services

react-native-secure-key-store's Introduction

react-native-secure-key-store

React Native Library for securely storing keys to iOS and Android devices in KeyChain and KeyStore respectively

Getting started

$ npm install react-native-secure-key-store --save

or

$ yarn add react-native-secure-key-store

Manual installation

iOS

  1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  2. Go to node_modulesreact-native-secure-key-store and add RNSecureKeyStore.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libRNSecureKeyStore.a to your project's Build PhasesLink Binary With Libraries
  4. Run your project (Cmd+R)<

Android

  1. Open up android/app/src/main/java/[...]/MainApplication.java
  • Add import com.reactlibrary.securekeystore.RNSecureKeyStorePackage; to the imports at the top of the file
  • Add new RNSecureKeyStorePackage() to the list returned by the getPackages() method
  1. Append the following lines to android/settings.gradle:
    include ':react-native-secure-key-store'
    project(':react-native-secure-key-store').projectDir = new File(rootProject.projectDir, 	'../node_modules/react-native-secure-key-store/android')
    
  2. Insert the following lines inside the dependencies block in android/app/build.gradle:
    compile project(':react-native-secure-key-store')
    

Usage

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);
	});

// For retrieving key
RNSecureKeyStore.get("key1")
	.then((res) => {
		console.log(res);
	}, (err) => {
		console.log(err);
	});

// For removing key
RNSecureKeyStore.remove("key1")
	.then((res) => {
		console.log(res);
	}, (err) => {
		console.log(err);
	});
  • For demo app, checkout example directory.

Options

Key Platform Description Default
accessible iOS only This dictates when a keychain item is accessible, see possible values in Keychain.ACCESSIBLE. Keychain.ACCESSIBLE.WHEN_UNLOCKED

Keychain.ACCESSIBLE enum

Key Description
WHEN_UNLOCKED The data in the keychain item can be accessed only while the device is unlocked by the user.
AFTER_FIRST_UNLOCK The data in the keychain item cannot be accessed after a restart until the device has been unlocked once by the user.
ALWAYS The data in the keychain item can always be accessed regardless of whether the device is locked.
WHEN_PASSCODE_SET_THIS_DEVICE_ONLY The data in the keychain can only be accessed when the device is unlocked. Only available if a passcode is set on the device. Items with this attribute never migrate to a new device.
WHEN_UNLOCKED_THIS_DEVICE_ONLY The data in the keychain item can be accessed only while the device is unlocked by the user. Items with this attribute do not migrate to a new device.
AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY The data in the keychain item cannot be accessed after a restart until the device has been unlocked once by the user. Items with this attribute never migrate to a new device.
ALWAYS_THIS_DEVICE_ONLY The data in the keychain item can always be accessed regardless of whether the device is locked. Items with this attribute never migrate to a new device.

Handle App uninstalls (iOS only)

By default, this library resets the device's Keychain when it detects the app has been uninstalled.

If you don't want this to occur, you can disable this behavior at any given time by doing:

RNSecureKeyStore.setResetOnAppUninstallTo(false)

Testing

For Testing using Jest, add RNSecureKeyStoreMock implementation under your test/mocks folder. This mock implementation makes easy for you to make testing that dependes on react-native-secure-key-store

License

ISC License (ISC) Copyright (c) 2016 pradeep singh

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Buy Me A Coffee

react-native-secure-key-store's People

Contributors

aiden-petersen avatar aprilsnows avatar benvp avatar calvincestari avatar christopherjmblack avatar crutchcorn avatar davidgovea avatar dependabot[bot] avatar eranbo avatar javi avatar kaeruct avatar lenkavon avatar oximer avatar pagoru avatar pradeep1991singh avatar r3nya avatar ram4git avatar saeedzhiany avatar sayurimizuguchi avatar shayantabatabaee avatar sianlasaga avatar talaikis avatar te-online avatar tombailey avatar tykus160 avatar yoman07 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

react-native-secure-key-store's Issues

Getting NoSuchAlgorithmException on older devices

Hello,

We caught an error saying:


java.security.NoSuchAlgorithmException: KeyStore Android OpenSSL implementation not found

This error was caught on a Samsung S4 device running Android 4.2.2. Is this a known limitation of the library?

Thanks for the assist!

iOS cant store lengthy strings

Following throws an error on iOS both sim and real device:

        const ss = '1'.repeat(18888888);
        RNSecureKeyStore.set('test', ss);

threshold string length is around 16,777,110 according to https://stackoverflow.com/questions/13488793/is-there-any-length-limit-of-string-stored-in-keychain which is not much, I'd say, 16 megs.

it would be nice if this library could split data in chunks instead of outsourcing it to javascript code.

tested on iphone11, ios14 (beta)
on sim: iPhone 11 (13.4)

Keychain is shared with native ?

Hello,

I'm trying to use the data I stored (on the react native app) on a today extension (widget) for iOS (swift).

Do you know if it's possible to have access of the data stored on the keychain from the today extension ? Or the keychain we use with your library is only available for the react native app ?

Sincerely,

Jeremy P

podspec is inside the ios folder

BUG REPORT:

The RNSecureKeyStore.podspec is placed inside the ios folder of the package. This causes auto-linking and afterward, pod install face error and we should change the path manually to target the ios folder inside the module

where the podspec should be placed:
pod 'RNSecureKeyStore', :path => '../node_modules/react-native-secure-key-store'

Where it is placed
pod 'RNSecureKeyStore', :path => '../node_modules/react-native-secure-key-store/ios'

E/SecureKeyStore: Exception: RSA private or public key is null

I'm encountering this error occasionally during app start up.
2021-04-08 10:56:29.388 17920-18028/? E/SecureKeyStore: Exception: RSA private or public key is null 2021-04-08 10:56:29.392 17920-18027/? E/ReactNativeJS: 'Unhandled promise rejection', [Error: {"code":1,"api-level":29,"message":RSA private or public key is null}]

Occurs on both android and iOS

"react-native": "0.64.0",
"react-native-secure-key-store": "^2.0.9",

RNSecureKeyStorePackage is not abstract and does not override abstract method createJSModules() in ReactPackage

Please see below terminal logs.

/Users/hasaxena/cdhs/node_modules/react-native-secure-key-store/android/src/main/java/com/reactlibrary/securekeystore/RNSecureKeyStorePackage.java:18: error: RNSecureKeyStorePackage is not abstract and does not override abstract method createJSModules() in ReactPackage
public class RNSecureKeyStorePackage implements ReactPackage {
^
Note: /Users/hasaxena/cdhs/node_modules/react-native-secure-key-store/android/src/main/java/com/reactlibrary/securekeystore/RNSecureKeyStoreModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error
:react-native-secure-key-store:compileReleaseJavaWithJavac FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':react-native-secure-key-store:compileReleaseJavaWithJavac'.

Compilation failed; see the compiler error output for details.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 31.114 secs
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build-android-sit: export ENVFILE=environments/.env.sit && cd android && ./gradlew assembleRelease && cd ..
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build-android-sit script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/hasaxena/.npm/_logs/2017-09-21T07_15_49_995Z-debug.log
USMUMHASAXENAMB:cdhs hasaxena$

RNSecureKeyStore.remove() "could not delete key"

Having an issue removing keys from the secure key store. Here's what my code looks like:

resetAuthentication = async () => { try { await RNSecureKeyStore.remove("accessToken"); return true; } catch (err) { return err; } }

I'm getting the following error:

Error: {"message":"could not delete key"} at Object.promiseMethodWrapper [as remove] (NativeModules.js:103) at _callee8$ (auth.js:133) at tryCatch (runtime.js:63) at Generator.invoke [as _invoke] (runtime.js:293) at Generator.next (runtime.js:118) at tryCatch (runtime.js:63) at invoke (runtime.js:154) at runtime.js:189 at tryCallTwo (core.js:45) at doResolve (core.js:200)

Error on Xiaomi Redmi Note 4/X

Hi,

I've tested the module with various of phones and it works on most of them except from Xiaomi Redmi Note 4.

Here is a link to a github repo of the app (Very simple POC for reading and writing one simple key,value)
https://github.com/eranbo/RNSS

Also attaching the ADB logcat and device software version information screen shot.

xiaomi redmi note 4

Xiaomi Redmi Note 4.log

Update: Tested it on Xiaomi Redmi Note 3 and it works as expected.
Thanks,
Eran

Error:(18, 8) error: RNSecureKeyStorePackage is not abstract and does not override abstract method createJSModules() in ReactPackage

Hi,

I've got error with lasted version when I try to lunch my android App.
This is my error:

Error:(18, 8) error: RNSecureKeyStorePackage is not abstract and does not override abstract method createJSModules() in ReactPackage

This is my package.json

{
"name": "Transfusion",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"moment": "^2.19.1",
"prop-types": "^15.6.0",
"react": "16.0.0",
"react-native": "0.50.1",
"react-moment": "^0.6.5",
"react-native-camera": "^0.10.0",
"react-native-elements": "^0.17.0",
"react-native-event-listeners": "^1.0.3",
"react-native-i18n": "^2.0.8",
"react-native-phone-call": "^1.0.4",
"react-native-secure-key-store": "^1.0.7",
"react-native-splash-screen": "^3.0.1",
"react-native-vector-icons": "^4.4.2",
"react-navigation": "^1.0.0-beta.15"
},
"devDependencies": {
"babel-jest": "21.2.0",
"babel-preset-react-native": "4.0.0",
"jest": "21.2.1",
"react-test-renderer": "16.0.0"
},
"jest": {
"preset": "react-native"
}
}

Do you have any idea?
Thanks for your help.

TypeError: null is not an object (evaluating '_reactNativeSecureKeyStore.default.set')

Android: Getting success result on store; getting empty string on fetch

  • Works perfectly on iOS
  • Getting this behaviour both on an Emulator and on an actual device
  • My account is logged in to my google account
  • When calling the set function with my string value the success callback is getting called; when calling the get with the appropriate key I get an empty string

Any idea?

Using sharedPreferences instead of Storage and using KeyGenParameterSpec for later versions of Android

Hi @pradeep1991singh , Thanks for the awesome project.

Sorry for opening this as an issue. Could you let us know why we are using Storage and creating files to store keys instead of storing them in shared preferences in private mode?

Also regarding the usage of KeyPairGeneratorSpec, since it is deprecated are you planning to use KeyGenParameterSpec for later versions of android (M+). I can submit a PR if you want me to.

Example app is not building

In PR #61, the old android support libraries were switched to AndroidX. This is causing a build issue with the example app on Android.

Technically, the library itself should probably list implementation "androidx.annotation:annotation:1.0.0" in its build.gradle, since it is used in code, but this PR does not address that.

error: cannot find symbol
import androidx.annotation.Nullable;
                          ^
  symbol:   class Nullable
  location: package androidx.annotation
react-native-secure-key-store/example/node_modules/react-native-secure-key-store/android/src/main/java/com/reactlibrary/securekeystore/RNSecureKeyStoreModule.java:57: error: cannot find symbol
  public void set(String alias, String input, @Nullable ReadableMap options, Promise promise) {
                                               ^
  symbol:   class Nullable
  location: class RNSecureKeyStoreModule
react-native-secure-key-store/example/node_modules/react-native-secure-key-store/android/src/main/java/com/reactlibrary/securekeystore/RNSecureKeyStoreModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
2 errors

FAILURE: Build failed with an exception.

Solution: Add android.useAndroidX=true & android.enableJetifier=true to gradle.properties in the example app.


Also, I was unable to build the example app with metro on both platforms:

error: bundling failed: Error: Unable to resolve module `react-native-secure-key-store` from `/snip/react-native-secure-key-store/example/App.js`: Module `react-native-secure-key-store` does not exist in the Haste module map

Solution: Add a metro.config.js file to the example, informing metro of the parent-directory path for the library.


I have made a PR to address the build issues.

Android Min Version

Version 1.0.7 increased Android Min version from 16 to 18.

There is a good reason for it?

Crashing on production mode

This happens if I build a release version of the application. API Level 26.

Any ideas why? Or is this normal?
Currently, the app just stays on the splashscreen, unable to continue.
App successfully runs if react-native-secure-key-store is removed.

image

Having issue with deleting

function getContacts() {
  return RNSecureKeyStore.get(KEY)
    .then(data => JSON.parse(data))
    .catch(e => []);
}

function deleteContact(id) {
  let contacts = [];
  return RNSecureKeyStore.remove(KEY);
}

I have a utility functions like those.

and in componentDidMount I do:

let ss = []
 Contacts.getContacts()
      .then(data => {
        console.log(data.length, "before delete");
        return Promise.resolve(data => Contacts.deleteContact(data.id));
      }).then(k => {
        ss = k;
        console.log(k.length, "success length");
        return Contacts.getContacts();
      })
      .then(d => {
        console.log(d.length, "after delete");
        if (d.length == ss.length) this.setState({ isReady: true });
      });

but the funny thing is idk why the remove doesn't work. after and before. the length remains the same. although. it says. success length is 1.

What is the issue?

I am on

    compileSdkVersion 23
    buildToolsVersion "23.0.1"

Testing on a android emulator.

not working on api level 22

image

log

02-22 17:34:07.991 5287-5363/com.medium.wallet.blockey W/System.err: java.lang.IllegalStateException: Can't generate certificate
        at android.security.AndroidKeyPairGenerator.generateKeyPair(AndroidKeyPairGenerator.java:136)
        at java.security.KeyPairGenerator$KeyPairGeneratorImpl.generateKeyPair(KeyPairGenerator.java:276)
        at com.reactlibrary.securekeystore.RNSecureKeyStoreModule.getOrCreatePublicKey(RNSecureKeyStoreModule.java:87)
        at com.reactlibrary.securekeystore.RNSecureKeyStoreModule.getOrCreateSecretKey(RNSecureKeyStoreModule.java:129)
        at com.reactlibrary.securekeystore.RNSecureKeyStoreModule.setCipherText(RNSecureKeyStoreModule.java:140)
        at com.reactlibrary.securekeystore.RNSecureKeyStoreModule.set(RNSecureKeyStoreModule.java:58)
        at java.lang.reflect.Method.invoke(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:372)
        at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
        at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:160)
        at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
        at android.os.Handler.handleCallback(Handler.java:739)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
        at android.os.Looper.loop(Looper.java:135)
        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:192)
        at java.lang.Thread.run(Thread.java:818)
    Caused by: java.lang.UnsupportedOperationException: private exponent cannot be extracted
        at com.android.org.conscrypt.OpenSSLRSAPrivateKey.getPrivateExponent(OpenSSLRSAPrivateKey.java:161)
        at org.bouncycastle.jcajce.provider.asymmetric.rsa.RSAUtil.generatePrivateKeyParameter(Unknown Source)
        at org.bouncycastle.jcajce.provider.asymmetric.rsa.DigestSignatureSpi.engineInitSign(Unknown Source)

multiSet and multiGet feature

Is it possible to set/get multiple values in a single call/operation -- like in AsyncStorage? If not, any plans on implementing this feature?

Need RSA private or public key error

I am getting this error on Samsung Galaxy S8 Android device, for other Android devices, it works.
This error occurs while either setting or getting the key stored in Keystore.
following is my code -

code to set key

exports.SET_KEY = (randomKey) => {
RNSecureKeyStore.set(KEY_STORE_KEYNAME, randomKey)
.then((res) => {
console.log(res);
}, (err) => {
console.log("SET_KEY",err);
});
}

code to get key

exports.GET_KEY = (success, fail) => {
RNSecureKeyStore.get(KEY_STORE_KEYNAME)
.then((res) => {
console.log(res);
success(res)
}, (err) => {
console.log('GET_KEY', err);
fail(KEY_NOT_FOUND)
});
}

I am getting error as,

Error: {"code":9,"api-level":26,"message":Need RSA private or public key}
at createErrorFromErrorData (NativeModules.js:146)
at NativeModules.js:95
at MessageQueue.__invokeCallback (MessageQueue.js:397)
at MessageQueue.js:127
at MessageQueue.__guard (MessageQueue.js:297)
at MessageQueue.invokeCallbackAndReturnFlushedQueue (MessageQueue.js:126)
at debuggerWorker.js:72

Hardware Backing

I'm looking for a react native module for wrapping the hardware backed features of iOS and Android.

Basically, I want to write a RN PoC that uses secure enclave and keystore to generate nonextractable keys and sign some data.

My understanding of this library is that it is only for extractable key management. Is that correct?

Can you point me in the right direction for what I am looking for?

I was able to get everything working. Thanks for this awesome library.

New deploy needed please

I see commits have been merged to master in the last couple of months, but no new deploy to NPM has occurred for 9 months. This means the ACCESSIBLE enum is not available from NPM. Please deploy to npm!

RNSecureKeyStoreMock

I've been unsuccessful at attempting to use RNSecureKeyStoreMock for Jest. Are there any recommended steps?

Build issue related to createJSModules()

We are using react-native version 0.44. I see build errors when using "react-native-secure-key-store": "^1.0.8". Getting errors related to createJSModules() in this library.
Below is the compilation attribute for your reference. Let us know how to resolve this. We do not want to upgrade the React-native version considering other packages used.

react-native-secure-key-store:preBuild UP-TO-DATE
:react-native-secure-key-store:preReleaseBuild UP-TO-DATE
:react-native-secure-key-store:checkReleaseManifest
:react-native-secure-key-store:preDebugAndroidTestBuild UP-TO-DATE
:react-native-secure-key-store:preDebugBuild UP-TO-DATE
:react-native-secure-key-store:preDebugUnitTestBuild UP-TO-DATE
:react-native-secure-key-store:preReleaseUnitTestBuild UP-TO-DATE
:react-native-secure-key-store:prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE
:react-native-secure-key-store:prepareComAndroidSupportSupportV42301Library UP-TO-DATE
:react-native-secure-key-store:prepareComFacebookFbuiTextlayoutbuilderTextlayoutbuilder100Library UP-TO-DATE
:react-native-secure-key-store:prepareComFacebookFrescoDrawee101Library UP-TO-DATE
:react-native-secure-key-store:prepareComFacebookFrescoFbcore101Library UP-TO-DATE
:react-native-secure-key-store:prepareComFacebookFrescoFresco101Library UP-TO-DATE
:react-native-secure-key-store:prepareComFacebookFrescoImagepipeline101Library UP-TO-DATE
:react-native-secure-key-store:prepareComFacebookFrescoImagepipelineBase101Library UP-TO-DATE
:react-native-secure-key-store:prepareComFacebookFrescoImagepipelineOkhttp3101Library UP-TO-DATE
:react-native-secure-key-store:prepareComFacebookReactReactNative0440Library UP-TO-DATE
:react-native-secure-key-store:prepareComFacebookSoloaderSoloader010Library UP-TO-DATE
:react-native-secure-key-store:prepareOrgWebkitAndroidJscR174650Library UP-TO-DATE
:react-native-secure-key-store:prepareReleaseDependencies
:react-native-secure-key-store:compileReleaseAidl UP-TO-DATE
:react-native-secure-key-store:compileReleaseNdk UP-TO-DATE
:react-native-secure-key-store:compileLint UP-TO-DATE
:react-native-secure-key-store:copyReleaseLint UP-TO-DATE
:react-native-secure-key-store:compileReleaseRenderscript UP-TO-DATE
:react-native-secure-key-store:generateReleaseBuildConfig UP-TO-DATE
:react-native-secure-key-store:generateReleaseResValues UP-TO-DATE
:react-native-secure-key-store:generateReleaseResources UP-TO-DATE
:react-native-secure-key-store:mergeReleaseResources UP-TO-DATE
:react-native-secure-key-store:processReleaseManifest UP-TO-DATE
:react-native-secure-key-store:processReleaseResources UP-TO-DATE
:react-native-secure-key-store:generateReleaseSources UP-TO-DATE
:react-native-secure-key-store:incrementalReleaseJavaCompilationSafeguard UP-TO-DATE
:react-native-secure-key-store:compileReleaseJavaWithJavac
:react-native-secure-key-store:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution,
etc.).
C:\BitBucket\Dec16\node_modules\react-native-secure-key-store\android\src\main\java\com\reactlibrary\securekeystore\RNSecureKeyStor
ePackage.java:18: error: RNSecureKeyStorePackage is not abstract and does not override abstract method createJSModules() in ReactPa
ckage
public class RNSecureKeyStorePackage implements ReactPackage {
^
Note: C:\BitBucket\Dec16\node_modules\react-native-secure-key-store\android\src\main\java\com\reactlibrary\securekeystore\RNSecureK
eyStoreModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error
:react-native-secure-key-store:compileReleaseJavaWithJavac FAILED

setResetOnAppUninstallTo

This is being set to YES on first instantiation of the class. I delete the app, and put a breakpoint on handleAppUninstallation and I can see my data, but then it gets deleted.

Typechecking issue in consuming project

Was experiencing this with typescript 3.7.3, but also just confirmed that this happens on latest 3.8.2 as well.


../node_modules/react-native-secure-key-store/index.d.ts:2:29 - error TS1254: A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.

  2   export const ACCESSIBLE = {
                                ~
  3     AFTER_FIRST_UNLOCK: 'AccessibleAfterFirstUnlock',
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
 11     WHEN_UNLOCKED_THIS_DEVICE_ONLY: 'AccessibleWhenUnlockedThisDeviceOnly',
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 12   }
    ~~~

../node_modules/react-native-secure-key-store/index.d.ts:16:52 - error TS2749: 'ACCESSIBLE' refers to a value, but is being used as a type here.

16     set: (key: string, value: string, accessible?: ACCESSIBLE) => Promise<any>
                                                      ~~~~~~~~~~


Found 2 errors.

As a workaround, the consuming project can specify "skipLibCheck": true in their tsconfig.json.

I plan to make a PR -- wanted to record the error here.

Publishing new version 1.0.9 to npm

Hi,
Since the last fix for the Xiaomi Redmi Note 4 we bumped the version from 1.0.8 to 1.0.9 and in the NPM repository it is still pointing to the 1.0.8.

Can you please publish the new version to NPM?

Thanks,
Eran

Size limit on Android

Hi is there size limit for android? Because i want to send this string to storage but on the other side doesn't show anything.

...
const text = 'E0cSGRsAAB0YBgsEBwk/GgoVBQMNR0kXTQsJGgkBHCw3TlVKMhIBWDkuITkbLVEqCFpbJAJVGwYdClobB1E2IAo8UDJOQ0oXHAAKSl9RCAALERweTURHFgEOAQksGgoaDBUFCgxHSQoOBBYWQE0NCBIFA0pfUQ0LBQwdLA4MCBoCQQsKHk5DShUaDxsdFxZOVUoNBxgfG19cQxxGAgENGQkREh5BCwoeQw4eBAcNHUdTRwleCl0XX1sOUUFZC1lcFl0KDVcWDVhaVkUIXFhXS1McVVFLXEkaWAMLSQxYGxgbGBZWXy5NVzVJXS4GFwJBCRAHBF9GBhwBSlojEhoOHAQBH0paIxIIQRgLFE5DShAACR0hAVFWTQkQBwRfFFBKXQlYXBBaXgwHFw5ZWwcRVFhQBxcJWEpJUQ8dDQQHCQspEVFWTVpVQltCWFBeXVY8VEZWX11fR15BUFZENk1ERxoICgYRGhgGDRZRVjQTRwADDAEEH05VDgQfHwpERxADAQYAEBgGBwtRVk09FhYeAQkIFkE/CRYAGwAaAV4tGhwNFgIbAQYSGAYHC1FATRgXHBoGDAABTlVKBAYYB1hHX04aGwABJQtKX1FZVlkDQ1UMXlQXDgsKU0AODVBSSw4LDVJRETJERx0NAg1HSU4ODAgaAi8JAR4FAUYGHAFNREcdBQwDCxIBCkpfUQ0LBQwdTkNKAh8DDQkJLA8DAQAdGDABAVFWTTtdSwI7IjYqWQwqBixZFyEHG1QtGgQWKwMkUgFUWRkIUUBNHRYWHiINERIIDhwEUVYUSgAeDQYER0lODRIfCRYVSklRHgAEAFFWTQAKBQkLB0cOQE0JFQMhChwEFw0bCUdJF00aCh8JTVJHFwMMHAoBThJERwYcCwkRFggwCRFRVk1aVUJbQlhTXl1cPFREVlxaX0BfQVlWQDZNFUlRCRcYDAEJHEpfUV1WX1VeXF5FVEs4X19fRlpVXVRdXVpbP1FATRwcAwlNUkcRCQ4aAAFOQ0oXFgodDRYbOAADAB1OVUo9BhoeXy0XNjdQLQteGxI1H1s1LQNEVVoJCDQCKVwRP1sBRVA1NCwfNgMfVjtHX04GDDEcBwoGR0lOChEvQwk3KQw8BSUjM0I9BiQmOQQNLwYaIwYiLCYWJlkrGiZWRgAKJh8LVj4FIAEvHAgnOhIQFgAeKUEmXgsIHwQNBTMBDQZdCRc/WgABKz4AJSZGBg1aVQUlBh8MEF85ASwZAwYxPSVcDiwnSyI7Ax0pBi5dPAk1FzIiOQc2AjwJNQIhUT0WBwE/NDlcIQwEBTYwMxglBQcMJV4pHCtCKiM9CSVcPTw3KTYrPR8iNCpdATRZWw0xKVwNEjc1OCg+MD05KgEpMCYDDS0yBSACIEMjOwtVPjgqECsnIRwhCB8ECyssRSE7OVA9FiJbKycpXiVWQ0IJPyxCCys/DgojIy4TPwYeRRU4NSQwUSwaDCRcC1hdWAosNj0ZKx8LBlAWUUBNCQYQCRwbMRwHCgZHSU4XKyQZFgokLgsYFw43QRpCShg';

  RNSecureKeyStore.set(KEY_DATA, text).catch((errors) => {
    console.log("ERRROR: ", errors);
  });
...

And i didn't get any error ... can you help me? On ios its work fine...

Security risk

Affected files:
react-native-secure-key-store/example/ios/example-tvOS/Info.plist
react-native-secure-key-store/example/ios/example/Info.plist
1: <?xml version="1.0" encoding="UTF-8"?>

Risks:
ATS prevents accidental disclosures, provides secure default behavior, and is easy to adopt.
App Transport Security (ATS) enforces best practices in the secure connections between an app and its back end.

Failed to obtain information about private key

Issue

Getting the following error on RNSecureKeyStore.set(key, value, options) call:

{"code":9,"api-level":27,"message":Failed to obtain information about private key}

Device

Android simulator Nexus 4 Android version 8.1 (API level 27) x86

Public Key expiration date

Why are you setting a end date for the key?

KeyPairGeneratorSpec spec = new KeyPairGeneratorSpec.Builder(getContext())
.setAlias(alias)
.setSubject(new X500Principal("CN=" + alias))
.setSerialNumber(BigInteger.ONE)
.setStartDate(start.getTime())
.setEndDate(end.getTime()).build();

How to handle it once it expires?

cannot read the property set undefined

I am getting error "cannot read the property set undefined" . when calling

RNSecureKeyStore.set("key1", "value1")
.then((res) => {
	console.log(res);
}, (err) => {
	console.log(err);
});

My RN version is
"react-native": "0.46.4",
"react-native-secure-key-store": "^1.0.5",
But the issue still existing, after running:
react-native link
react-native run-ios.Please give any tips for solving problem

Key is visible

Since, I am new to this, I have a query about visible key.
Your usage code:

RNSecureKeyStore.set("key1", "value1")
	.then((res) => {
		console.log(res);
	}, (err) => {
		console.log(err);
	});

Is not the "value1" key visible in the source code? How can it be secure? It is said it's bad practice to put the key value in the source code. It is said it can decompiled and derive the key or something. Or Am I Missing something? Thankyou

Keystore not working for android

screen shot 2018-03-28 at 12 08 35

Keep getting this error on android: Failed to load generated key pair from keystore. This is when I try and write to key store

[Android] Error while finalizing cipher

On android I receive this error while calling the get function. RNSecureKeyStore is defined.

{"code":1,"api-level":23,"message":Error while finalizing cipher}

Versions

"react": "16.0.0-alpha.12"
"react-native": "0.47.2"

Android 6.0

android not compiling even example app

He @pradeep1991singh

I have the following in my app, and from example app android doesn't compile
"react": "16.0.0-alpha.6",
"react-native": "0.44.0",

what is the min required versions of react and react-native, I don't see that in the actual package.json checked in of the base build, it's in the example.

:react-native-secure-key-store:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
/Users/h267226/work/react-native-secure-key-store/example/node_modules/react-native-secure-key-store/android/src/main/java/com/reactlibrary/securekeystore/RNSecureKeyStorePackage.java:18: error: RNSecureKeyStorePackage is not abstract and does not override abstract method createJSModules() in ReactPackage
public class RNSecureKeyStorePackage implements ReactPackage {
^
Note: /Users/h267226/work/react-native-secure-key-store/example/node_modules/react-native-secure-key-store/android/src/main/java/com/reactlibrary/securekeystore/RNSecureKeyStoreModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error
:react-native-secure-key-store:compileReleaseJavaWithJavac FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':react-native-secure-key-store:compileReleaseJavaWithJavac'.

Compilation failed; see the compiler error output for details.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

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.