Giter VIP home page Giter VIP logo

react-native-keychain's Introduction

react-native-keychain

Travis npm npm

Keychain/Keystore Access for React Native

Installation

  1. Run yarn add react-native-keychain

    1 a. Only for React Native <= 0.59: $ react-native link react-native-keychain and check MainApplication.java to verify the package was added. See manual installation below if you have issues with react-native link.

  2. Run pod install in ios/ directory to install iOS dependencies.

  3. If you want to support FaceID, add a NSFaceIDUsageDescription entry in your Info.plist.

  4. Re-build your Android and iOS projects.

Usage

import * as Keychain from 'react-native-keychain';

async () => {
  const username = 'zuck';
  const password = 'poniesRgr8';

  // Store the credentials
  await Keychain.setGenericPassword(username, password);

  try {
    // Retrieve the credentials
    const credentials = await Keychain.getGenericPassword();
    if (credentials) {
      console.log(
        'Credentials successfully loaded for user ' + credentials.username
      );
    } else {
      console.log('No credentials stored');
    }
  } catch (error) {
    console.log("Keychain couldn't be accessed!", error);
  }
  await Keychain.resetGenericPassword();
};

See KeychainExample for fully working project example.

Both setGenericPassword and setInternetCredentials are limited to strings only, so if you need to store objects etc, please use JSON.stringify/JSON.parse when you store/access it.

API

setGenericPassword(username, password, [{ accessControl, accessible, accessGroup, service, securityLevel }])

Will store the username/password combination in the secure storage. Resolves to {service, storage} or rejects in case of an error. storage - is a name of used internal cipher for saving secret; service - name used for storing secret in internal storage (empty string resolved to valid default name).

getGenericPassword([{ authenticationPrompt, service, accessControl }])

Will retrieve the username/password combination from the secure storage. Resolves to { username, password, service, storage } if an entry exists or false if it doesn't. It will reject only if an unexpected error is encountered like lacking entitlements or permission.

resetGenericPassword([{ service }])

Will remove the username/password combination from the secure storage. Resolves to true in case of success.

getAllGenericPasswordServices()

Will retrieve all known service names for which a generic password has been stored (e.g., setGenericPassword).

Note: on iOS this will actully read the encrypted entries, so it will trigger an authentication UI if you have encrypted any entries with password/biometry.

setInternetCredentials(server, username, password, [{ accessControl, accessible, accessGroup, securityLevel }])

Will store the server/username/password combination in the secure storage. Resolves to { username, password, service, storage };

hasInternetCredentials(server)

Will check if the username/password combination for server is available in the secure storage. Resolves to true if an entry exists or false if it doesn't.

getInternetCredentials(server, [{ authenticationPrompt }])

Will retrieve the server/username/password combination from the secure storage. Resolves to { username, password } if an entry exists or false if it doesn't. It will reject only if an unexpected error is encountered like lacking entitlements or permission.

resetInternetCredentials(server)

Will remove the server/username/password combination from the secure storage.

requestSharedWebCredentials() (iOS and visionOS only)

Asks the user for a shared web credential. Requires additional setup both in the app and server side, see Apple documentation. Resolves to { server, username, password } if approved and false if denied and throws an error if not supported on platform or there's no shared credentials.

setSharedWebCredentials(server, username, password) (iOS and visionOS only)

Sets a shared web credential. Resolves to true when successful.

canImplyAuthentication([{ authenticationType }]) (iOS and visionOS only)

Inquire if the type of local authentication policy is supported on this device with the device settings the user chose. Should be used in combination with accessControl option in the setter functions. Resolves to true if supported.

getSupportedBiometryType()

On iOS and visionOS: Get what type of hardware biometry support the device can use for biometric encryption. Resolves to a Keychain.BIOMETRY_TYPE value when supported and enrolled, otherwise null.

On Android: Get what type of Class 3 (strong) biometry support the device has. Resolves to a Keychain.BIOMETRY_TYPE value when supported, otherwise null. In most devices this will return FINGERPRINT (except for Pixel 4 or similar where fingerprint sensor is not present).

This method returns null, if the device haven't enrolled into fingerprint/FaceId. Even though it has hardware for it.

getSecurityLevel([{ accessControl }]) (Android only)

Get security level that is supported on the current device with the current OS. Resolves to Keychain.SECURITY_LEVEL enum value.

Options

Data Structure Properties/Fields

Key Platform Description Default
accessControl All This dictates how a keychain item may be used, see possible values in Keychain.ACCESS_CONTROL. None
accessible iOS, visionOS This dictates when a keychain item is accessible, see possible values in Keychain.ACCESSIBLE. Keychain.ACCESSIBLE.WHEN_UNLOCKED
accessGroup iOS, visionOS In which App Group to share the keychain. Requires additional setup with entitlements. None
authenticationPrompt All What to prompt the user when unlocking the keychain with biometry or device password. See authenticationPrompt Properties
authenticationType iOS, visionOS Policies specifying which forms of authentication are acceptable. Keychain.AUTHENTICATION_TYPE.DEVICE_PASSCODE_OR_BIOMETRICS
service All Reverse domain name qualifier for the service associated with password. App bundle ID
storage Android only Force specific cipher storage usage during saving the password Select best available storage
rules Android only Force following to a specific security rules Keychain.RULES.AUTOMATIC_UPGRADE
authenticationPrompt Properties
Key Platform Description Default
title All Title of the authentication prompt when requesting a stored secret. Authenticate to retrieve secret
subtitle Android only Subtitle of the Android authentication prompt when requesting a stored secret. None. Optional
description Android only Description of the Android authentication prompt when requesting a stored secret. None. Optional
cancel Android only Negative button text of the Android authentication prompt when requesting a stored secret. Cancel

Keychain.ACCESS_CONTROL enum

Key Description
USER_PRESENCE Constraint to access an item with either Touch ID or passcode.
BIOMETRY_ANY Constraint to access an item with Touch ID for any enrolled fingers.
BIOMETRY_CURRENT_SET Constraint to access an item with Touch ID for currently enrolled fingers.
DEVICE_PASSCODE Constraint to access an item with a passcode.
APPLICATION_PASSWORD Constraint to use an application-provided password for data encryption key generation.
BIOMETRY_ANY_OR_DEVICE_PASSCODE Constraint to access an item with Touch ID for any enrolled fingers or passcode.
BIOMETRY_CURRENT_SET_OR_DEVICE_PASSCODE Constraint to access an item with Touch ID for currently enrolled fingers or passcode.

Note #1: BIOMETRY_ANY, BIOMETRY_CURRENT_SET, BIOMETRY_ANY_OR_DEVICE_PASSCODE, BIOMETRY_CURRENT_SET_OR_DEVICE_PASSCODE - recognized by Android as a requirement for Biometric enabled storage (Till we got a better implementation);

Note #2: For Android we support only two states: None (default) and Fingerprint (use only biometric protected storage); Face recognition fails with "User not authenticated" exception, see issue #318

Refs:

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.

Refs:

Keychain.AUTHENTICATION_TYPE enum

Key Description
DEVICE_PASSCODE_OR_BIOMETRICS Device owner is going to be authenticated by biometry or device passcode.
BIOMETRICS Device owner is going to be authenticated using a biometric method (Touch ID or Face ID).

Refs:

Keychain.BIOMETRY_TYPE enum

Key Description
TOUCH_ID Device supports authentication with Touch ID. (iOS only)
FACE_ID Device supports authentication with Face ID. (iOS only)
OPTIC_ID Device supports authentication with Optic ID. (visionOS only)
FINGERPRINT Device supports authentication with Fingerprint. (Android only)
FACE Device supports authentication with Face Recognition. (Android only)
IRIS Device supports authentication with Iris Recognition. (Android only)

Refs:

Keychain.SECURITY_LEVEL enum (Android only)

If set, securityLevel parameter specifies minimum security level that the encryption key storage should guarantee for storing credentials to succeed.

Key Description
ANY no security guarantees needed (default value); Credentials can be stored in FB Secure Storage;
SECURE_SOFTWARE requires for the key to be stored in the Android Keystore, separate from the encrypted data;
SECURE_HARDWARE requires for the key to be stored on a secure hardware (Trusted Execution Environment or Secure Environment). Read this article for more information.

Keychain.STORAGE_TYPE enum (Android only)

Key Description
FB Facebook compatibility cipher
AES Encryptions without human interaction.
RSA Encryption with biometrics.

Keychain.SECURITY_RULES enum (Android only)

Key Description
NONE No rules. Be dummy, developer control everything
AUTOMATIC_UPGRADE Upgrade secret to the best available storage as soon as it is available and user request secret extraction. Upgrade not applied till we request the secret. This rule only applies to secrets stored with FacebookConseal.

Important Behavior

Rule 1: Automatic Security Level

As a rule the library will try to apply the best possible encryption for storing secrets. Once the secret is stored however its does not try to upgrade it unless FacebookConseal was used and the option 'SECURITY_RULES' is set to 'AUTOMATIC_UPGRADE'


Q: What will happen if user disables/drops biometric usage?

A: User will lose ability to extract secret from storage. On re-enable biometric access to the secret will be possible again.


Q: Is it possible to implement automatic downgrading?

A: From security perspective any Automatic downgrading is treated as "a loss of the trust" point. Developer should implement own logic to allow downgrade and deal with "security loss". (My recommendation - never do that!)


Q: How to enable automatic upgrade for FacebookConseal?

A: Do call getGenericPassword({ ...otherProps, rules: "AUTOMATIC_UPGRADE" }) with extra property rules set to AUTOMATIC_UPGRADE string value.


Q: How to force a specific level of encryption during saving the secret?

A: Do call setGenericPassword({ ...otherProps, storage: "AES" }) with forced storage.

Note: attempt to force storage RSA when biometrics is not available will force code to reject call with errors specific to device biometric configuration state.

Manual Installation

iOS

Option: Manually

  • Right click on Libraries, select Add files to "…" and select node_modules/react-native-keychain/RNKeychain.xcodeproj
  • Select your project and under Build Phases -> Link Binary With Libraries, press the + and select libRNKeychain.a.
  • make sure pod 'RNKeychain' is not in your Podfile

Option: With CocoaPods

Add the following to your Podfile and run pod update:

pod 'RNKeychain', :path => '../node_modules/react-native-keychain'

Enable Keychain Sharing entitlement for iOS 10+

For iOS 10 you'll need to enable the Keychain Sharing entitlement in the Capabilities section of your build target. (See screenshot). Otherwise you'll experience the error shown below.

screen shot 2016-09-16 at 20 56 33

Error: {
  code = "-34018";
  domain = NSOSStatusErrorDomain;
  message = "The operation couldn\U2019t be completed. (OSStatus error -34018.)";
}

Android

Option: Manually

  • Edit android/settings.gradle to look like this (without the +):
rootProject.name = 'MyApp'

include ':app'

+ include ':react-native-keychain'
+ project(':react-native-keychain').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-keychain/android')
  • Edit android/app/build.gradle (note: app folder) to look like this:
apply plugin: 'com.android.application'

android {
  ...
}

dependencies {
  implementation fileTree(dir: 'libs', include: ['*.jar'])
  implementation 'com.android.support:appcompat-v7:23.0.1'
  implementation 'com.facebook.react:react-native:0.19.+'
+ implementation project(':react-native-keychain')
}
  • Edit your MainApplication.java (deep in android/app/src/main/java/...) to look like this (note two places to edit):
package com.myapp;

+ import com.oblador.keychain.KeychainPackage;

....

public class MainActivity extends extends ReactActivity {

  @Override
  protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
              new MainReactPackage(),
+             new KeychainPackage()
      );
  }
  ...
}

Proguard Rules

On Android builds that use proguard (like release), you may see the following error:

RNKeychainManager: no keychain entry found for service:
JNI DETECTED ERROR IN APPLICATION: JNI FindClass called with pending exception java.lang.NoSuchFieldError: no "J" field "mCtxPtr" in class "Lcom/facebook/crypto/cipher/NativeGCMCipher;" or its superclasses

If so, add a proguard rule in proguard-rules.pro:

-keep class com.facebook.crypto.** {
   *;
}

Unit Testing with Jest

The keychain manager relies on interfacing with the native application itself. As such, it does not successfully compile and run in the context of a Jest test, where there is no underlying app to communicate with. To be able to call the JS functions exposed by this module in a unit test, you should mock them in one of the following two ways:

First, let's create a mock object for the module:

const keychainMock = {
  SECURITY_LEVEL_ANY: "MOCK_SECURITY_LEVEL_ANY",
  SECURITY_LEVEL_SECURE_SOFTWARE: "MOCK_SECURITY_LEVEL_SECURE_SOFTWARE",
  SECURITY_LEVEL_SECURE_HARDWARE: "MOCK_SECURITY_LEVEL_SECURE_HARDWARE",
  setGenericPassword: jest.fn().mockResolvedValue(),
  getGenericPassword: jest.fn().mockResolvedValue(),
  resetGenericPassword: jest.fn().mockResolvedValue(),
  ...
}

Using a Jest __mocks__ Directory

  1. Read the jest docs for initial setup

  2. Create a react-native-keychain folder in the __mocks__ directory and add index.js file in it. It should contain the following code:

export default keychainMock;

Using a Jest Setup File

  1. In your Jest config, add a reference to a setup file

  2. Inside your setup file, set up mocking for this package:

jest.mock('react-native-keychain', () => keychainMock);

Now your tests should run successfully, though note that writing and reading to the keychain will be effectively a no-op.

Notes

Android Notes

The module will automatically use the appropriate CipherStorage implementation based on API level:

  • API level 16-22 will en/de crypt using Facebook Conceal
  • API level 23+ will en/de crypt using Android Keystore

Encrypted data is stored in SharedPreferences.

The setInternetCredentials(server, username, password) call will be resolved as call to setGenericPassword(username, password, server). Use the server argument to distinguish between multiple entries.

Configuring the Android-specific behavior

Android implementation has behavioural specifics incurred by existing inconsistency between implementations by different vendors. E.g., some Samsung devices show very slow startup of crypto system. To alleviate this, a warm-up strategy is introduced in Android implementation of this library.

Using default constructor you get default behaviour, i.e. with the warming up on.

    private List<ReactPackage> createPackageList() {
      return Arrays.asList(
        ...
        new KeychainPackage(),  // warming up is ON
        ...
      )

Those who want finer control are required to use constructor with a builder which can be configured as they like:

    private List<ReactPackage> createPackageList() {
      return Arrays.asList(
        ...
        new KeychainPackage(
                new KeychainModuleBuilder()
                        .withoutWarmUp()),   // warming up is OFF
        ...
      )

iOS Notes

If you need Keychain Sharing in your iOS extension, make sure you use the same App Group and Keychain Sharing group names in your Main App and your Share Extension. To then share the keychain between the Main App and Share Extension, use the accessGroup and service option on setGenericPassword and getGenericPassword, like so: getGenericPassword({ accessGroup: 'group.appname', service: 'com.example.appname' })

Refs:

macOS Catalyst

This package supports macOS Catalyst.

visionOS

This package supports visionOS.

Security

On API levels that do not support Android keystore, Facebook Conceal is used to en/decrypt stored data. The encrypted data is then stored in SharedPreferences. Since Conceal itself stores its encryption key in SharedPreferences, it follows that if the device is rooted (or if an attacker can somehow access the filesystem), the key can be obtained and the stored data can be decrypted. Therefore, on such a device, the conceal encryption is only an obscurity. On API level 23+ the key is stored in the Android Keystore, which makes the key non-exportable and therefore makes the entire process more secure. Follow best practices and do not store user credentials on a device. Instead use tokens or other forms of authentication and re-ask for user credentials before performing sensitive operations.

Android Security Framework

Maintainers


Joel Arvidsson

Author

Vojtech Novak

Maintainer

Pelle Stenild Coltau

Maintainer

Oleksandr Kucherenko

Contributor

For Developers / Contributors

License

MIT © Joel Arvidsson 2016-2020

react-native-keychain's People

Contributors

aeirola avatar androideveloper avatar ashoat avatar compojoom avatar dependabot[bot] avatar friederbluemle avatar john-y-pazekha avatar levibuzolic avatar louiszawadzki avatar mandev6000 avatar markdaws avatar mojotalantikite avatar mptorz avatar mtt87 avatar mvayngrib avatar oblador avatar oleksandrkucherenko avatar pcoltau avatar petekp avatar radko93 avatar rajivshah3 avatar rf1804 avatar rikschefferoberon avatar sgal avatar sheenanick avatar thiagobrez avatar thymikee avatar usrbowe avatar vascofg avatar vonovak 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  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

react-native-keychain's Issues

Suspicious code in getOptionsArgument

getOptionsArgument in index.js seems suspicious:

function getOptionsArgument(serviceOrOptions?: string | KeychainOptions) {
  if (Platform.OS !== 'ios') {
    return typeof serviceOrOptions === 'object' ? serviceOrOptions.service : serviceOrOptions;
  }

  return typeof serviceOrOptions === 'string' ? { service: serviceOrOptions } : serviceOrOptions;
}

On iOS it returns an options object creating it if a string is received, and vice versa on other platforms (returns a string, getting it from object if an object was received).

Is this intended?

question about android support

Thanks for this module, looks very useful.

If I store a password in the iOS keychain I understand it would get syncd via iCloud to my other devices (if i've turned that feature on).

Does the android implementation also sync the passwords across devices?

Android Crash within EncryptWithEntity

Device: sm_n900v100
OS : 4.3

Javascript Call:

const Keychain = require('react-native-keychain');
Keychain.setInternetCredentials(serverString, userString, passString)
...

Stack:

Fatal Exception: java.lang.RuntimeException: Could not invoke RNKeychainManager.setInternetCredentialsForServer
       at com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(BaseJavaModule.java:281)
       at com.facebook.react.bridge.NativeModuleRegistry$ModuleDefinition.call(NativeModuleRegistry.java:185)
       at com.facebook.react.bridge.NativeModuleRegistry.call(NativeModuleRegistry.java:64)
       at com.facebook.react.bridge.CatalystInstanceImpl$NativeModulesReactCallback.call(CatalystInstanceImpl.java:420)
       at com.facebook.react.bridge.queue.NativeRunnableDeprecated.run(NativeRunnableDeprecated.java)
       at android.os.Handler.handleCallback(Handler.java:730)
       at android.os.Handler.dispatchMessage(Handler.java:92)
       at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
       at android.os.Looper.loop(Looper.java:137)
       at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:187)
       at java.lang.Thread.run(Thread.java:841)
Caused by java.lang.reflect.InvocationTargetException
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:525)
       at com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(BaseJavaModule.java:268)
       at com.facebook.react.bridge.NativeModuleRegistry$ModuleDefinition.call(NativeModuleRegistry.java:185)
       at com.facebook.react.bridge.NativeModuleRegistry.call(NativeModuleRegistry.java:64)
       at com.facebook.react.bridge.CatalystInstanceImpl$NativeModulesReactCallback.call(CatalystInstanceImpl.java:420)
       at com.facebook.react.bridge.queue.NativeRunnableDeprecated.run(NativeRunnableDeprecated.java)
       at android.os.Handler.handleCallback(Handler.java:730)
       at android.os.Handler.dispatchMessage(Handler.java:92)
       at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
       at android.os.Looper.loop(Looper.java:137)
       at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:187)
       at java.lang.Thread.run(Thread.java:841)
Caused by java.lang.NoClassDefFoundError: java.nio.charset.StandardCharsets
       at com.oblador.keychain.KeychainModule.encryptWithEntity(KeychainModule.java:78)
       at com.oblador.keychain.KeychainModule.setGenericPasswordForService(KeychainModule.java:61)
       at com.oblador.keychain.KeychainModule.setInternetCredentialsForServer(KeychainModule.java:137)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:525)
       at com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(BaseJavaModule.java:268)
       at com.facebook.react.bridge.NativeModuleRegistry$ModuleDefinition.call(NativeModuleRegistry.java:185)
       at com.facebook.react.bridge.NativeModuleRegistry.call(NativeModuleRegistry.java:64)
       at com.facebook.react.bridge.CatalystInstanceImpl$NativeModulesReactCallback.call(CatalystInstanceImpl.java:420)
       at com.facebook.react.bridge.queue.NativeRunnableDeprecated.run(NativeRunnableDeprecated.java)
       at android.os.Handler.handleCallback(Handler.java:730)
       at android.os.Handler.dispatchMessage(Handler.java:92)
       at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
       at android.os.Looper.loop(Looper.java:137)
       at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:187)
       at java.lang.Thread.run(Thread.java:841)```

Not issue but question about the error mentioned at README

Hey guys thanks for this awesome library.
I am facing some issues on user side which I am unable to reproduce on my side.
So I was exploring the set of problems related to keychain and was curious about this error:
Error: {
code = "-34018";
domain = NSOSStatusErrorDomain;
message = "The operation couldn\U2019t be completed. (OSStatus error -34018.)";
}
Could you please point me or tell me when (using which functions of the library)
such an error may occur, and when it will definitely not occur?
I don't understand keychain completely.

Unitesting error

I get the next error when running a npm test with Jest on the code:

`
SyntaxError: /Users/gelo/Documents/react/honeybook-mobile/node_modules/react-native-keychain/index.ios.js: Unexpected token (16:10)
14 | */
15 | setInternetCredentials: function(

16 | server: string,
| ^
17 | username: string,
18 | password: string,
19 | callback?: ?(error: ?Error) => void
at Parser.pp.raise (/Users/gelo/Documents/react/honeybook-mobile/node_modules/babylon/index.js:1425:13)
at Parser.pp.unexpected (/Users/gelo/Documents/react/honeybook-mobile/node_modules/babylon/index.js:2907:8)
at Parser.pp.expect (/Users/gelo/Documents/react/honeybook-mobile/node_modules/babylon/index.js:2901:33)
at Parser.pp.parseBindingList (/Users/gelo/Documents/react/honeybook-mobile/node_modules/babylon/index.js:1605:12)
at Parser.pp.parseFunctionParams (/Users/gelo/Documents/react/honeybook-mobile/node_modules/babylon/index.js:2415:22)
at Parser.pp.parseFunction (/Users/gelo/Documents/react/honeybook-mobile/node_modules/babylon/index.js:2405:8)
at Parser.pp.parseFunctionExpression (/Users/gelo/Documents/react/honeybook-mobile/node_modules/babylon/index.js:764:17)
at Parser.pp.parseExprAtom (/Users/gelo/Documents/react/honeybook-mobile/node_modules/babylon/index.js:726:19)
at Parser.pp.parseExprSubscripts (/Users/gelo/Documents/react/honeybook-mobile/node_modules/babylon/index.js:509:19)
at Parser.pp.parseMaybeUnary (/Users/gelo/Documents/react/honeybook-mobile/node_modules/babylon/index.js:489:19) `

How to check if a password is stored in keychain

I would like to check whether a password has already been saved in keychain. Is it possible to do this with the current API?

I'm am currently doing it like this which feels a bit awkward:

try {
            //retrieve the credentials from keychain if saved.
            let credentials = await Keychain.getGenericPassword()
            if (credentials) //do something
            else //show error
        }
        catch(err) {
            if(err.message !== 'No keychain entry found') //No password exists in the key chain...
            else //some other error occurred.
        }

Do you have suggestion how I could check if a keychain entry exists?

weird issue in promise

Hello, I'm see a very weird issue.

Keychain.getGenericPassword().
.then(cred => { this.setState(A) })
.catch(error) { this.setState(B) }

When this.setState(A), my component will re-render something, now, if during rendering, any error happens, catch will fire and setState(B) will fire.

Is it a real issue? My understand is that setState(B) will only fire when there's no generic password. This issue is masking the real problem, for example, when rendering a component with wrong style, it just silently fail and fire setState(B).

Xcode 6.4 support?

I'm using this module pretty much exactly like the readme example:

However, I never hit the promise, and never see 'Credentials saved successfully!' logged. I'm using Xcode 6.4. Am I missing something?

SDK Build Tools revision (23.0.1) is too low for project :react-native-keychain.

Hey there,

that might be a noobish question but I get the following error:

* What went wrong:

    A problem occurred configuring project ':app'.

    > Could not resolve all dependencies for configuration ':app:_debugApk'.

       > A problem occurred configuring project ':react-native-keychain'.

          > The SDK Build Tools revision (23.0.1) is too low for project ':react-native-keychain'. Minimum required is 25.0.0

app/build.gradle

android {
compileSdkVersion 25
    buildToolsVersion "25.0.0"
    defaultConfig {
        applicationId 'com.blablaapp.app.android'
        minSdkVersion 16
        targetSdkVersion 22
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
        renderscriptTargetApi 20
        renderscriptSupportModeEnabled true
    }
...


dependencies {
        compile fileTree(include: ['*.jar'], dir: 'libs')
        compile 'com.android.support:appcompat-v7:25.0.0'
        compile 'com.facebook.react:react-native:+'
        // From node_modules
        compile project(':react-native-background-timer')
        compile project(':react-native-i18n')
        compile project(':react-native-keychain')
        compile project(':react-native-navigation')
        compile project(':react-native-vector-icons')
        compile project(':react-native-orientation')
        compile project(':react-native-linear-gradient')
        compile project(':bugsnag-react-native')
        compile project(':react-native-blur')
        compile project(':react-native-picker')
        compile project(':react-native-svg')
        compile project(':react-native-wheel-picker')
        compile project(':react-native-code-push')
        compile project(':instabug-reactnative')
        compile project(':react-native-maps')
        compile project(':react-native-firebase')
    }

Any ideas what might have went wrong?

Thank you!

TypeScript definitions

I've created a simple definition file for TypeScript:

declare module "react-native-keychain" {
  export interface ICredentials {
    username: string;
    password: string;
  }

  export default class Keychain {
    static getGenericPassword(service?: string): PromiseLike<ICredentials>;
    static resetGenericPassword(service?: string): PromiseLike<void>;
    static setGenericPassword(username: string, password: string, service?: string): PromiseLike<void>;

    static getInternetCredentials(server: string): PromiseLike<ICredentials>;
    static resetInternetCredentials(server): PromiseLike<void>;
    static setInternetCredentials(server: string, username: string, password: string): PromiseLike<void>;
  }
}

I'm not really sure where to store this. But might be useful for other people using this project.

When calling "getInternetCredentials" with a server param which does not exist throws error

In this case it does not even come to catch block of JS, because it stops at native side itself.

Line No 53-54 on RNKeychainManager.m
found = (__bridge NSDictionary*)(foundCF);
if (!found) return callback(@[[NSNull null]]);

Also if I add following line on top of these it throws some kind of JSON conversion error and stops their:
if (osStatus != 0) {
NSError *error = [NSError errorWithDomain:NSOSStatusErrorDomain code:osStatus userInfo:nil];
callback(@[error]);
}

Any idea?

Android support broken

Something odd must have happened during the commit squashing / merging process, because Android support is not working for the v0.3.0 release. iOS support works fine.

If I revert back to my branch git://github.com/codyhazelwood/react-native-keychain.git#8a2e5ab12aed2cfc5f4a23ffeec2dad56b017a48, everything works as expected.

Android Proguard

Hello! We are getting the following error after running our app through proguard. The proguard rules are unchanged from react-native init. It seems to be complaining about something to do with reflection - any ideas on how to solve?

05-17 13:19:22.299  3149  3169 E RNKeychainManager: no keychain entry found for service:
05-17 13:19:22.369  3149  3169 F art     : art/runtime/java_vm_ext.cc:410] JNI DETECTED ERROR IN APPLICATION: JNI FindClass called with pending exception java.lang.NoSuchFieldError: no "J" field "mCtxPtr" in class "Lcom/facebook/crypto/cipher/NativeGCMCipher;" or its superclasses
05-17 13:19:22.369  3149  3169 F art     : art/runtime/java_vm_ext.cc:410]   at java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.String) (Runtime.java:-2)
05-17 13:19:22.369  3149  3169 F art     : art/runtime/java_vm_ext.cc:410]   at java.lang.String java.lang.Runtime.doLoad(java.lang.String, java.lang.ClassLoader) (Runtime.java:435)
05-17 13:19:22.369  3149  3169 F art     : art/runtime/java_vm_ext.cc:410]   at void java.lang.Runtime.loadLibrary(java.lang.String, java.lang.ClassLoader) (Runtime.java:370)
05-17 13:19:22.369  3149  3169 F art     : art/runtime/java_vm_ext.cc:410]   at void java.lang.System.loadLibrary(java.lang.String) (System.java:1076)
05-17 13:19:22.369  3149  3169 F art     : art/runtime/java_vm_ext.cc:410]   at boolean com.facebook.crypto.util.SystemNativeCryptoLibrary.loadLibraries() (SystemNativeCryptoLibrary.java:50)
05-17 13:19:22.369  3149  3169 F art     : art/runtime/java_vm_ext.cc:410]   at void com.facebook.crypto.util.SystemNativeCryptoLibrary.ensureCryptoLoaded() (SystemNativeCryptoLibrary.java:39)
05-17 13:19:22.369  3149  3169 F art     : art/runtime/java_vm_ext.cc:410]   at boolean com.facebook.crypto.Crypto.isAvailable() (Crypto.java:54)
05-17 13:19:22.369  3149  3169 F art     : art/runtime/java_vm_ext.cc:410]   at void com.oblador.keychain.KeychainModule.setGenericPasswordForOptions(java.lang.String, java.lang.String, java.lang.String, com.facebook.react.bridge.Promise) (KeychainModule.java:48)
05-17 13:19:22.369  3149  3169 F art     : art/runtime/java_vm_ext.cc:410]   at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
05-17 13:19:22.369  3149  3169 F art     : art/runtime/java_vm_ext.cc:410]   at void com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(com.facebook.react.bridge.CatalystInstance, com.facebook.react.bridge.ExecutorToken, com.facebook.react.bridge.ReadableNativeArray) (BaseJavaModule.java:345)
05-17 13:19:22.369  3149  3169 F art     : art/runtime/java_vm_ext.cc:410]   at void com.facebook.react.cxxbridge.JavaModuleWrapper.invoke(com.facebook.react.bridge.ExecutorToken, int, com.facebook.react.bridge.ReadableNativeArray) (JavaModuleWrapper.java:136)
05-17 13:19:22.369  3149  3169 F art     : art/runtime/java_vm_ext.cc:410]   at void com.facebook.react.bridge.queue.NativeRunnable.run() (NativeRunnable.java:-2)
05-17 13:19:22.369  3149  3169 F art     : art/runtime/java_vm_ext.cc:410]   at void android.os.Handler.handleCallback(android.os.Message) (Handler.java:739)
05-17 13:19:22.369  3149  3169 F art     : art/runtime/java_vm_ext.cc:410]   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:95)
05-17 13:19:22.369  3149  3169 F art     : art/runtime/java_vm_ext.cc:410]   at void com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(android.os.Message) (MessageQueueThreadHandler.java:31)
05-17 13:19:22.370  3149  3169 F art     : art/runtime/java_vm_ext.cc:410]   at void android.os.Looper.loop() (Looper.java:148)
05-17 13:19:22.370  3149  3169 F art     : art/runtime/java_vm_ext.cc:410]   at void com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run() (MessageQueueThreadImpl.java:196)
05-17 13:19:22.370  3149  3169 F art     : art/runtime/java_vm_ext.cc:410]   at void java.lang.Thread.run() (Thread.java:818)

Undefined is not an object on iOS

Since upgrading to RN >0.40 I receive an error when trying to do Keychain.getGenericPassword()

The error retrieved is as follows;

{ [TypeError: undefined is not an object (evaluating '_reactNativeKeychain2.default.getGenericPassword')]
  line: 54495,
  column: 69,
  sourceURL: 'http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false' }

Which points to the following line in the generated bundle;

return regeneratorRuntime.awrap(_reactNativeKeychain2.default.getGenericPassword('jwt'));

it seems the column is pointing to the .default as being undefined.

The only thing that has changed is updating RN and react-native-keychain to latest versions.

Possible Unhandled Promise Rejection warning when trying to setGenericPassword

I run into this warning:
Possible Unhandled Promise Rejection (id: 0): undefined is not an object (evaluating 'RNKeychainManager.setGenericPasswordForService')
whenever I try to call setGenericPassword().

I've placed the code inside my login function which looks like this:

login(){
    if(this.state.username == "" || this.state.password == ""){
      AlertIOS.alert("Fel", "Vänligen fyll i alla fält.");
    }
    else{
      this.fade_view();
      this.setState({loading: true});
      this.loading_text = "Loggar in.."
      fetch(this.state.api_url, {
        method: "POST",
        headers: {
          'Accept': 'application/x-www-form-urlencoded',
          'Content-Type': 'application/x-www-form-urlencoded',
        },
        body: "v=1&function=franvaro&username=" + this.state.username + "&password=" + this.state.password,
      })
      .then((response) => response.json())
      .then((response) => {
        this.fade_view();
        this.setState({loading: false});
        if(JSON.stringify(response.body).replace(new RegExp('"', 'g'), '').match("INLOGGAD")){
          this.username = this.state.username; this.password = this.state.password;

          Keychain
          .setGenericPassword(this.state.username, this.state.password)
          .then(function() {
            AlertIOS.alert('ayylmao', 'Credentials saved successfully!');
          });

          this.fade_view();
          this.setState({logged_in: true});
          //AlertIOS.alert("Hej!", "Välkommen " + this.username + "!");
        }
        else{
          AlertIOS.alert(
              "Fel",
              JSON.stringify(response.body).replace(new RegExp('"', 'g'), '')
          );
        }
      })
      .catch((error) => {
        AlertIOS.alert("error: ", error);
      })
      .done();
    }
  }

If you don't want to go through that code then the keychain code looks like this:

Keychain
  .setGenericPassword(this.state.username, this.state.password)
  .then(function() {
  AlertIOS.alert('ayylmao', 'Credentials saved successfully!');
  });

I've also turned on keychain sharing in the Xcode project.

Any ideas?

EDIT:

I've added a catch function to see if I can figure out where it's going wrong. It looks like so:

Keychain
.setGenericPassword(GLOBALS.USERNAME, GLOBALS.PASSWORD)
.then(function(credentials) {
  AlertIOS.alert('ayylmao', 'Credentials saved successfully!');
}).catch(function(error) {
  console.warn('Keychain couldn\'t be set!', error);
});

This results in: Keychain couldn't be set! {"line":86275,"column":18,"sourceURL":"http://localhost.8081/index.ios.bundle?platform=ios&dev=true&minify=false"}

Is this a bug or am I doing something wrong?

Storing multiple passwords and retrieving by key

I would like to store multiple passwords based on key.
For instance store a password to be used with one email and store another with another email. This doesn't seem to be possible right now?

Error on setInternetCredentials

I am running on React Native 0.38.
Installed via npm, linked and added the keychain sharing entitlement.

However on "setInternetCredentials" i get an error saying:

undefined is not an object (evaluating 'RNKeychainManager.setInternetCredentialsForServer')

Any idea whats the reason?
Thanks

Is it safe to store token as password with blank username.

In the begining I stored my token by AsyncStorage, but as I found in facebook/react-native#1032, keychain could be much safer to do it.

So I'm wondering if it's safe to store my token like this:

var server = 'http://facebook.com';
Keychain
  .setInternetCredentials(server, '', token)
  .then(function() {
    console.log('Credentials saved successfully!');
  });

Since the API will only return a token, there's no username here.

[iOS] SecItemAdd() -- The dictionary does not specify a value for kSecAttrAccessible key

It's setting off some flags for sanity checks in our company's static code security scanner:

Attack Vector: SecItemAdd
Description: In this call to SecItemAdd(), the dictionary specified does not appear to include a value for the key kSecAttrAccessible. This value defaults to kSecAttrAccessibleWhenUnlocked, which may result in keychain data being accessible and unlocked longer than necessary.
Remediation: Review the potential values for kSecAttrAccessible, and ensure that the one used in this application meets the security needs of its users.
References: CWE Apple Keychain Ref

I know it's an issue of semantics, but it would be nice if this setting was either exposed in the JS module, or set explicitly to the default value: https://developer.apple.com/reference/security/ksecattraccessiblewhenunlocked

Thanks :)

Failure on setGenericPassword()

Attempting to get setup with react-native-keychain but I am receiving the error below.

TypeError: Cannot read property 'setGenericPasswordForService' of undefined(…)

I've installed the npm library and linked it with rnpm. I checked my Libraries folder in XCode to confirm RNKeychain.xcodeproj was installed and I can see the library installed in the Linked Binaries as well.

import Keychain from 'react-native-keychain';

export default class Init extends Component {
  componentDidMount() {
        var username = 'zuck';
    var password = 'poniesRgr8';

    Keychain
        .setGenericPassword(username, password)
        .then(function() {
                console.log('Credentials saved successfully!');
          }).catch(function(error) {
            console.log('Could not set Generic Password. ', error);
          });
  }
}

Keychain entry not found

Hi,
I get this error sometimes while getting generic password : "Keychain entry not found"
I am unable to reproduce it. Do you have an idea what could be causing it.
It only occurs sometimes and I cannot reproduce it. Could it because of that keychain sharing problem?
Please help asap, as this is occurring in production app being used by eminent doctors.

Shouldn't Conceal be set to use the native keystore?

I see that Conceal can be used with a custom keychain implementation and that Android provides a native one https://developer.android.com/reference/java/security/KeyStore.html . I can't help but think that using Conceal to encrypt a value with a key stored in shared preferences provides no form of added security of all. The credentialism could themselves just be stored in shared preferences to provide the same level of security. A level of security that is quite useless on a stolen device.

rnpm

I'm very new to anything apps and xcode, but I just tried to install this plugin and link it up using rnpm link. It didn't link up properly (I think it linked up with the examples maybe?) so I ended up having to do it manually.

Not a huge issue, but I imagine it's quite easy to integrate properly :)

Error when loading credentials

When using the component I'm getting an error when attempting to load credentials: "line":51735,"column":56. Saving the credentials seems to work fine.

Also, the example project won't compile: .../react-native-keychain/RNKeychainManager/RNKeychainManager.h:9:9: 'RCTBridgeModule.h' file not found

Am I missing something? Do I need to set headers search path on the example project?

How much is secure?

hi,
how much this storage is secure?
have you used secure element in this library?

Different responses from getGenericPassword before/after reload

Using 1.2.0 with RN 0.44.2 on iOS...

I am using setGenericPassword, getGenericPassword and resetGenericPassword for storing some credentials.

When the user signs out I resetGenericPassword. Once I have done this I get an inconsistent result when calling getGenericPassword. When the app re-launches I receive:

{
  username : null,
  password: "1",
  service: "xxx"
}

Note the password of "1". Weird!

But if I reload the JS bundle I get the expected result of false.

Another thing I noticed is that in the scenario where I get the weird JSON response, it always seems to generate this error when I call getGenericPassword:

RCTJSONStringify() encountered the following error: Invalid type in JSON write (__NSCFData)
reactConsoleErrorHandler @ ExceptionsManager.js:71
console.error @ YellowBox.js:62
logToConsole @ RCTLog.js:45
logIfNoNativeHook @ RCTLog.js:31
__callFunction @ MessageQueue.js:250
(anonymous) @ MessageQueue.js:101
__guard @ MessageQueue.js:218
callFunctionReturnFlushedQueue @ MessageQueue.js:100
addEventListener @ RNDebuggerWorker.js:1

Android seems to consistently return false

Having trouble sharing keychain saved passwords between apps

Hi,

I have 2 simple apps(same apps different names, lets say app A and app B) and I want to share data in-between in a secure way. I searched for the how-to's for ReactNative and end up here. Using keychain seems the right way to complete the task.

I decided to use this concise library. When I try to set and get(setGenericPassword, getGenericPassword) values using simulator and my test device on app A everything seems fine. I obtain similar behavior to AsyncStorage. However when I try to set pass from app A and try to retrieve it from app B, I have trouble.

I use XCode 8 and iOS 10. For app A I use com.abc.appA, for app B I use com.abc.appB as Bundle Identifier. I use same Keychain Group name, myKeychainGroup for both.

Anyone ever tried to share pass or any string inter apps using keychain on React Native?

Issue when running Jest tests

When I run this code

import * as KeychainHandler from 'react-native-keychain';
function save(username, password) {
  return KeychainHandler.setGenericPassword(username, username).then(() => true);
}
it('KeyChain are saved correctly', () => {
  jest.useFakeTimers();
  expect.assertions(1);
  save('me', 'mypassword').then(data => expect(result).toEqual(true));
});

I get this error:

> jest

 FAIL  __tests__/index.js
  ● KeyChain are saved correctly

    TypeError: Cannot read property 'setGenericPasswordForOptions' of undefined

      at Object.setGenericPassword (node_modules/react-native-keychain/index.js:125:906)
      at save (__tests__/index.js:19:24)
      at Object.<anonymous> (__tests__/index.js:25:1)
      at tryCallTwo (node_modules/promise/lib/core.js:45:5)
      at doResolve (node_modules/promise/lib/core.js:200:13)
      at new Promise (node_modules/promise/lib/core.js:66:3)
      at Promise.resolve.then.el (node_modules/p-map/index.js:42:16)

  ● KeyChain are saved correctly

    expect.assertions(1)

    Expected one assertion to be called but only received zero assertion calls.

      at addAssertionErrors (node_modules/jest-jasmine2/build/setup-jest-globals.js:68:21)
      at tryCallOne (node_modules/promise/lib/core.js:37:12)
      at node_modules/promise/lib/core.js:123:15
      at flush (node_modules/asap/raw.js:50:29)
      at _combinedTickCallback (internal/process/next_tick.js:67:7)
      at process._tickCallback (internal/process/next_tick.js:98:9)

  ✕ KeyChain are saved correctly (2ms)

Test Suites: 1 failed, 1 total
Tests:       1 failed, 1 total
Snapshots:   0 total
Time:        0.41s, estimated 1s
Ran all test suites.
npm ERR! Test failed.  See above for more details.

my config is:

"devDependencies": {
    "babel-jest": "20.0.1",
    "babel-plugin-transform-flow-strip-types": "6.22.0",
    "babel-preset-react-native": "1.9.2",
    "jest": "20.0.1",
    "react-test-renderer": "16.0.0-alpha.6"
  },
  "jest": {
    "automock": false,
    "preset": "react-native",
    "testEnvironment": "node"
  }

I'm a missing something ?

[Android] undefined is not an object (evaluating 'RNKeychainManager.getGenericPasswordForOptions')

React Native Noob here.

In Android only, Keychain.getGenericPassword() causes undefined is not an object (evaluating 'RNKeychainManager.getGenericPasswordForOptions') at this location .

iOS works fine.

In the Android project, I checked manually that everything was linked properly. I am using the FBSDK and have added new FBSDKPackage(mCallbackManager) to getPackages() in MainApplication.java. new KeychainPackage() is added right after the FBSDK package. Prior to installing react-native-keychain, components from FBSDK displayed fine, but after installing and linking react-native-keychain, the components from FBSDK no longer render in Android (except for a red outline around the missing component). I don't know if it's related, but maybe it is.

Any help would be appreciated! Thanks.

Connie

Keychain and Flux/Redux

I'm curious Joel, have you used the Keychain with some kind of Flux implementation?

If so, let's say you get an API key in your login response. Where exactly do you save your keychain items? I think it should live in the reducer, but I'm not completely sure.

How to set Options ?

I am wondering how you can set options for keychain storage on iOS ?
for example I want to enforce the kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly attribute.

like:
Keychain.setInternetCredentials(server, user, pass, {kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly:true});

The native part requires a NSDictionary so i expected I need to submit a object. However this gives me a "callback is not a function" exception.
How am I expected to set Options?

Error with newest libraries

Creating a fresh project using "react-native init test" and then installing react-native-keychain and trying setGenericPassword (or any other method) will always give the following error:
undefined is not an object (evaluating '_reactNativeKeychain2.default.setGenericPasswrod')

I have another project on the same machine (initiated from native base boilerplate) which works fine. So I assume this has something to do with some versions but I have no idea what is different. I can supply any information needed.

[Android] How to share Keychain elements between multiple apps?

I am using this module to share login information across multiple, at least 4, applications. I have achieved this on iOS using this module. However the same code does not work on Android as I expected. I am using Keychain.getInternetCredentials(server) and Keychain.setInternetCredentials(server, username, pass) functions. Each app uses these operations with a common server string as a parameter. My problem is I set from app A and get from app B but I could not retrieve the data that I set from app A.

Why does my build fail on device?

When building on my device I get 'React/RCTBridgeModule.h' file not found

I linked my project with react-native link react-native-keychain and verified in Xcode 'Link Binary with Libraries'

When running in simulator I get this error

2017-04-13 21:08:19.888 [info][tid:main][RCTBatchedBridge.m:72] Initializing <RCTBatchedBridge: 0x6080001aee00> (parent: <RCTBridge: 0x6080000dc460>, executor: RCTJSCExecutor)
2017-04-13 21:08:20.951 [error][tid:com.facebook.react.JavaScript] Native module cannot be null.
2017-04-13 21:08:20.984 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: Native module cannot be null.
2017-04-13 21:08:21.000 [error][tid:com.facebook.react.JavaScript] Requiring module "215", which threw an exception.
2017-04-13 21:08:21.009 [warn][tid:com.facebook.react.JavaScript] Unable to symbolicate stack trace: Native module cannot be null.
2017-04-13 21:08:21.011 [warn][tid:com.facebook.react.JavaScript] Unable to symbolicate stack trace: undefined is not a constructor (evaluating 'new XMLHttpRequest()')
2017-04-13 21:08:21.015 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: Requiring module "215", which threw an exception.
2017-04-13 21:08:21.115 [info][tid:main][RCTRootView.m:275] Running application zelosApp ({
    initialProps =     {
    };
    rootTag = 1;
})
2017-04-13 21:08:21.116 [error][tid:com.facebook.react.JavaScript] Module AppRegistry is not a registered callable module (calling runApplication)
2017-04-13 21:08:21.118 [warn][tid:com.facebook.react.JavaScript] Unable to symbolicate stack trace: undefined is not a constructor (evaluating 'new XMLHttpRequest()')
2017-04-13 21:08:21.119 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: Module AppRegistry is not a registered callable module (calling runApplication)

Not sure if they are same of separate issues but they are the only warnings I get. Any suggestions?

Error Domain=NSOSStatusErrorDomain Code=-25300 "no matching items found" UserInfo={NSDescription=no matching items found}

My code:

    try {
      Keychain.requestSharedWebCredentials()
    } catch (e) {
      console.log(e);
    }

Xcode:

screen shot 2017-03-06 at 16 18 35

screen shot 2017-03-06 at 16 19 13

My apple association file hosted under my www.myCorrectDomain.com/apple-app-association-file:

{
    "applinks": {
        "apps": [],
        "details": [
            {
                "appID": "FDM2J9GHFZ.com.myCorrectDomain.app.ios",
                "paths": [ 
                    "*"
                ]
            }
        ]
    },
    "webcredentials": {
        "apps": [ "FDM2J9GHFZ.com.myCorrectDomain.app.ios"]
    }
}

Keep in mind that the myCorrectDomain is virtual, in reality I'm using another domain, I'm just using this for the current example, but in my set up it's all under the right domain.

The error I receive is:
Error Domain=NSOSStatusErrorDomain Code=-25300 "no matching items found" UserInfo={NSDescription=no matching items found}

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.