{"id":17675371,"url":"https://github.com/numandev1/react-native-keys","last_synced_at":"2025-04-04T08:04:18.107Z","repository":{"id":41960909,"uuid":"345951349","full_name":"numandev1/react-native-keys","owner":"numandev1","description":"🔐 Protected .ENVs variables in React Native 🚀✨","archived":false,"fork":false,"pushed_at":"2025-01-27T06:35:03.000Z","size":5338,"stargazers_count":336,"open_issues_count":15,"forks_count":28,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-04-02T10:07:23.445Z","etag":null,"topics":["android","config","cpp","env","environment","environment-variables","ios","jni","jni-android","jni-ios","jsi","keys","protected","react-native","secure","undecryptable"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/numandev1.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"numandev1","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":"http://buymeacoffee.com/numan.dev"}},"created_at":"2021-03-09T09:27:12.000Z","updated_at":"2025-03-24T12:45:37.000Z","dependencies_parsed_at":"2025-02-07T15:03:19.353Z","dependency_job_id":"30d85b76-fd67-42cc-be64-67d622a400a9","html_url":"https://github.com/numandev1/react-native-keys","commit_stats":{"total_commits":161,"total_committers":14,"mean_commits":11.5,"dds":"0.11801242236024845","last_synced_commit":"e8e7158711248728c284678a26ab9706c3769dfe"},"previous_names":[],"tags_count":44,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numandev1%2Freact-native-keys","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numandev1%2Freact-native-keys/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numandev1%2Freact-native-keys/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numandev1%2Freact-native-keys/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/numandev1","download_url":"https://codeload.github.com/numandev1/react-native-keys/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247141366,"owners_count":20890627,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","config","cpp","env","environment","environment-variables","ios","jni","jni-android","jni-ios","jsi","keys","protected","react-native","secure","undecryptable"],"created_at":"2024-10-24T07:11:03.548Z","updated_at":"2025-04-04T08:04:18.084Z","avatar_url":"https://github.com/numandev1.png","language":"C++","funding_links":["https://github.com/sponsors/numandev1","http://buymeacoffee.com/numan.dev","https://www.buymeacoffee.com/numan.dev"],"categories":["android"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg width=\"500\" src=\"./media/keys.png\"\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n[![GitHub Repo stars](https://img.shields.io/badge/React_Native-20232A?style=for-the-badge\u0026logo=react\u0026logoColor=61DAFB)](#installation)\n[![GitHub Repo stars](https://img.shields.io/badge/Expo-1B1F23?style=for-the-badge\u0026logo=expo\u0026logoColor=white)](#managed-expo)\n[![GitHub Repo stars](https://img.shields.io/static/v1?style=for-the-badge\u0026message=Discord\u0026color=5865F2\u0026logo=Discord\u0026logoColor=FFFFFF\u0026label=)](https://discord.gg/fgPHnZpH9d)\n[![GitHub Repo stars](https://img.shields.io/github/stars/numandev1/react-native-keys?style=for-the-badge\u0026logo=github)](https://github.com/numandev1/react-native-keys/stargazers)\n![npm](https://img.shields.io/npm/dt/react-native-keys?style=for-the-badge)\n\n\u003c/div\u003e\n\n\u003cp align=\"center\"\u003e\u003cb\u003eREACT-NATIVE-KEYS\u003c/b\u003e is a react-native package, which helps us to protect our \u003ccode\u003eENVs\u003c/code\u003e and manage different environments like \u003ccode\u003edev\u003c/code\u003e, \u003ccode\u003estaging\u003c/code\u003e, \u003ccode\u003eproduction\u003c/code\u003e\u003c/p\u003e\n\n### Why should we use react-native-keys over react-native-config?\n\nWe should use **react-native-keys** instead of **react-native-config** because **react-native-keys** gives guarantee of protected **envs** whereas **react-native-config** **envs** can be decompile and hack\n\n**Note:** We highly recommend utilizing `third-party client-side API KEYS`, such as `Google Map` or `Branch.io`, in the secure section of this package.\n\n#### See the [ Migration from react-native-config](docs/react-native-config-migration-guide.md)\n\nMaking protected **Envs** library for React Native.\n\n- 🔐 Made for **protected** ENVs on react native apps\n- 🗄️ Manage different enviroments (**dev**, **staging**, **production**)\n- 🏎️ Up to 200x faster than all other solutions\n- ⚡️ Lightning fast implementation with pure C++ and [**JSI**](https://github.com/react-native-community/discussions-and-proposals/issues/91) instead of the \"old\" Bridge\n- 🧪 Well tested in JS and C++\n\nWe can Manage **secure**(protected) and **public** enviroment through **react-native-keys** supporting **iOS** and **Android**\n\n**secure:** Secure environment variables with the highest encryption which are protected\n\n**public:** Public environment variables are stored on the native side like Java and Objective-C which can decompile or hack.\n**Note**: in public, we mostly store `Bundle Id`, `Package Id`, `App Name` or any other **AndroidManifest.xml** env\n\n### Would you like to support me?\n\n\u003cdiv align=\"center\"\u003e\n\u003ca href=\"https://github.com/numandev1?tab=followers\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/followers/numandev1?label=Follow%20%40numandev1\u0026style=social\" height=\"36\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://twitter.com/numandev1/\"\u003e\n    \u003cimg src=\"https://img.shields.io/twitter/follow/numandev1?label=Follow%20%40numandev1\u0026style=social\" height=\"36\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://www.youtube.com/@numandev?sub_confirmation=1\"\u003e\u003cimg src=\"https://img.shields.io/youtube/channel/subscribers/UCYCUspfN7ZevgCj3W5GlFAw?style=social\" height=\"36\" /\u003e\u003ca/\u003e\n\u003c/br\u003e\n\u003ca href=\"https://www.buymeacoffee.com/numan.dev\" target=\"_blank\"\u003e\u003cimg src=\"https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png\" alt=\"Buy Me A Coffee\" style=\"height: auto !important;width: auto !important;\" \u003e\u003c/a\u003e\n\u003c/div\u003e\n\n#### See the [How we are protecting ENVs on the app side?](docs/workflow.md)\n\n# Table of Contents\n\n\u003cdetails\u003e\n\u003csummary\u003eOpen Table of Contents\u003c/summary\u003e\n\n- [Installation](#installation)\n  - [For React Native](#installation)\n  - [Managed Expo](#managed-expo)\n- [Basic Usage](#basic-usage)\n  - [Javascript](#javascript)\n    - [Public Keys](#public-keys)\n    - [Secure Keys](#secure-keys)\n- [Setup](#video)\n  - [IOS](#ios)\n  - [Android](#android)\n- [Native Usage](#native-usage)\n  - [Android](#android-1)\n    - [Public Keys](#public-keys-1)\n    - [Secure Keys](#secure-keys-jni)\n  - [IOS](#ios-1)\n    - [Public Keys](#public-keys-2)\n    - [Secure Keys](#secure-keys-1)\n- [Different environments](#different-environments)\n- [Advanced Android Setup](#advanced-android-setup-1)\n- [Advanced IOS Setup](#ios-2)\n- [Test Security](#test-security)\n- [Problems with Proguard](#problems-with-proguard)\n- [Using node with nvm, fnm or notion](#using-node-with-nvm-fnm-or-notion)\n- [Star on GitHub](#consider-supporting-with-a-%EF%B8%8F-star-on-github)\n- [How we are protecting ENVs on the app side?](#see-the-how-we-are-protecting-envs-on-the-app-side)\n  \u003c/details\u003e\n\n## Installation\n\n```sh\nyarn add react-native-keys\n```\n\n##### [New Architecture (Turbo Module) Supported](https://reactnative.dev/docs/new-architecture-intro)\n\nYou can give feedback on [Discord channel](https://discord.gg/fgPHnZpH9d)\n\n\u003ch3\u003eManaged Expo\u003c/h3\u003e\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eClick here to Expand Managed Expo plugin Config\u003c/b\u003e\u003c/summary\u003e\n\n```\nexpo install react-native-keys\n```\n\nAdd `keys.development.json`, `keys.staging.json` and `keys.production.json` at project root directory\n\nAdd the Keys plugin to your Expo config (`app.json`, `app.config.json` or `app.config.js`):\n\n```json\n{\n  \"name\": \"my app\",\n  \"plugins\": [\n    [\n      \"react-native-keys\",\n      {\n        \"android\": {\n          \"defaultKeyFile\": \"keys.staging.json\" //default: keys.development.json\n        },\n        \"ios\": {\n          \"defaultKeyFile\": \"keys.staging.json\" //default: keys.development.json\n        }\n      }\n    ]\n  ]\n}\n```\n\nFinally, compile the mods:\n\n```\nexpo prebuild\n```\n\n**Optional** If you wanna use different [Variants](https://docs.expo.dev/build-reference/variants/) then the you should write `eas.json` like this\n\n```\n{\n  \"build\": {\n    \"development\": {\n      \"env\": {\n        \"APP_VARIANT\": \"development\",\n        \"KEYSFILE\": \"keys.development.json\"\n      }\n    },\n    \"staging\": {\n      \"env\": {\n        \"APP_VARIANT\": \"staging\",\n        \"KEYSFILE\": \"keys.staging.json\"\n      }\n    },\n    \"production\": {\n      \"env\": {\n        \"APP_VARIANT\": \"production\",\n        \"KEYSFILE\": \"keys.production.json\"\n      }\n    }\n  },\n  \"submit\": {\n    \"production\": {}\n  }\n}\n```\n\nTo apply the changes, build a new binary with EAS:\n\n```\neas build\n```\n\nuse different [Variants](https://docs.expo.dev/build-reference/variants/) script into `package.json` like this\n\n```\n{\n  \"scripts\": {\n    \"dev:android\": \"KEYSFILE=keys.development.json npx expo run:android\",\n    \"staging:android\": \"KEYSFILE=keys.staging.json npx expo run:android\",\n    \"prod:android\": \"KEYSFILE=keys.production.json npx expo run:android\",\n    \"dev:ios\": \"KEYSFILE=keys.development.json npx expo run:ios\",\n    \"staging:ios\": \"KEYSFILE=keys.staging.json npx expo run:ios\",\n    \"prod:ios\": \"KEYSFILE=keys.production.json npx expo run:ios\"\n  }\n}\n\n```\n\n\u003c/details\u003e\n\n## Basic Usage\n\nCreate a new file `keys.development.json` in the root of your React Native app and add Envs in `secure` object for `protected` envs variables and add Envs in public for public usage this:\n\n```json\n{\n  \"secure\": {\n    \"GOOGLE_API\": \"ABCD\",\n    \"BRANCH_API\": \"ABCDEF\"\n  },\n  \"public\": {\n    \"APP_NAME\": \"Keys Example\",\n    \"BUNDLE_ID\": \"com.example.rnkeys.dev\",\n    \"ANDROID_CODE\": \"50\",\n    \"PACKAGE_ID\": \"com.example.rnkeys.dev\"\n  }\n}\n```\n\n**Note: Dont forgot to follow other steps for **Android** and **IOS** to use these keys**\n\nlater on you can define other enviroment files like `keys.staging.json` and `keys.production.json`\n\n## Javascript\n\n### Public Keys\n\n```js\nimport Keys from 'react-native-keys';\n\nKeys.API_URL; // https://example.com'\nKeys.URI_SCHEME; // fb://\n```\n\n### Secure Keys\n\n```js\nimport Keys from 'react-native-keys';\n\nKeys.secureFor('API_TOKEN'); // 'ABCSE#$DDSD\nKeys.secureFor('GOOGLE_API_KEY'); // 'ABCSE#$DDSD\nKeys.secureFor('SECRET_KEY'); // 'ABCSE#$DDSD\n```\n\nKeep in mind It's [basically impossible to prevent users from reverse engineering mobile app secrets](https://rammic.github.io/2015/07/28/hiding-secrets-in-android-apps/) but this library is more secure.\n\n## Setup\n\nInstall the package:\n\n```\nyarn add react-native-keys\n```\n\nLink the library:\n\n(Note: For React Native 0.60 or greater, [autolinking](https://reactnative.dev/blog/2019/07/03/version-60#native-modules-are-now-autolinked) is available)\n\nor later. For earlier versions you need to manually link the module.)\n\n```\nreact-native link react-native-keys\n```\n\n### IOS\n\nif cocoapods are used in the project then pod has to be installed as well:\n\n```\n(cd ios; pod install)\n```\n\n\u003e **Note: If you get Undefined symbols \\_BIO_f_base64 error during Xcode build then follow the below stackoverflow solution**\n\u003e\n\u003e Solution: [StackOverFlow](https://stackoverflow.com/a/76455587/8079868)\n\n- **Manual Link (iOS)**\n\n  1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]`\n  2. Go to `node_modules` ➜ `react-native-keys` and add `Keys.xcodeproj`\n  3. Expand the `Keys.xcodeproj` ➜ `Products` folder\n  4. In the project navigator, select your project. Add `Keys.a` to your project's `Build Phases` ➜ `Link Binary With Libraries`\n  5. And go the Build Settings tab. Make sure All is toggled on (instead of Basic)\n  6. Look for Header Search Paths and add `$(SRCROOT)/../node_modules/react-native-keys/ios/**` as `non-recursive`\n\n- **Mandatory Step**\n\nWith one extra step environment values can be exposed to \"Info.plist\" and Build settings in the native project.\n\n1. click on the file tree and create new file of type XCConfig\n   ![img](./media/1.png)\n   ![img](./media/2.png)\n2. save it under `ios` folder as \"Config.xcconfig\" with the following content:\n\n    ```\n    #include? \"tmp.xcconfig\"\n    ```\n\n3. add the following to your \".gitignore\":\n\n```\nios/tmp.xcconfig\n```\n\n4. go to project settings\n5. apply config to your configurations\n   ![img](./media/3.png)\n6. Go to _Edit scheme..._ -\u003e _Build_ -\u003e _Pre-actions_, click _+_ and select _New Run Script Action_. Paste below code which will generate \"tmp.xcconfig\" before each build exposing values to Build Settings and Info.plist. Make sure to select your target under _Provide build settings from_ and Shared checkbox is ticked/enabled, so `$SRCROOT` environment variables is available to the script..\n\n   ```\n   \"${SRCROOT}/../node_modules/react-native-keys/keysIOS.js\"\n   ```\n\n   if you face `env: node: No such file or directory` issue due to Nvm, Fnm or notion please follow this [guide](#using-node-with-nvm-fnm-or-notion)\n\n![img](./media/4.png)\n\n7. You can now access your env variables in the Info.plist, for example `$(MY_ENV_VARIABLE)`. If you face issues accessing variables, please open a new issue and provide as much details as possible so above steps can be improved.\n\n- Go to _Edit scheme..._ -\u003e _Build_ -\u003e _Pre-actions_, click _+_ and select _New Run Script Action_. Paste below code which will generate KEYS keys on native ios side (into node*modules) Make sure to select your target under \\_Provide build settings from*, so `$SRCROOT` environment variables is available to the script.\n\n```sh\nexport KEYSFILE=keys.development.json\n\n\"${SRCROOT}/../node_modules/react-native-keys/keysIOS.js\"\n```\n\nAlternatively, you can define a map in `Pre-actions` associating builds with env files:\n\n```sh\n    export KEYSFILE = \"path_to_env\"\n   \"${SRCROOT}/../node_modules/react-native-keys/keysIOS.js\"\n```\n\n### Android\n\n- **Manual Link (Android)**\n\n  **android/settings.gradle**\n\n  ```diff\n  + include ':react-native-keys'\n  + project(':react-native-keys').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-keys/android')\n  ```\n\n  **android/app/build.gradle**\n\n  ```diff\n  dependencies {\n   implementation \"com.facebook.react:react-native:+\"  // From node_modules\n  + implementation project(':react-native-keys')\n  }\n  ```\n\n  **MainApplication.java**\n\n  ```diff\n  + import com.reactnativekeysjsi.KeysPackage;\n\n  @Override\n  protected List\u003cReactPackage\u003e getPackages() {\n      return Arrays.asList(\n            new MainReactPackage()\n  +        new KeysPackage()\n      );\n  }\n  ```\n\n- **Mandatory Step**\n\n**app/build.gradle**\n\nyou can define a map in `build.gradle` associating builds with env files. Do it before the `apply from` call, and use build cases in lowercase, like:\n\n```groovy\nproject.ext.keyFiles = [\n  debug: \"keys.development.json\",\n  release: \"keys.staging.json\",\n]\n\napply from: project(':react-native-keys').projectDir.getPath() + \"/RNKeys.gradle\"\n```\n\n## Native Usage\n\n### Android\n\n#### Public Keys\n\nyou can only read jni key into java file.like this\n\n```java\nURL url = new URL(BuildConfig.API_URL);  // https://example.com\n```\n\nYou can also read them from your Gradle configuration(only public keys):\n\n```groovy\ndefaultConfig {\n    applicationId project.keys.get(\"APP_ID\")\n}\n```\n\nAnd use them to configure libraries in `AndroidManifest.xml` and others:\n\n```xml\n\u003cmeta-data\n  android:name=\"io.branch.sdk.BranchKey.test\"\n  android:value=\"@string/BRANCH_KEY\" /\u003e\n```\n\nAll variables are strings, so you may need to cast them. For instance, in Gradle:\n\n```\nversionCode project.keys.get(\"VERSION_CODE\").toInteger()\n```\n\n#### Advanced Android Setup\n\nIn `android/app/build.gradle`, if you use `applicationIdSuffix` or `applicationId` that is different from the package name indicated in `AndroidManifest.xml` in `\u003cmanifest package=\"...\"\u003e` tag, for example, to support different build variants:\nAdd this in `android/app/build.gradle`\n\n```\ndefaultConfig {\n    ...\n    resValue \"string\", \"build_config_package\", \"YOUR_PACKAGE_NAME_IN_ANDROIDMANIFEST_XML_OR_YOUR_NAME_SPACE\"\n}\n```\n\n#### Secure Keys (JNI)\n\n```java\nimport static com.reactnativekeysjsi.KeysModule.getSecureFor;\n\nString secureValue = getSecureFor(\"BRANCH_KEY\");   // key_test_omQ7YYKiq57vOqEJsdcsdfeEsiWkwxE\n```\n\n#### Android troubleshoot\n\n- [Problems with Proguard](#problems-with-proguard)\n- [2 files found with path '\\*\\*/libcrypto.so](#2-files-found-with-path-libcryptoso)\n- [Advanced Android Setup for applicationIdSuffix](#advanced-android-setup-1)\n\n\n### iOS\n\n#### Public Keys\n\nRead variables declared in `keys.development.json` from your Obj-C classes like:\n\n```objective-c\n// import header\n#import \"Keys.h\"\n\n// then read individual keys like:\nNSString *value = [Keys publicFor:@\"API_URL\"];   // https://example.com\n\n// or just fetch all keys\nNSDictionary *allKeys = [Keys public_keys];\n```\n\n#### Secure Keys\n\n```objective-c\n// import header\n#import \"Keys.h\"\n\n// then read individual keys like:\nNSString *value = [Keys secureFor:@\"BRANCH_KEY\"];   //key_test_omQ7YYKiq57vOqEJsdcsdfeEsiWkwxE\n```\n\ncall, and use build cases in lowercase, like:\n\n### Different environments\n\nSave config for different environments in different files: `keys.staging.json`, `keys.production.json`, etc.\n\nBy default react-native-keys will read from `keys.development.json`, but you can change it when building or releasing your app.\n\nThe simplest approach is to tell it what file to read with an environment variable, like:\n\n```sh\nKEYSFILE=keys.staging.json react-native run-ios           # bash\nSET KEYSFILE=keys.staging.json \u0026\u0026 react-native run-ios    # windows\nenv:KEYSFILE=\"keys.staging.json\"; react-native run-ios    # powershell\n```\n\nThis also works for `run-android`. Alternatively, there are platform-specific options below.\n\n#### Android\n\nThe same environment variable can be used to assemble releases with a different config:\n\n```sh\ncd android \u0026\u0026 KEYSFILE=keys.staging.json ./gradlew assembleRelease\n```\n\n#### Advanced Android Setup\n\nIn `android/app/build.gradle`, if you use `applicationIdSuffix` or `applicationId` that is different from the package name indicated in `AndroidManifest.xml` in `\u003cmanifest package=\"...\"\u003e` tag, for example, to support different build variants:\nAdd this in `android/app/build.gradle`\n\n```groovy\ndefaultConfig {\n    ...\n    resValue \"string\", \"build_config_package\", \"YOUR_PACKAGE_NAME_IN_ANDROIDMANIFEST_XML\"\n}\n```\n\nif you are using `Proguard` then you should read [Problems with Proguard](#problems-with-proguard)\n\n#### iOS\n\nThe basic idea in iOS is to have one scheme per environment file, so you can easily alternate between them.\n\nStart by creating a new scheme:\n\n- In the Xcode menu, go to Product \u003e Scheme \u003e Edit Scheme\n- Click Duplicate Scheme on the bottom\n- Give it a proper name on the top left. For instance: \"Myapp (staging)\"\n\nThen edit the newly created scheme to make it use a different env file. From the same \"manage scheme\" window:\n\n- Expand the \"Build\" settings on left\n- Click \"Pre-actions\", and under the plus sign select \"New Run Script Action\"\n- Where it says \"Type a script or drag a script file\", type:\n\nyou can also set different file for debug and release build like this.\n\n```bash\n#DEBUG_KEYSFILE will choose env file\nexport KEYSFILE=keys.production.json\n\n#if you wannna use different keys for same scheme\nexport DEBUG_KEYSFILE=keys.debug.json  # in running metro\nexport RELEASE_KEYSFILE=keys.staging.json  # in IPA\n\n#above DEBUG_KEYSFILE and RELEASE_KEYSFILE variable are optional\n\n\"${SRCROOT}/../node_modules/react-native-keys/keysIOS.js\"\n```\n\nAlso ensure that \"Provide build settings from\", just above the script, has a value selected so that PROJECT_DIR is set.\n\n## Test Security\n\nyou can decompile **APK/IPA** by this package [react-native-decompiler](https://www.npmjs.com/package/react-native-decompiler 'react-native-decompiler') and can find public and secure keys. you will not find secure keys.\n\nTroubleshooting\n\n### Problems with Proguard\n\nWhen Proguard is enabled (which it is by default for Android release builds), it can rename the `BuildConfig` Java class in the minification process and prevent React Native Keys from referencing it. To avoid this, add an exception to `android/app/proguard-rules.pro`:\n\n    -keep class com.mypackage.BuildConfig { *; }\n\n`com.mypackage` should match the `package` value in your `app/src/main/AndroidManifest.xml` file.\n\nwe can find BuildConfig file at `android/app/build/generated/source/buildConfig/debug/com.mypackage/BuildConfig.java`\n\nIf using Dexguard, the shrinking phase will remove resources it thinks are unused. It is necessary to add an exception to preserve the build config package name.\n\n    -keepresources string/build_config_package\n\n### 2 files found with path '\\*\\*/libcrypto.so\n\nif you face `2 files found with path '**/libcrypto.so'` then\ninside android/app/build.gradle just add this:\n\n```\nandroid {\n...\npackagingOptions {\n        pickFirst 'lib/x86/libcrypto.so'\n        pickFirst 'lib/x86_64/libcrypto.so'\n        pickFirst 'lib/armeabi-v7a/libcrypto.so'\n        pickFirst 'lib/arm64-v8a/libcrypto.so'\n    }\n}\n```\n\n### Using node with nvm, fnm or notion\n\nBuild failure in Xcode looks something like:\n\n\u003e env: node: No such file or directory\n\nChange the **Pre-actions script** scripts in Xcode to:\n\n```bash\n# Setup nvm and set node\n\n[ -z \"$NVM_DIR\" ] \u0026\u0026 export NVM_DIR=\"$HOME/.nvm\"\n\nif [[-s \"$HOME/.nvm/nvm.sh\"]]; then\n. \"$HOME/.nvm/nvm.sh\"\nelif [[ -x \"$(command -v brew)\" \u0026\u0026 -s \"$(brew --prefix nvm)/nvm.sh\" ]]; then\n. \"$(brew --prefix nvm)/nvm.sh\"\nfi\n\n# Set up the nodenv node version manager if present\n\nif [[-x \"$HOME/.nodenv/bin/nodenv\"]]; then\neval \"$(\"$HOME/.nodenv/bin/nodenv\" init -)\"\nfi\n\n# Set up the fnm node version manager if present\n\nif [[-s \"$HOME/.fnm/fnm\"]]; then\neval \"`$HOME/.fnm/fnm env --multi`\"\nfi\n\n# Trying notion\n\nif [ -z \"$NODE_BINARY\" ]; then\nif [[-s \"$HOME/.notion/bin/node\"]]; then\nexport NODE_BINARY=\"$HOME/.notion/bin/node\"\nfi\nfi\n\n[ -z \"$NODE_BINARY\" ] \u0026\u0026 export NODE_BINARY=\"node\"\n\n$NODE_BINARY \"${SRCROOT}/../node_modules/react-native-keys/keysIOS.js\"\n```\n\n# Alternative Package\n\nThis package full alternative of [react-native-config](https://github.com/luggit/react-native-config) and [react-native-dotenv](https://github.com/goatandsheep/react-native-dotenv)\n\nThe above-mentioned packages do not provide any **security** for **environment variables** as well as these packages are not as fast as the **react-native-keys** package because it does not use JSI (JavaScript Interface).\n\n## Consider supporting with a ⭐️ [star on GitHub](https://github.com/numandev1/react-native-keys/stargazers)\n\nIf you are using the library in one of your projects, consider supporting it with a star. It takes a lot of time and effort to keep this maintained and address issues and bugs. Thank you.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnumandev1%2Freact-native-keys","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnumandev1%2Freact-native-keys","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnumandev1%2Freact-native-keys/lists"}