├── .editorconfig ├── .gitattributes ├── .github ├── actions │ └── setup │ │ └── action.yml └── workflows │ └── ci.yml ├── .gitignore ├── .nvmrc ├── .watchmanconfig ├── .yarnrc ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── SECURITY.md ├── android ├── CMakeLists.txt ├── build.gradle ├── cpp-adapter.cpp ├── gradle.properties ├── helpers.cpp └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── com │ └── totputils │ ├── TotpUtilsModule.java │ └── TotpUtilsPackage.java ├── babel.config.js ├── cpp ├── hmac │ └── hmac_sha1.cpp ├── react-native-totp-utils.cpp ├── react-native-totp-utils.h └── sha │ └── sha1.cpp ├── example ├── .bundle │ └── config ├── .watchmanconfig ├── Gemfile ├── android │ ├── app │ │ ├── build.gradle │ │ ├── debug.keystore │ │ ├── proguard-rules.pro │ │ └── src │ │ │ ├── debug │ │ │ ├── AndroidManifest.xml │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── totputilsexample │ │ │ │ └── ReactNativeFlipper.java │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── totputilsexample │ │ │ │ │ ├── MainActivity.java │ │ │ │ │ └── MainApplication.java │ │ │ └── res │ │ │ │ ├── drawable │ │ │ │ └── rn_edit_text_material.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ │ └── values │ │ │ │ ├── strings.xml │ │ │ │ └── styles.xml │ │ │ └── release │ │ │ └── java │ │ │ └── com │ │ │ └── totputilsexample │ │ │ └── ReactNativeFlipper.java │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle ├── app.json ├── babel.config.js ├── index.js ├── ios │ ├── .xcode.env │ ├── File.swift │ ├── Podfile │ ├── Podfile.lock │ ├── TotpUtilsExample-Bridging-Header.h │ ├── TotpUtilsExample.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── TotpUtilsExample.xcscheme │ ├── TotpUtilsExample.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ ├── TotpUtilsExample │ │ ├── AppDelegate.h │ │ ├── AppDelegate.mm │ │ ├── Images.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ │ └── Contents.json │ │ ├── Info.plist │ │ ├── LaunchScreen.storyboard │ │ └── main.m │ └── TotpUtilsExampleTests │ │ ├── Info.plist │ │ └── TotpUtilsExampleTests.m ├── jest.config.js ├── metro.config.js ├── package.json ├── react-native.config.js ├── src │ └── App.tsx └── yarn.lock ├── ios ├── TotpUtils.h ├── TotpUtils.mm └── TotpUtils.xcodeproj │ └── project.pbxproj ├── lefthook.yml ├── package.json ├── react-native-totp-utils.podspec ├── scripts └── bootstrap.js ├── src ├── __tests__ │ └── index.test.tsx ├── index.tsx ├── types │ └── index.ts └── utils │ └── index.ts ├── tsconfig.build.json ├── tsconfig.json └── yarn.lock /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # editorconfig.org 4 | 5 | root = true 6 | 7 | [*] 8 | 9 | indent_style = space 10 | indent_size = 2 11 | 12 | end_of_line = lf 13 | charset = utf-8 14 | trim_trailing_whitespace = true 15 | insert_final_newline = true 16 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | # specific for windows script files 3 | *.bat text eol=crlf -------------------------------------------------------------------------------- /.github/actions/setup/action.yml: -------------------------------------------------------------------------------- 1 | name: Setup 2 | description: Setup Node.js and install dependencies 3 | 4 | runs: 5 | using: composite 6 | steps: 7 | - name: Setup Node.js 8 | uses: actions/setup-node@v3 9 | with: 10 | node-version-file: .nvmrc 11 | 12 | - name: Cache dependencies 13 | id: yarn-cache 14 | uses: actions/cache@v3 15 | with: 16 | path: | 17 | **/node_modules 18 | key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} 19 | restore-keys: | 20 | ${{ runner.os }}-yarn- 21 | 22 | - name: Install dependencies 23 | if: steps.yarn-cache.outputs.cache-hit != 'true' 24 | run: | 25 | yarn install --cwd example --frozen-lockfile 26 | yarn install --frozen-lockfile 27 | shell: bash 28 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: 3 | push: 4 | branches: 5 | - main 6 | pull_request: 7 | branches: 8 | - main 9 | 10 | jobs: 11 | lint: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Checkout 15 | uses: actions/checkout@v3 16 | 17 | - name: Setup 18 | uses: ./.github/actions/setup 19 | 20 | - name: Lint files 21 | run: yarn lint 22 | 23 | - name: Typecheck files 24 | run: yarn typecheck 25 | 26 | test: 27 | runs-on: ubuntu-latest 28 | steps: 29 | - name: Checkout 30 | uses: actions/checkout@v3 31 | 32 | - name: Setup 33 | uses: ./.github/actions/setup 34 | 35 | - name: Run unit tests 36 | run: yarn test --maxWorkers=2 --coverage 37 | 38 | build: 39 | runs-on: ubuntu-latest 40 | steps: 41 | - name: Checkout 42 | uses: actions/checkout@v3 43 | 44 | - name: Setup 45 | uses: ./.github/actions/setup 46 | 47 | - name: Build package 48 | run: yarn prepack 49 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # XDE 6 | .expo/ 7 | 8 | # VSCode 9 | .vscode/ 10 | jsconfig.json 11 | 12 | # Xcode 13 | # 14 | build/ 15 | *.pbxuser 16 | !default.pbxuser 17 | *.mode1v3 18 | !default.mode1v3 19 | *.mode2v3 20 | !default.mode2v3 21 | *.perspectivev3 22 | !default.perspectivev3 23 | xcuserdata 24 | *.xccheckout 25 | *.moved-aside 26 | DerivedData 27 | *.hmap 28 | *.ipa 29 | *.xcuserstate 30 | project.xcworkspace 31 | 32 | # Android/IJ 33 | # 34 | .classpath 35 | .cxx 36 | .gradle 37 | .idea 38 | .project 39 | .settings 40 | local.properties 41 | android.iml 42 | 43 | # Cocoapods 44 | # 45 | example/ios/Pods 46 | 47 | # Ruby 48 | example/vendor/ 49 | 50 | # node.js 51 | # 52 | node_modules/ 53 | npm-debug.log 54 | yarn-debug.log 55 | yarn-error.log 56 | 57 | # BUCK 58 | buck-out/ 59 | \.buckd/ 60 | android/app/libs 61 | android/keystores/debug.keystore 62 | 63 | # Expo 64 | .expo/ 65 | 66 | # Turborepo 67 | .turbo/ 68 | 69 | # generated by bob 70 | lib/ 71 | -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | 16.14.0 -------------------------------------------------------------------------------- /.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /.yarnrc: -------------------------------------------------------------------------------- 1 | # Override Yarn command so we can automatically setup the repo on running `yarn` 2 | 3 | yarn-path "scripts/bootstrap.js" 4 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | 2 | # Contributor Covenant Code of Conduct 3 | 4 | ## Our Pledge 5 | 6 | We as members, contributors, and leaders pledge to make participation in our 7 | community a harassment-free experience for everyone, regardless of age, body 8 | size, visible or invisible disability, ethnicity, sex characteristics, gender 9 | identity and expression, level of experience, education, socio-economic status, 10 | nationality, personal appearance, race, caste, color, religion, or sexual 11 | identity and orientation. 12 | 13 | We pledge to act and interact in ways that contribute to an open, welcoming, 14 | diverse, inclusive, and healthy community. 15 | 16 | ## Our Standards 17 | 18 | Examples of behavior that contributes to a positive environment for our 19 | community include: 20 | 21 | * Demonstrating empathy and kindness toward other people 22 | * Being respectful of differing opinions, viewpoints, and experiences 23 | * Giving and gracefully accepting constructive feedback 24 | * Accepting responsibility and apologizing to those affected by our mistakes, 25 | and learning from the experience 26 | * Focusing on what is best not just for us as individuals, but for the overall 27 | community 28 | 29 | Examples of unacceptable behavior include: 30 | 31 | * The use of sexualized language or imagery, and sexual attention or advances of 32 | any kind 33 | * Trolling, insulting or derogatory comments, and personal or political attacks 34 | * Public or private harassment 35 | * Publishing others' private information, such as a physical or email address, 36 | without their explicit permission 37 | * Other conduct which could reasonably be considered inappropriate in a 38 | professional setting 39 | 40 | ## Enforcement Responsibilities 41 | 42 | Community leaders are responsible for clarifying and enforcing our standards of 43 | acceptable behavior and will take appropriate and fair corrective action in 44 | response to any behavior that they deem inappropriate, threatening, offensive, 45 | or harmful. 46 | 47 | Community leaders have the right and responsibility to remove, edit, or reject 48 | comments, commits, code, wiki edits, issues, and other contributions that are 49 | not aligned to this Code of Conduct, and will communicate reasons for moderation 50 | decisions when appropriate. 51 | 52 | ## Scope 53 | 54 | This Code of Conduct applies within all community spaces, and also applies when 55 | an individual is officially representing the community in public spaces. 56 | Examples of representing our community include using an official e-mail address, 57 | posting via an official social media account, or acting as an appointed 58 | representative at an online or offline event. 59 | 60 | ## Enforcement 61 | 62 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 63 | reported to the community leaders responsible for enforcement at 64 | [INSERT CONTACT METHOD]. 65 | All complaints will be reviewed and investigated promptly and fairly. 66 | 67 | All community leaders are obligated to respect the privacy and security of the 68 | reporter of any incident. 69 | 70 | ## Enforcement Guidelines 71 | 72 | Community leaders will follow these Community Impact Guidelines in determining 73 | the consequences for any action they deem in violation of this Code of Conduct: 74 | 75 | ### 1. Correction 76 | 77 | **Community Impact**: Use of inappropriate language or other behavior deemed 78 | unprofessional or unwelcome in the community. 79 | 80 | **Consequence**: A private, written warning from community leaders, providing 81 | clarity around the nature of the violation and an explanation of why the 82 | behavior was inappropriate. A public apology may be requested. 83 | 84 | ### 2. Warning 85 | 86 | **Community Impact**: A violation through a single incident or series of 87 | actions. 88 | 89 | **Consequence**: A warning with consequences for continued behavior. No 90 | interaction with the people involved, including unsolicited interaction with 91 | those enforcing the Code of Conduct, for a specified period of time. This 92 | includes avoiding interactions in community spaces as well as external channels 93 | like social media. Violating these terms may lead to a temporary or permanent 94 | ban. 95 | 96 | ### 3. Temporary Ban 97 | 98 | **Community Impact**: A serious violation of community standards, including 99 | sustained inappropriate behavior. 100 | 101 | **Consequence**: A temporary ban from any sort of interaction or public 102 | communication with the community for a specified period of time. No public or 103 | private interaction with the people involved, including unsolicited interaction 104 | with those enforcing the Code of Conduct, is allowed during this period. 105 | Violating these terms may lead to a permanent ban. 106 | 107 | ### 4. Permanent Ban 108 | 109 | **Community Impact**: Demonstrating a pattern of violation of community 110 | standards, including sustained inappropriate behavior, harassment of an 111 | individual, or aggression toward or disparagement of classes of individuals. 112 | 113 | **Consequence**: A permanent ban from any sort of public interaction within the 114 | community. 115 | 116 | ## Attribution 117 | 118 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 119 | version 2.1, available at 120 | [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. 121 | 122 | Community Impact Guidelines were inspired by 123 | [Mozilla's code of conduct enforcement ladder][Mozilla CoC]. 124 | 125 | For answers to common questions about this code of conduct, see the FAQ at 126 | [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at 127 | [https://www.contributor-covenant.org/translations][translations]. 128 | 129 | [homepage]: https://www.contributor-covenant.org 130 | [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html 131 | [Mozilla CoC]: https://github.com/mozilla/diversity 132 | [FAQ]: https://www.contributor-covenant.org/faq 133 | [translations]: https://www.contributor-covenant.org/translations 134 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Contributions are always welcome, no matter how large or small! 4 | 5 | We want this community to be friendly and respectful to each other. Please follow it in all your interactions with the project. Before contributing, please read the [code of conduct](./CODE_OF_CONDUCT.md). 6 | 7 | ## Development workflow 8 | 9 | To get started with the project, run `yarn` in the root directory to install the required dependencies for each package: 10 | 11 | ```sh 12 | yarn 13 | ``` 14 | 15 | > While it's possible to use [`npm`](https://github.com/npm/cli), the tooling is built around [`yarn`](https://classic.yarnpkg.com/), so you'll have an easier time if you use `yarn` for development. 16 | 17 | While developing, you can run the [example app](/example/) to test your changes. Any changes you make in your library's JavaScript code will be reflected in the example app without a rebuild. If you change any native code, then you'll need to rebuild the example app. 18 | 19 | To start the packager: 20 | 21 | ```sh 22 | yarn example start 23 | ``` 24 | 25 | To run the example app on Android: 26 | 27 | ```sh 28 | yarn example android 29 | ``` 30 | 31 | To run the example app on iOS: 32 | 33 | ```sh 34 | yarn example ios 35 | ``` 36 | 37 | By default, the example is configured to build with the old architecture. To run the example with the new architecture, you can do the following: 38 | 39 | 1. For Android, run: 40 | 41 | ```sh 42 | ORG_GRADLE_PROJECT_newArchEnabled=true yarn example android 43 | ``` 44 | 45 | 2. For iOS, run: 46 | 47 | ```sh 48 | RCT_NEW_ARCH_ENABLED=1 yarn example pods 49 | yarn example ios 50 | ``` 51 | 52 | If you are building for a different architecture than your previous build, make sure to remove the build folders first. You can run the following command to cleanup all build folders: 53 | 54 | ```sh 55 | yarn clean 56 | ``` 57 | 58 | To confirm that the app is running with the new architecture, you can check the Metro logs for a message like this: 59 | 60 | ```sh 61 | Running "TotpUtilsExample" with {"fabric":true,"initialProps":{"concurrentRoot":true},"rootTag":1} 62 | ``` 63 | 64 | Note the `"fabric":true` and `"concurrentRoot":true` properties. 65 | 66 | Make sure your code passes TypeScript and ESLint. Run the following to verify: 67 | 68 | ```sh 69 | yarn typecheck 70 | yarn lint 71 | ``` 72 | 73 | To fix formatting errors, run the following: 74 | 75 | ```sh 76 | yarn lint --fix 77 | ``` 78 | 79 | Remember to add tests for your change if possible. Run the unit tests by: 80 | 81 | ```sh 82 | yarn test 83 | ``` 84 | 85 | To edit the Objective-C or Swift files, open `example/ios/TotpUtilsExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > react-native-totp-utils`. 86 | 87 | To edit the Java or Kotlin files, open `example/android` in Android studio and find the source files at `react-native-totp-utils` under `Android`. 88 | 89 | 90 | ### Commit message convention 91 | 92 | We follow the [conventional commits specification](https://www.conventionalcommits.org/en) for our commit messages: 93 | 94 | - `fix`: bug fixes, e.g. fix crash due to deprecated method. 95 | - `feat`: new features, e.g. add new method to the module. 96 | - `refactor`: code refactor, e.g. migrate from class components to hooks. 97 | - `docs`: changes into documentation, e.g. add usage example for the module.. 98 | - `test`: adding or updating tests, e.g. add integration tests using detox. 99 | - `chore`: tooling changes, e.g. change CI config. 100 | 101 | Our pre-commit hooks verify that your commit message matches this format when committing. 102 | 103 | ### Linting and tests 104 | 105 | [ESLint](https://eslint.org/), [Prettier](https://prettier.io/), [TypeScript](https://www.typescriptlang.org/) 106 | 107 | We use [TypeScript](https://www.typescriptlang.org/) for type checking, [ESLint](https://eslint.org/) with [Prettier](https://prettier.io/) for linting and formatting the code, and [Jest](https://jestjs.io/) for testing. 108 | 109 | Our pre-commit hooks verify that the linter and tests pass when committing. 110 | 111 | ### Publishing to npm 112 | 113 | We use [release-it](https://github.com/release-it/release-it) to make it easier to publish new versions. It handles common tasks like bumping version based on semver, creating tags and releases etc. 114 | 115 | To publish new versions, run the following: 116 | 117 | ```sh 118 | yarn release 119 | ``` 120 | 121 | ### Scripts 122 | 123 | The `package.json` file contains various scripts for common tasks: 124 | 125 | - `yarn bootstrap`: setup project by installing all dependencies and pods. 126 | - `yarn typecheck`: type-check files with TypeScript. 127 | - `yarn lint`: lint files with ESLint. 128 | - `yarn test`: run unit tests with Jest. 129 | - `yarn example start`: start the Metro server for the example app. 130 | - `yarn example android`: run the example app on Android. 131 | - `yarn example ios`: run the example app on iOS. 132 | 133 | ### Sending a pull request 134 | 135 | > **Working on your first pull request?** You can learn how from this _free_ series: [How to Contribute to an Open Source Project on GitHub](https://app.egghead.io/playlists/how-to-contribute-to-an-open-source-project-on-github). 136 | 137 | When you're sending a pull request: 138 | 139 | - Prefer small pull requests focused on one change. 140 | - Verify that linters and tests are passing. 141 | - Review the documentation to make sure it looks good. 142 | - Follow the pull request template when opening a pull request. 143 | - For pull requests that change the API or implementation, discuss with maintainers first by opening an issue. 144 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Ryam 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all 12 | copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | > [!IMPORTANT] 2 | > ## MOVED TO NEW REPOSITORY 3 | > This library is no longer maintained and moved to new repository [react-native-nitro-totp](https://github.com/4cc3ssX/react-native-nitro-totp). 4 | 5 | # react-native-totp-utils 6 | 7 | A full-featured Time-Based One-Time Password (TOTP) library for React Native, providing functions for generating and validating OTP codes. 8 | 9 | ## Features 10 | 11 | - [X] New Architecture Support 12 | - [X] Written in C++ 13 | - [X] Generate Secret Key 14 | - [X] Generate OTP 15 | - [X] Validate OTP 16 | - [X] JSI Implementation 17 | 18 | ## Installation 19 | 20 | Using npm: 21 | 22 | ```bash 23 | npm install react-native-totp-utils 24 | ``` 25 | 26 | Using yarn: 27 | 28 | ```bash 29 | yarn add react-native-totp-utils 30 | ``` 31 | 32 | ## Usage 33 | 34 | ```js 35 | import { 36 | generateOTP, 37 | generateSecretKey, 38 | validateOTP, 39 | formatSecretKey, 40 | formatOTP, 41 | } from 'react-native-totp-utils'; 42 | 43 | // ... 44 | 45 | const secretKey = generateSecretKey(); // ABCDABCDABCD 46 | 47 | const otp = generateOTP(secretKey); // 123456 48 | 49 | const isValid = validateOTP(secretKey, otp); // true 50 | 51 | const formattedSecretKey = formatSecretKey(secretKey); // ABCD-ABCD-ABCD-ABCD 52 | 53 | const formattedOTP = formatOTP(otp); // 123 456 54 | ``` 55 | 56 | ## Contributing 57 | 58 | See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow. 59 | 60 | ## License 61 | 62 | MIT 63 | 64 | --- 65 | 66 | Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob) 67 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Reporting a Vulnerability 4 | 5 | At React Native TOTP Utils, we take security seriously. If you believe you've found a security vulnerability in our library, please follow the responsible disclosure process: 6 | 7 | 1. **DO NOT** disclose the vulnerability publicly until it has been addressed by our team. 8 | 9 | 2. **DO NOT** open a GitHub issue for the vulnerability. Instead, please send an email to [heinmyatthu.workspace@gmail.com](mailto:heinmyatthu.workspace@gmail.com) with a detailed description of the issue. 10 | 11 | 3. Include the following information in your report: 12 | - A clear description of the vulnerability and its potential impact. 13 | - Steps to reproduce the vulnerability, if possible. 14 | - The version of React Native TOTP Utils affected. 15 | 16 | 4. Our team will acknowledge your email within 48 hours and may request additional information or clarifications. 17 | 18 | 5. Once we've validated and addressed the vulnerability, we will publicly disclose the information, giving credit to the reporter (unless you prefer to remain anonymous). 19 | 20 | ## Supported Versions 21 | 22 | React Native TOTP Utils is continuously improving, and security updates are essential. We only support the latest stable release and the one immediately preceding it. It is crucial to keep your library version up-to-date to ensure you have the latest security fixes. 23 | 24 | | Version | Supported | 25 | | ------- | ------------------ | 26 | | >= 1.0.0 | :white_check_mark: | 27 | 28 | ## Security Best Practices 29 | 30 | While using React Native TOTP Utils in your projects, we recommend following these security best practices: 31 | 32 | 1. **Keep Dependencies Updated:** Always use the latest stable versions of React Native TOTP Utils and its dependencies. 33 | 34 | 2. **Input Sanitization:** Sanitize user input to prevent potential security vulnerabilities like SQL injection and cross-site scripting (XSS) attacks. 35 | 36 | 3. **Secure Data Storage:** Handle sensitive data securely, whether it's tokens, passwords, or encryption keys. Avoid storing sensitive information in plain text or insecure storage. 37 | 38 | 4. **Use HTTPS:** When communicating with servers or APIs, use HTTPS to encrypt the data in transit. 39 | 40 | 5. **Authentication and Authorization:** Implement proper authentication and authorization mechanisms in your application. 41 | 42 | 6. **Minimize Permissions:** Request the minimum necessary permissions from users in your application. 43 | 44 | ## Code of Conduct 45 | 46 | Please note that we expect all contributors and users of React Native TOTP Utils to follow our [Code of Conduct](CODE_OF_CONDUCT.md). We believe in fostering a safe and inclusive environment for everyone involved in the project. 47 | 48 | By using or contributing to React Native TOTP Utils, you agree to abide by the Code of Conduct. 49 | 50 | ## Reporting a Vulnerability 51 | 52 | We strive to create a secure and reliable library for our users. If you have any security-related concerns, questions, or suggestions, please feel free to reach out to us at [heinmyatthu.workspace@gmail.com](mailto:heinmyatthu.workspace@gmail.com). 53 | 54 | Thank you for helping us keep React Native TOTP Utils safe for everyone! 55 | 56 | -------------------------------------------------------------------------------- /android/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(TotpUtils) 2 | cmake_minimum_required(VERSION 3.9.0) 3 | 4 | set (PACKAGE_NAME "react-native-totp-utils") 5 | set (BUILD_DIR ${CMAKE_SOURCE_DIR}/build) 6 | set (CMAKE_VERBOSE_MAKEFILE ON) 7 | set (CMAKE_CXX_STANDARD 17) 8 | 9 | # Totp example cannot compile with ../.. use ../node_modules 10 | set(NODE_MODULES_DIR ../..) 11 | 12 | add_library(reactnativetotputils 13 | SHARED 14 | ${NODE_MODULES_DIR}/react-native/ReactCommon/jsi/jsi/jsi.cpp 15 | ../cpp/react-native-totp-utils.cpp 16 | cpp-adapter.cpp 17 | ) 18 | 19 | # Specifies a path to native header files. 20 | include_directories( 21 | ${NODE_MODULES_DIR}/react-native/React 22 | ${NODE_MODULES_DIR}/react-native/React/Base 23 | ${NODE_MODULES_DIR}/react-native/ReactCommon/jsi 24 | ../cpp 25 | ) 26 | 27 | set_target_properties( 28 | reactnativetotputils PROPERTIES 29 | CXX_STANDARD 17 30 | CXX_EXTENSIONS OFF 31 | POSITION_INDEPENDENT_CODE ON 32 | ) 33 | 34 | target_link_libraries( 35 | reactnativetotputils 36 | android # <-- Android JNI core 37 | ) 38 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | mavenCentral() 5 | } 6 | 7 | dependencies { 8 | classpath "com.android.tools.build:gradle:7.2.1" 9 | } 10 | } 11 | 12 | def isNewArchitectureEnabled() { 13 | return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true" 14 | } 15 | 16 | apply plugin: "com.android.library" 17 | 18 | 19 | def appProject = rootProject.allprojects.find { it.plugins.hasPlugin('com.android.application') } 20 | 21 | if (isNewArchitectureEnabled()) { 22 | apply plugin: "com.facebook.react" 23 | } 24 | 25 | def getExtOrDefault(name) { 26 | return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["TotpUtils_" + name] 27 | } 28 | 29 | def getExtOrIntegerDefault(name) { 30 | return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["TotpUtils_" + name]).toInteger() 31 | } 32 | 33 | android { 34 | ndkVersion getExtOrDefault("ndkVersion") 35 | compileSdkVersion getExtOrIntegerDefault("compileSdkVersion") 36 | 37 | defaultConfig { 38 | minSdkVersion getExtOrIntegerDefault("minSdkVersion") 39 | targetSdkVersion getExtOrIntegerDefault("targetSdkVersion") 40 | buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString() 41 | externalNativeBuild { 42 | cmake { 43 | cppFlags "-O2 -frtti -fexceptions -Wall -fstack-protector-all" 44 | abiFilters "x86", "x86_64", "armeabi-v7a", "arm64-v8a" 45 | } 46 | } 47 | } 48 | externalNativeBuild { 49 | cmake { 50 | path "CMakeLists.txt" 51 | } 52 | } 53 | buildTypes { 54 | release { 55 | minifyEnabled false 56 | } 57 | } 58 | 59 | lintOptions { 60 | disable "GradleCompatible" 61 | } 62 | 63 | compileOptions { 64 | sourceCompatibility JavaVersion.VERSION_1_8 65 | targetCompatibility JavaVersion.VERSION_1_8 66 | } 67 | } 68 | 69 | repositories { 70 | mavenCentral() 71 | google() 72 | } 73 | 74 | 75 | dependencies { 76 | // For < 0.71, this will be from the local maven repo 77 | // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin 78 | //noinspection GradleDynamicVersion 79 | implementation "com.facebook.react:react-native:+" 80 | } 81 | 82 | if (isNewArchitectureEnabled()) { 83 | react { 84 | jsRootDir = file("../src/") 85 | libraryName = "TotpUtils" 86 | codegenJavaPackageName = "com.totputils" 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /android/cpp-adapter.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "react-native-totp-utils.h" 3 | #include "helpers.cpp" 4 | 5 | extern "C" 6 | JNIEXPORT void JNICALL 7 | Java_com_totputils_TotpUtilsModule_nativeInstall(JNIEnv *env, jobject thiz, jlong jsi) { 8 | auto runtime = reinterpret_cast(jsi); 9 | 10 | if (runtime) { 11 | totputils::install(*runtime); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | TotpUtils_kotlinVersion=1.7.0 2 | TotpUtils_minSdkVersion=21 3 | TotpUtils_targetSdkVersion=31 4 | TotpUtils_compileSdkVersion=31 5 | TotpUtils_ndkversion=21.4.7075529 6 | -------------------------------------------------------------------------------- /android/helpers.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | std::string JStringToString(JNIEnv *env, jstring jstr) 5 | { 6 | const char *cstr = env->GetStringUTFChars(jstr, nullptr); 7 | std::string str(cstr); 8 | env->ReleaseStringUTFChars(jstr, cstr); 9 | return str; 10 | } 11 | 12 | int JDoubleToInt(jdouble jdbl) 13 | { 14 | return static_cast(jdbl); 15 | } 16 | 17 | jstring StringToJString(JNIEnv *env, const std::string &str) 18 | { 19 | return env->NewStringUTF(str.c_str()); 20 | } 21 | 22 | jobject BoolToJObject(JNIEnv *env, jclass clazz, jboolean value) 23 | { 24 | // Get the Boolean class and the constructor method ID 25 | jclass booleanClass = env->FindClass("java/lang/Boolean"); 26 | jmethodID constructor = env->GetMethodID(booleanClass, "", "(Z)V"); 27 | 28 | // Create a new Boolean object using the constructor 29 | jobject booleanObject = env->NewObject(booleanClass, constructor, value); 30 | 31 | return booleanObject; 32 | } 33 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /android/src/main/java/com/totputils/TotpUtilsModule.java: -------------------------------------------------------------------------------- 1 | package com.totputils; 2 | 3 | import android.util.Log; 4 | 5 | import androidx.annotation.NonNull; 6 | 7 | import com.facebook.react.bridge.JavaScriptContextHolder; 8 | import com.facebook.react.bridge.ReactApplicationContext; 9 | import com.facebook.react.bridge.ReactContextBaseJavaModule; 10 | import com.facebook.react.bridge.ReactMethod; 11 | import com.facebook.react.module.annotations.ReactModule; 12 | 13 | @ReactModule(name = TotpUtilsModule.NAME) 14 | public class TotpUtilsModule extends ReactContextBaseJavaModule { 15 | public static final String NAME = "TotpUtils"; 16 | 17 | TotpUtilsModule(ReactApplicationContext context) { 18 | super(context); 19 | } 20 | 21 | @Override 22 | @NonNull 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | private native void nativeInstall(long jsi); 28 | 29 | @ReactMethod(isBlockingSynchronousMethod = true) 30 | public boolean install() { 31 | try { 32 | Log.i(NAME, "Loading C++ library..."); 33 | System.loadLibrary("reactnativetotputils"); 34 | JavaScriptContextHolder jsContext = getReactApplicationContext().getJavaScriptContextHolder(); 35 | Log.i(NAME, "Installing JSI Bindings..."); 36 | nativeInstall(jsContext.get()); 37 | return true; 38 | } catch (Exception exception) { 39 | Log.e(NAME, "Failed to install JSI Bindings!", exception); 40 | return false; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /android/src/main/java/com/totputils/TotpUtilsPackage.java: -------------------------------------------------------------------------------- 1 | package com.totputils; 2 | 3 | import androidx.annotation.NonNull; 4 | 5 | import com.facebook.react.ReactPackage; 6 | import com.facebook.react.bridge.NativeModule; 7 | import com.facebook.react.bridge.ReactApplicationContext; 8 | import com.facebook.react.uimanager.ViewManager; 9 | 10 | import java.util.ArrayList; 11 | import java.util.Collections; 12 | import java.util.List; 13 | 14 | public class TotpUtilsPackage implements ReactPackage { 15 | @NonNull 16 | @Override 17 | public List createNativeModules(@NonNull ReactApplicationContext reactContext) { 18 | List modules = new ArrayList<>(); 19 | modules.add(new TotpUtilsModule(reactContext)); 20 | return modules; 21 | } 22 | 23 | @NonNull 24 | @Override 25 | public List createViewManagers(@NonNull ReactApplicationContext reactContext) { 26 | return Collections.emptyList(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['module:metro-react-native-babel-preset'], 3 | }; 4 | -------------------------------------------------------------------------------- /cpp/hmac/hmac_sha1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #include "../sha/sha1.cpp" 8 | 9 | static std::string Sha1(const std::string &message) 10 | { 11 | SHA1 sha1; 12 | sha1.update(message); 13 | std::string digest = sha1.final(); 14 | 15 | std::stringstream ss; 16 | ss << std::hex << std::setfill('0'); 17 | for (size_t i = 0; i < digest.length(); ++i) 18 | ss << std::setw(2) << static_cast(static_cast(digest[i])); 19 | 20 | return ss.str(); 21 | } 22 | 23 | static std::string KeyPadding(const std::string &key) 24 | { 25 | std::string paddedKey = key; 26 | if (key.length() > 64) 27 | paddedKey = Sha1(key); 28 | else if (key.length() < 64) 29 | paddedKey.append(64 - key.length(), 0x00); 30 | 31 | return paddedKey; 32 | } 33 | 34 | static std::string XorString(const std::string &a, const std::string &b) 35 | { 36 | std::string result; 37 | for (size_t i = 0; i < a.length(); ++i) 38 | result.push_back(a[i] ^ b[i]); 39 | 40 | return result; 41 | } 42 | 43 | static std::string HMAC(const std::string &key, const std::string &message) 44 | { 45 | std::string paddedKey = KeyPadding(key); 46 | std::string innerKey = XorString(paddedKey, std::string(64, 0x36)); 47 | std::string outerKey = XorString(paddedKey, std::string(64, 0x5C)); 48 | 49 | std::string innerHash = Sha1(innerKey + message); 50 | std::string hmac = Sha1(outerKey + innerHash); 51 | 52 | return hmac; 53 | } 54 | -------------------------------------------------------------------------------- /cpp/react-native-totp-utils.cpp: -------------------------------------------------------------------------------- 1 | #include "react-native-totp-utils.h" 2 | 3 | namespace totputils 4 | { 5 | void install(Runtime& jsiRuntime) 6 | { 7 | // TotpUtils.generateSecretKey(...) 8 | auto totpUtilsGenerateSecretKey = Function::createFromHostFunction( 9 | jsiRuntime, PropNameID::forAscii(jsiRuntime, "generateSecretKey"), 1, 10 | [](Runtime &runtime, const Value &thisValue, const Value *arguments, 11 | size_t count) -> Value 12 | { 13 | int length = arguments[0].getNumber(); 14 | std::string secret = generateSecretKey(length); 15 | return Value(String::createFromUtf8(runtime, secret)); 16 | }); 17 | 18 | jsiRuntime.global().setProperty(jsiRuntime, "totpUtilsGenerateSecretKey", std::move(totpUtilsGenerateSecretKey)); 19 | 20 | // TotpUtils.generateOTP(...) 21 | auto totpUtilsGenerateOTP = Function::createFromHostFunction( 22 | jsiRuntime, PropNameID::forAscii(jsiRuntime, "generateOTP"), 3, 23 | [](Runtime &runtime, const Value &thisValue, const Value *arguments, 24 | size_t count) -> Value 25 | { 26 | std::string secret = arguments[0].toString(runtime).utf8(runtime); 27 | int digits = arguments[1].getNumber(); 28 | int timeStep = arguments[2].getNumber(); 29 | std::string otp = generateOTP(secret, digits, timeStep); 30 | return Value(String::createFromUtf8(runtime, otp)); 31 | }); 32 | 33 | jsiRuntime.global().setProperty(jsiRuntime, "totpUtilsGenerateOTP", std::move(totpUtilsGenerateOTP)); 34 | 35 | // TotpUtils.validateOTP(...) 36 | auto totpUtilsValidateOTP = Function::createFromHostFunction( 37 | jsiRuntime, PropNameID::forAscii(jsiRuntime, "validateOTP"), 5, 38 | [](Runtime &runtime, const Value &thisValue, const Value *arguments, 39 | size_t count) -> Value 40 | { 41 | std::string secret = arguments[0].toString(runtime).utf8(runtime); 42 | std::string otp = arguments[1].toString(runtime).utf8(runtime); 43 | int digits = arguments[2].getNumber(); 44 | int timeStep = arguments[3].getNumber(); 45 | int window = arguments[4].getNumber(); 46 | bool isValid = validateOTP(secret, otp, digits, timeStep, window); 47 | return Value(isValid); 48 | }); 49 | 50 | jsiRuntime.global().setProperty(jsiRuntime, "totpUtilsValidateOTP", std::move(totpUtilsValidateOTP)); 51 | 52 | 53 | } 54 | 55 | std::string generateSecretKey(int keyLength) 56 | { 57 | const std::string base32Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; 58 | std::string secretKey; 59 | secretKey.reserve(keyLength); 60 | 61 | // Initialize random number generator with a seed based on current time 62 | auto currentTime = std::chrono::system_clock::now(); 63 | auto timeSinceEpoch = currentTime.time_since_epoch(); 64 | auto seed = std::chrono::duration_cast(timeSinceEpoch).count(); 65 | std::mt19937 gen(static_cast(seed)); 66 | 67 | // Generate key using random base32 characters 68 | std::uniform_int_distribution distribution(0, base32Chars.size() - 1); 69 | for (int i = 0; i < keyLength; ++i) 70 | { 71 | secretKey.push_back(base32Chars[distribution(gen)]); 72 | } 73 | 74 | return secretKey; 75 | } 76 | 77 | std::string generateOTP(const std::string &secretKey, int digits, int timeStep) 78 | { 79 | // Get the current timestamp in seconds 80 | auto now = std::chrono::system_clock::now(); 81 | auto timestamp = std::chrono::duration_cast(now.time_since_epoch()).count(); 82 | 83 | // Compute the counter value based on the timestamp and time step 84 | uint64_t counter = static_cast(timestamp) / timeStep; 85 | 86 | // Convert the counter value to big-endian bytes 87 | unsigned char counterBytes[8]; 88 | for (int i = 7; i >= 0; --i) 89 | { 90 | counterBytes[i] = counter & 0xFF; 91 | counter >>= 8; 92 | } 93 | 94 | // Compute the HMAC-SHA1 hash of the counter value using the secret key 95 | std::string hmacResult = HMAC(secretKey, std::string(reinterpret_cast(counterBytes), sizeof(counterBytes))); 96 | 97 | // Extract the offset from the last 4 bits of the hash 98 | int offset = hmacResult[hmacResult.length() - 1] & 0x0F; 99 | 100 | // Compute the 4-byte binary code starting from the offset 101 | int binary = ((hmacResult[offset] & 0x7F) << 24) | 102 | ((hmacResult[offset + 1] & 0xFF) << 16) | 103 | ((hmacResult[offset + 2] & 0xFF) << 8) | 104 | (hmacResult[offset + 3] & 0xFF); 105 | 106 | // Compute the final OTP value by taking the modulo of the binary code 107 | int otp = binary % static_cast(std::pow(10, digits)); 108 | 109 | // Convert the OTP value to a string with leading zeros 110 | std::ostringstream oss; 111 | oss << std::setw(digits) << std::setfill('0') << otp; 112 | 113 | return oss.str(); 114 | } 115 | 116 | bool validateOTP(const std::string &secretKey, const std::string &otp, int digits, int timeStep, int window) 117 | { 118 | // Get the current timestamp in seconds 119 | auto now = std::chrono::system_clock::now(); 120 | auto timestamp = std::chrono::duration_cast(now.time_since_epoch()).count(); 121 | 122 | // Compute the counter value based on the timestamp and time step 123 | uint64_t counter = static_cast(timestamp) / timeStep; 124 | 125 | // Iterate over the window of counters and generate OTPs to validate 126 | for (int i = -window; i <= window; ++i) 127 | { 128 | uint64_t currentCounter = counter + i; 129 | 130 | // Convert the counter value to big-endian bytes 131 | unsigned char counterBytes[8]; 132 | for (int j = 7; j >= 0; --j) 133 | { 134 | counterBytes[j] = currentCounter & 0xFF; 135 | currentCounter >>= 8; 136 | } 137 | 138 | // Compute the HMAC-SHA1 hash of the counter value using the secret key 139 | std::string generatedOTP = HMAC(secretKey, std::string(reinterpret_cast(counterBytes), sizeof(counterBytes))); 140 | 141 | // Extract the offset from the last 4 bits of the hash 142 | int offset = generatedOTP[generatedOTP.length() - 1] & 0x0F; 143 | 144 | // Compute the 4-byte binary code starting from the offset 145 | int binary = ((generatedOTP[offset] & 0x7F) << 24) | 146 | ((generatedOTP[offset + 1] & 0xFF) << 16) | 147 | ((generatedOTP[offset + 2] & 0xFF) << 8) | 148 | (generatedOTP[offset + 3] & 0xFF); 149 | 150 | // Compute the final OTP value by taking the modulo of the binary code 151 | int generatedOTPValue = binary % static_cast(std::pow(10, digits)); 152 | 153 | // Convert the OTP value to a string with leading zeros 154 | std::ostringstream oss; 155 | oss << std::setw(digits) << std::setfill('0') << generatedOTPValue; 156 | std::string generatedOTPString = oss.str(); 157 | 158 | if (generatedOTPString == otp) 159 | { 160 | return true; // OTP is valid 161 | } 162 | } 163 | 164 | return false; // OTP is not valid 165 | } 166 | 167 | } 168 | -------------------------------------------------------------------------------- /cpp/react-native-totp-utils.h: -------------------------------------------------------------------------------- 1 | #ifndef TOTPUTILS_H 2 | #define TOTPUTILS_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "hmac/hmac_sha1.cpp" 9 | 10 | using namespace facebook::jsi; 11 | 12 | const int DEFAULT_KEY_LENGTH = 16; 13 | const int DEFAULT_DIGITS = 6; 14 | const int DEFAULT_TIMESTEP = 30; 15 | const int DEFAULT_WINDOW = 1; 16 | 17 | 18 | namespace totputils { 19 | void install(Runtime& jsiRuntime); 20 | 21 | std::string generateSecretKey(int length = DEFAULT_KEY_LENGTH); 22 | 23 | std::string generateOTP(const std::string &secretKey, int digits = DEFAULT_DIGITS, int timeStep = DEFAULT_TIMESTEP); 24 | 25 | bool validateOTP(const std::string &secretKey, const std::string &otp, int digits = DEFAULT_DIGITS, int timeStep = DEFAULT_TIMESTEP, int window = DEFAULT_WINDOW); 26 | } 27 | 28 | #endif /* TOTPUTILS_H */ 29 | -------------------------------------------------------------------------------- /cpp/sha/sha1.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | sha1.hpp - source code of 3 | 4 | ============ 5 | SHA-1 in C++ 6 | ============ 7 | 8 | 100% Public Domain. 9 | 10 | Original C Code 11 | -- Steve Reid 12 | Small changes to fit into bglibs 13 | -- Bruce Guenter 14 | Translation to simpler C++ Code 15 | -- Volker Diels-Grabsch 16 | Safety fixes 17 | -- Eugene Hopkinson 18 | Header-only library 19 | -- Zlatko Michailov 20 | */ 21 | 22 | #ifndef SHA1_HPP 23 | #define SHA1_HPP 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | class SHA1 33 | { 34 | public: 35 | SHA1(); 36 | void update(const std::string &s); 37 | void update(std::istream &is); 38 | std::string final(); 39 | static std::string from_file(const std::string &filename); 40 | 41 | private: 42 | uint32_t digest[5]; 43 | std::string buffer; 44 | uint64_t transforms; 45 | }; 46 | 47 | static const size_t BLOCK_INTS = 16; /* number of 32bit integers per SHA1 block */ 48 | static const size_t BLOCK_BYTES = BLOCK_INTS * 4; 49 | 50 | inline static void reset(uint32_t digest[], std::string &buffer, uint64_t &transforms) 51 | { 52 | /* SHA1 initialization constants */ 53 | digest[0] = 0x67452301; 54 | digest[1] = 0xefcdab89; 55 | digest[2] = 0x98badcfe; 56 | digest[3] = 0x10325476; 57 | digest[4] = 0xc3d2e1f0; 58 | 59 | /* Reset counters */ 60 | buffer = ""; 61 | transforms = 0; 62 | } 63 | 64 | inline static uint32_t rol(const uint32_t value, const size_t bits) 65 | { 66 | return (value << bits) | (value >> (32 - bits)); 67 | } 68 | 69 | inline static uint32_t blk(const uint32_t block[BLOCK_INTS], const size_t i) 70 | { 71 | return rol(block[(i + 13) & 15] ^ block[(i + 8) & 15] ^ block[(i + 2) & 15] ^ block[i], 1); 72 | } 73 | 74 | /* 75 | * (R0+R1), R2, R3, R4 are the different operations used in SHA1 76 | */ 77 | 78 | inline static void R0(const uint32_t block[BLOCK_INTS], const uint32_t v, uint32_t &w, const uint32_t x, const uint32_t y, uint32_t &z, const size_t i) 79 | { 80 | z += ((w & (x ^ y)) ^ y) + block[i] + 0x5a827999 + rol(v, 5); 81 | w = rol(w, 30); 82 | } 83 | 84 | inline static void R1(uint32_t block[BLOCK_INTS], const uint32_t v, uint32_t &w, const uint32_t x, const uint32_t y, uint32_t &z, const size_t i) 85 | { 86 | block[i] = blk(block, i); 87 | z += ((w & (x ^ y)) ^ y) + block[i] + 0x5a827999 + rol(v, 5); 88 | w = rol(w, 30); 89 | } 90 | 91 | inline static void R2(uint32_t block[BLOCK_INTS], const uint32_t v, uint32_t &w, const uint32_t x, const uint32_t y, uint32_t &z, const size_t i) 92 | { 93 | block[i] = blk(block, i); 94 | z += (w ^ x ^ y) + block[i] + 0x6ed9eba1 + rol(v, 5); 95 | w = rol(w, 30); 96 | } 97 | 98 | inline static void R3(uint32_t block[BLOCK_INTS], const uint32_t v, uint32_t &w, const uint32_t x, const uint32_t y, uint32_t &z, const size_t i) 99 | { 100 | block[i] = blk(block, i); 101 | z += (((w | x) & y) | (w & x)) + block[i] + 0x8f1bbcdc + rol(v, 5); 102 | w = rol(w, 30); 103 | } 104 | 105 | inline static void R4(uint32_t block[BLOCK_INTS], const uint32_t v, uint32_t &w, const uint32_t x, const uint32_t y, uint32_t &z, const size_t i) 106 | { 107 | block[i] = blk(block, i); 108 | z += (w ^ x ^ y) + block[i] + 0xca62c1d6 + rol(v, 5); 109 | w = rol(w, 30); 110 | } 111 | 112 | /* 113 | * Hash a single 512-bit block. This is the core of the algorithm. 114 | */ 115 | 116 | inline static void transform(uint32_t digest[], uint32_t block[BLOCK_INTS], uint64_t &transforms) 117 | { 118 | /* Copy digest[] to working vars */ 119 | uint32_t a = digest[0]; 120 | uint32_t b = digest[1]; 121 | uint32_t c = digest[2]; 122 | uint32_t d = digest[3]; 123 | uint32_t e = digest[4]; 124 | 125 | /* 4 rounds of 20 operations each. Loop unrolled. */ 126 | R0(block, a, b, c, d, e, 0); 127 | R0(block, e, a, b, c, d, 1); 128 | R0(block, d, e, a, b, c, 2); 129 | R0(block, c, d, e, a, b, 3); 130 | R0(block, b, c, d, e, a, 4); 131 | R0(block, a, b, c, d, e, 5); 132 | R0(block, e, a, b, c, d, 6); 133 | R0(block, d, e, a, b, c, 7); 134 | R0(block, c, d, e, a, b, 8); 135 | R0(block, b, c, d, e, a, 9); 136 | R0(block, a, b, c, d, e, 10); 137 | R0(block, e, a, b, c, d, 11); 138 | R0(block, d, e, a, b, c, 12); 139 | R0(block, c, d, e, a, b, 13); 140 | R0(block, b, c, d, e, a, 14); 141 | R0(block, a, b, c, d, e, 15); 142 | R1(block, e, a, b, c, d, 0); 143 | R1(block, d, e, a, b, c, 1); 144 | R1(block, c, d, e, a, b, 2); 145 | R1(block, b, c, d, e, a, 3); 146 | R2(block, a, b, c, d, e, 4); 147 | R2(block, e, a, b, c, d, 5); 148 | R2(block, d, e, a, b, c, 6); 149 | R2(block, c, d, e, a, b, 7); 150 | R2(block, b, c, d, e, a, 8); 151 | R2(block, a, b, c, d, e, 9); 152 | R2(block, e, a, b, c, d, 10); 153 | R2(block, d, e, a, b, c, 11); 154 | R2(block, c, d, e, a, b, 12); 155 | R2(block, b, c, d, e, a, 13); 156 | R2(block, a, b, c, d, e, 14); 157 | R2(block, e, a, b, c, d, 15); 158 | R2(block, d, e, a, b, c, 0); 159 | R2(block, c, d, e, a, b, 1); 160 | R2(block, b, c, d, e, a, 2); 161 | R2(block, a, b, c, d, e, 3); 162 | R2(block, e, a, b, c, d, 4); 163 | R2(block, d, e, a, b, c, 5); 164 | R2(block, c, d, e, a, b, 6); 165 | R2(block, b, c, d, e, a, 7); 166 | R3(block, a, b, c, d, e, 8); 167 | R3(block, e, a, b, c, d, 9); 168 | R3(block, d, e, a, b, c, 10); 169 | R3(block, c, d, e, a, b, 11); 170 | R3(block, b, c, d, e, a, 12); 171 | R3(block, a, b, c, d, e, 13); 172 | R3(block, e, a, b, c, d, 14); 173 | R3(block, d, e, a, b, c, 15); 174 | R3(block, c, d, e, a, b, 0); 175 | R3(block, b, c, d, e, a, 1); 176 | R3(block, a, b, c, d, e, 2); 177 | R3(block, e, a, b, c, d, 3); 178 | R3(block, d, e, a, b, c, 4); 179 | R3(block, c, d, e, a, b, 5); 180 | R3(block, b, c, d, e, a, 6); 181 | R3(block, a, b, c, d, e, 7); 182 | R3(block, e, a, b, c, d, 8); 183 | R3(block, d, e, a, b, c, 9); 184 | R3(block, c, d, e, a, b, 10); 185 | R3(block, b, c, d, e, a, 11); 186 | R4(block, a, b, c, d, e, 12); 187 | R4(block, e, a, b, c, d, 13); 188 | R4(block, d, e, a, b, c, 14); 189 | R4(block, c, d, e, a, b, 15); 190 | R4(block, b, c, d, e, a, 0); 191 | R4(block, a, b, c, d, e, 1); 192 | R4(block, e, a, b, c, d, 2); 193 | R4(block, d, e, a, b, c, 3); 194 | R4(block, c, d, e, a, b, 4); 195 | R4(block, b, c, d, e, a, 5); 196 | R4(block, a, b, c, d, e, 6); 197 | R4(block, e, a, b, c, d, 7); 198 | R4(block, d, e, a, b, c, 8); 199 | R4(block, c, d, e, a, b, 9); 200 | R4(block, b, c, d, e, a, 10); 201 | R4(block, a, b, c, d, e, 11); 202 | R4(block, e, a, b, c, d, 12); 203 | R4(block, d, e, a, b, c, 13); 204 | R4(block, c, d, e, a, b, 14); 205 | R4(block, b, c, d, e, a, 15); 206 | 207 | /* Add the working vars back into digest[] */ 208 | digest[0] += a; 209 | digest[1] += b; 210 | digest[2] += c; 211 | digest[3] += d; 212 | digest[4] += e; 213 | 214 | /* Count the number of transformations */ 215 | transforms++; 216 | } 217 | 218 | inline static void buffer_to_block(const std::string &buffer, uint32_t block[BLOCK_INTS]) 219 | { 220 | /* Convert the std::string (byte buffer) to a uint32_t array (MSB) */ 221 | for (size_t i = 0; i < BLOCK_INTS; i++) 222 | { 223 | block[i] = (buffer[4 * i + 3] & 0xff) | (buffer[4 * i + 2] & 0xff) << 8 | (buffer[4 * i + 1] & 0xff) << 16 | (buffer[4 * i + 0] & 0xff) << 24; 224 | } 225 | } 226 | 227 | inline SHA1::SHA1() 228 | { 229 | reset(digest, buffer, transforms); 230 | } 231 | 232 | inline void SHA1::update(const std::string &s) 233 | { 234 | std::istringstream is(s); 235 | update(is); 236 | } 237 | 238 | inline void SHA1::update(std::istream &is) 239 | { 240 | while (true) 241 | { 242 | char sbuf[BLOCK_BYTES]; 243 | is.read(sbuf, BLOCK_BYTES - buffer.size()); 244 | buffer.append(sbuf, (std::size_t)is.gcount()); 245 | if (buffer.size() != BLOCK_BYTES) 246 | { 247 | return; 248 | } 249 | uint32_t block[BLOCK_INTS]; 250 | buffer_to_block(buffer, block); 251 | transform(digest, block, transforms); 252 | buffer.clear(); 253 | } 254 | } 255 | 256 | /* 257 | * Add padding and return the message digest. 258 | */ 259 | 260 | inline std::string SHA1::final() 261 | { 262 | /* Total number of hashed bits */ 263 | uint64_t total_bits = (transforms * BLOCK_BYTES + buffer.size()) * 8; 264 | 265 | /* Padding */ 266 | buffer += (char)0x80; 267 | size_t orig_size = buffer.size(); 268 | while (buffer.size() < BLOCK_BYTES) 269 | { 270 | buffer += (char)0x00; 271 | } 272 | 273 | uint32_t block[BLOCK_INTS]; 274 | buffer_to_block(buffer, block); 275 | 276 | if (orig_size > BLOCK_BYTES - 8) 277 | { 278 | transform(digest, block, transforms); 279 | for (size_t i = 0; i < BLOCK_INTS - 2; i++) 280 | { 281 | block[i] = 0; 282 | } 283 | } 284 | 285 | /* Append total_bits, split this uint64_t into two uint32_t */ 286 | block[BLOCK_INTS - 1] = (uint32_t)total_bits; 287 | block[BLOCK_INTS - 2] = (uint32_t)(total_bits >> 32); 288 | transform(digest, block, transforms); 289 | 290 | /* Hex std::string */ 291 | std::ostringstream result; 292 | for (size_t i = 0; i < sizeof(digest) / sizeof(digest[0]); i++) 293 | { 294 | result << std::hex << std::setfill('0') << std::setw(8); 295 | result << digest[i]; 296 | } 297 | 298 | /* Reset for next run */ 299 | reset(digest, buffer, transforms); 300 | 301 | return result.str(); 302 | } 303 | 304 | inline std::string SHA1::from_file(const std::string &filename) 305 | { 306 | std::ifstream stream(filename.c_str(), std::ios::binary); 307 | SHA1 checksum; 308 | checksum.update(stream); 309 | return checksum.final(); 310 | } 311 | 312 | #endif /* SHA1_HPP */ -------------------------------------------------------------------------------- /example/.bundle/config: -------------------------------------------------------------------------------- 1 | BUNDLE_PATH: "vendor/bundle" 2 | BUNDLE_FORCE_RUBY_PLATFORM: 1 3 | -------------------------------------------------------------------------------- /example/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /example/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # You may use http://rbenv.org/ or https://rvm.io/ to install and use this version 4 | ruby ">= 2.6.10" 5 | gem 'cocoapods', '~> 1.12' 6 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: "com.android.application" 2 | apply plugin: "com.facebook.react" 3 | 4 | /** 5 | * This is the configuration block to customize your React Native Android app. 6 | * By default you don't need to apply any configuration, just uncomment the lines you need. 7 | */ 8 | react { 9 | /* Folders */ 10 | // The root of your project, i.e. where "package.json" lives. Default is '..' 11 | // root = file("../") 12 | // The folder where the react-native NPM package is. Default is ../node_modules/react-native 13 | // reactNativeDir = file("../node_modules/react-native") 14 | // The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen 15 | // codegenDir = file("../node_modules/@react-native/codegen") 16 | // The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js 17 | // cliFile = file("../node_modules/react-native/cli.js") 18 | 19 | /* Variants */ 20 | // The list of variants to that are debuggable. For those we're going to 21 | // skip the bundling of the JS bundle and the assets. By default is just 'debug'. 22 | // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants. 23 | // debuggableVariants = ["liteDebug", "prodDebug"] 24 | 25 | /* Bundling */ 26 | // A list containing the node command and its flags. Default is just 'node'. 27 | // nodeExecutableAndArgs = ["node"] 28 | // 29 | // The command to run when bundling. By default is 'bundle' 30 | // bundleCommand = "ram-bundle" 31 | // 32 | // The path to the CLI configuration file. Default is empty. 33 | // bundleConfig = file(../rn-cli.config.js) 34 | // 35 | // The name of the generated asset file containing your JS bundle 36 | // bundleAssetName = "MyApplication.android.bundle" 37 | // 38 | // The entry file for bundle generation. Default is 'index.android.js' or 'index.js' 39 | // entryFile = file("../js/MyApplication.android.js") 40 | // 41 | // A list of extra flags to pass to the 'bundle' commands. 42 | // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle 43 | // extraPackagerArgs = [] 44 | 45 | /* Hermes Commands */ 46 | // The hermes compiler command to run. By default it is 'hermesc' 47 | // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc" 48 | // 49 | // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map" 50 | // hermesFlags = ["-O", "-output-source-map"] 51 | } 52 | 53 | /** 54 | * Set this to true to Run Proguard on Release builds to minify the Java bytecode. 55 | */ 56 | def enableProguardInReleaseBuilds = false 57 | 58 | /** 59 | * The preferred build flavor of JavaScriptCore (JSC) 60 | * 61 | * For example, to use the international variant, you can use: 62 | * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` 63 | * 64 | * The international variant includes ICU i18n library and necessary data 65 | * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that 66 | * give correct results when using with locales other than en-US. Note that 67 | * this variant is about 6MiB larger per architecture than default. 68 | */ 69 | def jscFlavor = 'org.webkit:android-jsc:+' 70 | 71 | android { 72 | ndkVersion rootProject.ext.ndkVersion 73 | 74 | compileSdkVersion rootProject.ext.compileSdkVersion 75 | 76 | namespace "com.totputilsexample" 77 | defaultConfig { 78 | applicationId "com.totputilsexample" 79 | minSdkVersion rootProject.ext.minSdkVersion 80 | targetSdkVersion rootProject.ext.targetSdkVersion 81 | versionCode 1 82 | versionName "1.0" 83 | } 84 | 85 | signingConfigs { 86 | debug { 87 | storeFile file('debug.keystore') 88 | storePassword 'android' 89 | keyAlias 'androiddebugkey' 90 | keyPassword 'android' 91 | } 92 | } 93 | buildTypes { 94 | debug { 95 | signingConfig signingConfigs.debug 96 | } 97 | release { 98 | // Caution! In production, you need to generate your own keystore file. 99 | // see https://reactnative.dev/docs/signed-apk-android. 100 | signingConfig signingConfigs.debug 101 | minifyEnabled enableProguardInReleaseBuilds 102 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 103 | } 104 | } 105 | } 106 | 107 | dependencies { 108 | // The version of react-native is set by the React Native Gradle Plugin 109 | implementation("com.facebook.react:react-android") 110 | 111 | debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") 112 | debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { 113 | exclude group:'com.squareup.okhttp3', module:'okhttp' 114 | } 115 | 116 | debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") 117 | if (hermesEnabled.toBoolean()) { 118 | implementation("com.facebook.react:hermes-android") 119 | } else { 120 | implementation jscFlavor 121 | } 122 | } 123 | 124 | apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) 125 | -------------------------------------------------------------------------------- /example/android/app/debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4cc3ssX/react-native-totp-utils/4e7ccd0561294bc509121389977c45d0fd4541bf/example/android/app/debug.keystore -------------------------------------------------------------------------------- /example/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /example/android/app/src/debug/java/com/totputilsexample/ReactNativeFlipper.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | *

This source code is licensed under the MIT license found in the LICENSE file in the root 5 | * directory of this source tree. 6 | */ 7 | package com.totputilsexample; 8 | 9 | import android.content.Context; 10 | import com.facebook.flipper.android.AndroidFlipperClient; 11 | import com.facebook.flipper.android.utils.FlipperUtils; 12 | import com.facebook.flipper.core.FlipperClient; 13 | import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin; 14 | import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin; 15 | import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin; 16 | import com.facebook.flipper.plugins.inspector.DescriptorMapping; 17 | import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin; 18 | import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor; 19 | import com.facebook.flipper.plugins.network.NetworkFlipperPlugin; 20 | import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin; 21 | import com.facebook.react.ReactInstanceEventListener; 22 | import com.facebook.react.ReactInstanceManager; 23 | import com.facebook.react.bridge.ReactContext; 24 | import com.facebook.react.modules.network.NetworkingModule; 25 | import okhttp3.OkHttpClient; 26 | 27 | /** 28 | * Class responsible of loading Flipper inside your React Native application. This is the debug 29 | * flavor of it. Here you can add your own plugins and customize the Flipper setup. 30 | */ 31 | public class ReactNativeFlipper { 32 | public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) { 33 | if (FlipperUtils.shouldEnableFlipper(context)) { 34 | final FlipperClient client = AndroidFlipperClient.getInstance(context); 35 | 36 | client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults())); 37 | client.addPlugin(new DatabasesFlipperPlugin(context)); 38 | client.addPlugin(new SharedPreferencesFlipperPlugin(context)); 39 | client.addPlugin(CrashReporterPlugin.getInstance()); 40 | 41 | NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin(); 42 | NetworkingModule.setCustomClientBuilder( 43 | new NetworkingModule.CustomClientBuilder() { 44 | @Override 45 | public void apply(OkHttpClient.Builder builder) { 46 | builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin)); 47 | } 48 | }); 49 | client.addPlugin(networkFlipperPlugin); 50 | client.start(); 51 | 52 | // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized 53 | // Hence we run if after all native modules have been initialized 54 | ReactContext reactContext = reactInstanceManager.getCurrentReactContext(); 55 | if (reactContext == null) { 56 | reactInstanceManager.addReactInstanceEventListener( 57 | new ReactInstanceEventListener() { 58 | @Override 59 | public void onReactContextInitialized(ReactContext reactContext) { 60 | reactInstanceManager.removeReactInstanceEventListener(this); 61 | reactContext.runOnNativeModulesQueueThread( 62 | new Runnable() { 63 | @Override 64 | public void run() { 65 | client.addPlugin(new FrescoFlipperPlugin()); 66 | } 67 | }); 68 | } 69 | }); 70 | } else { 71 | client.addPlugin(new FrescoFlipperPlugin()); 72 | } 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 12 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/com/totputilsexample/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.totputilsexample; 2 | 3 | import com.facebook.react.ReactActivity; 4 | import com.facebook.react.ReactActivityDelegate; 5 | import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint; 6 | import com.facebook.react.defaults.DefaultReactActivityDelegate; 7 | 8 | public class MainActivity extends ReactActivity { 9 | 10 | /** 11 | * Returns the name of the main component registered from JavaScript. This is used to schedule 12 | * rendering of the component. 13 | */ 14 | @Override 15 | protected String getMainComponentName() { 16 | return "TotpUtilsExample"; 17 | } 18 | 19 | /** 20 | * Returns the instance of the {@link ReactActivityDelegate}. Here we use a util class {@link 21 | * DefaultReactActivityDelegate} which allows you to easily enable Fabric and Concurrent React 22 | * (aka React 18) with two boolean flags. 23 | */ 24 | @Override 25 | protected ReactActivityDelegate createReactActivityDelegate() { 26 | return new DefaultReactActivityDelegate( 27 | this, 28 | getMainComponentName(), 29 | // If you opted-in for the New Architecture, we enable the Fabric Renderer. 30 | DefaultNewArchitectureEntryPoint.getFabricEnabled()); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/com/totputilsexample/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.totputilsexample; 2 | 3 | import android.app.Application; 4 | import com.facebook.react.PackageList; 5 | import com.facebook.react.ReactApplication; 6 | import com.facebook.react.ReactNativeHost; 7 | import com.facebook.react.ReactPackage; 8 | import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint; 9 | import com.facebook.react.defaults.DefaultReactNativeHost; 10 | import com.facebook.soloader.SoLoader; 11 | 12 | import java.util.List; 13 | 14 | public class MainApplication extends Application implements ReactApplication { 15 | 16 | private final ReactNativeHost mReactNativeHost = 17 | new DefaultReactNativeHost(this) { 18 | @Override 19 | public boolean getUseDeveloperSupport() { 20 | return BuildConfig.DEBUG; 21 | } 22 | 23 | @Override 24 | protected List getPackages() { 25 | @SuppressWarnings("UnnecessaryLocalVariable") 26 | List packages = new PackageList(this).getPackages(); 27 | // Packages that cannot be autolinked yet can be added manually here, for example: 28 | // packages.add(new MyReactNativePackage()); 29 | return packages; 30 | } 31 | 32 | @Override 33 | protected String getJSMainModuleName() { 34 | return "index"; 35 | } 36 | 37 | @Override 38 | protected boolean isNewArchEnabled() { 39 | return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED; 40 | } 41 | 42 | @Override 43 | protected Boolean isHermesEnabled() { 44 | return BuildConfig.IS_HERMES_ENABLED; 45 | } 46 | }; 47 | 48 | @Override 49 | public ReactNativeHost getReactNativeHost() { 50 | return mReactNativeHost; 51 | } 52 | 53 | @Override 54 | public void onCreate() { 55 | super.onCreate(); 56 | SoLoader.init(this, /* native exopackage */ false); 57 | if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { 58 | // If you opted-in for the New Architecture, we load the native entry point for this app. 59 | DefaultNewArchitectureEntryPoint.load(); 60 | } 61 | ReactNativeFlipper.initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/rn_edit_text_material.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 21 | 22 | 23 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4cc3ssX/react-native-totp-utils/4e7ccd0561294bc509121389977c45d0fd4541bf/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4cc3ssX/react-native-totp-utils/4e7ccd0561294bc509121389977c45d0fd4541bf/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4cc3ssX/react-native-totp-utils/4e7ccd0561294bc509121389977c45d0fd4541bf/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4cc3ssX/react-native-totp-utils/4e7ccd0561294bc509121389977c45d0fd4541bf/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4cc3ssX/react-native-totp-utils/4e7ccd0561294bc509121389977c45d0fd4541bf/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4cc3ssX/react-native-totp-utils/4e7ccd0561294bc509121389977c45d0fd4541bf/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4cc3ssX/react-native-totp-utils/4e7ccd0561294bc509121389977c45d0fd4541bf/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4cc3ssX/react-native-totp-utils/4e7ccd0561294bc509121389977c45d0fd4541bf/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4cc3ssX/react-native-totp-utils/4e7ccd0561294bc509121389977c45d0fd4541bf/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4cc3ssX/react-native-totp-utils/4e7ccd0561294bc509121389977c45d0fd4541bf/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | TotpUtilsExample 3 | 4 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /example/android/app/src/release/java/com/totputilsexample/ReactNativeFlipper.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | *

This source code is licensed under the MIT license found in the LICENSE file in the root 5 | * directory of this source tree. 6 | */ 7 | package com.totputilsexample; 8 | 9 | import android.content.Context; 10 | import com.facebook.react.ReactInstanceManager; 11 | 12 | /** 13 | * Class responsible of loading Flipper inside your React Native application. This is the release 14 | * flavor of it so it's empty as we don't want to load Flipper. 15 | */ 16 | public class ReactNativeFlipper { 17 | public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) { 18 | // Do nothing as we don't want to initialize Flipper on Release. 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext { 5 | buildToolsVersion = "33.0.0" 6 | minSdkVersion = 21 7 | compileSdkVersion = 33 8 | targetSdkVersion = 33 9 | 10 | // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP. 11 | ndkVersion = "23.1.7779620" 12 | } 13 | repositories { 14 | google() 15 | mavenCentral() 16 | } 17 | dependencies { 18 | classpath("com.android.tools.build:gradle") 19 | classpath("com.facebook.react:react-native-gradle-plugin") 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx512m -XX:MaxMetaspaceSize=256m 13 | org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | # AndroidX package structure to make it clearer which packages are bundled with the 21 | # Android operating system, and which are packaged with your app's APK 22 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 23 | android.useAndroidX=true 24 | # Automatically convert third-party libraries to use AndroidX 25 | android.enableJetifier=true 26 | 27 | # Version of flipper SDK to use with React Native 28 | FLIPPER_VERSION=0.182.0 29 | 30 | # Use this property to specify which architecture you want to build. 31 | # You can also override it from the CLI using 32 | # ./gradlew -PreactNativeArchitectures=x86_64 33 | reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64 34 | 35 | # Use this property to enable support to the new architecture. 36 | # This will allow you to use TurboModules and the Fabric render in 37 | # your application. You should enable this flag either if you want 38 | # to write custom TurboModules/Fabric components OR use libraries that 39 | # are providing them. 40 | newArchEnabled=true 41 | 42 | # Use this property to enable or disable the Hermes JS engine. 43 | # If set to false, you will be using JSC instead. 44 | hermesEnabled=true 45 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4cc3ssX/react-native-totp-utils/4e7ccd0561294bc509121389977c45d0fd4541bf/example/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-all.zip 4 | networkTimeout=10000 5 | zipStoreBase=GRADLE_USER_HOME 6 | zipStorePath=wrapper/dists 7 | -------------------------------------------------------------------------------- /example/android/gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | # 21 | # Gradle start up script for POSIX generated by Gradle. 22 | # 23 | # Important for running: 24 | # 25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 26 | # noncompliant, but you have some other compliant shell such as ksh or 27 | # bash, then to run this script, type that shell name before the whole 28 | # command line, like: 29 | # 30 | # ksh Gradle 31 | # 32 | # Busybox and similar reduced shells will NOT work, because this script 33 | # requires all of these POSIX shell features: 34 | # * functions; 35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 37 | # * compound commands having a testable exit status, especially «case»; 38 | # * various built-in commands including «command», «set», and «ulimit». 39 | # 40 | # Important for patching: 41 | # 42 | # (2) This script targets any POSIX shell, so it avoids extensions provided 43 | # by Bash, Ksh, etc; in particular arrays are avoided. 44 | # 45 | # The "traditional" practice of packing multiple parameters into a 46 | # space-separated string is a well documented source of bugs and security 47 | # problems, so this is (mostly) avoided, by progressively accumulating 48 | # options in "$@", and eventually passing that to Java. 49 | # 50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 52 | # see the in-line comments for details. 53 | # 54 | # There are tweaks for specific operating systems such as AIX, CygWin, 55 | # Darwin, MinGW, and NonStop. 56 | # 57 | # (3) This script is generated from the Groovy template 58 | # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 59 | # within the Gradle project. 60 | # 61 | # You can find Gradle at https://github.com/gradle/gradle/. 62 | # 63 | ############################################################################## 64 | 65 | # Attempt to set APP_HOME 66 | 67 | # Resolve links: $0 may be a link 68 | app_path=$0 69 | 70 | # Need this for daisy-chained symlinks. 71 | while 72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 73 | [ -h "$app_path" ] 74 | do 75 | ls=$( ls -ld "$app_path" ) 76 | link=${ls#*' -> '} 77 | case $link in #( 78 | /*) app_path=$link ;; #( 79 | *) app_path=$APP_HOME$link ;; 80 | esac 81 | done 82 | 83 | # This is normally unused 84 | # shellcheck disable=SC2034 85 | APP_BASE_NAME=${0##*/} 86 | APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit 87 | 88 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 89 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 90 | 91 | # Use the maximum available, or set MAX_FD != -1 to use that value. 92 | MAX_FD=maximum 93 | 94 | warn () { 95 | echo "$*" 96 | } >&2 97 | 98 | die () { 99 | echo 100 | echo "$*" 101 | echo 102 | exit 1 103 | } >&2 104 | 105 | # OS specific support (must be 'true' or 'false'). 106 | cygwin=false 107 | msys=false 108 | darwin=false 109 | nonstop=false 110 | case "$( uname )" in #( 111 | CYGWIN* ) cygwin=true ;; #( 112 | Darwin* ) darwin=true ;; #( 113 | MSYS* | MINGW* ) msys=true ;; #( 114 | NONSTOP* ) nonstop=true ;; 115 | esac 116 | 117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 118 | 119 | 120 | # Determine the Java command to use to start the JVM. 121 | if [ -n "$JAVA_HOME" ] ; then 122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 123 | # IBM's JDK on AIX uses strange locations for the executables 124 | JAVACMD=$JAVA_HOME/jre/sh/java 125 | else 126 | JAVACMD=$JAVA_HOME/bin/java 127 | fi 128 | if [ ! -x "$JAVACMD" ] ; then 129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 130 | 131 | Please set the JAVA_HOME variable in your environment to match the 132 | location of your Java installation." 133 | fi 134 | else 135 | JAVACMD=java 136 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 137 | 138 | Please set the JAVA_HOME variable in your environment to match the 139 | location of your Java installation." 140 | fi 141 | 142 | # Increase the maximum file descriptors if we can. 143 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 144 | case $MAX_FD in #( 145 | max*) 146 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. 147 | # shellcheck disable=SC3045 148 | MAX_FD=$( ulimit -H -n ) || 149 | warn "Could not query maximum file descriptor limit" 150 | esac 151 | case $MAX_FD in #( 152 | '' | soft) :;; #( 153 | *) 154 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. 155 | # shellcheck disable=SC3045 156 | ulimit -n "$MAX_FD" || 157 | warn "Could not set maximum file descriptor limit to $MAX_FD" 158 | esac 159 | fi 160 | 161 | # Collect all arguments for the java command, stacking in reverse order: 162 | # * args from the command line 163 | # * the main class name 164 | # * -classpath 165 | # * -D...appname settings 166 | # * --module-path (only if needed) 167 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 168 | 169 | # For Cygwin or MSYS, switch paths to Windows format before running java 170 | if "$cygwin" || "$msys" ; then 171 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 172 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 173 | 174 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 175 | 176 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 177 | for arg do 178 | if 179 | case $arg in #( 180 | -*) false ;; # don't mess with options #( 181 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 182 | [ -e "$t" ] ;; #( 183 | *) false ;; 184 | esac 185 | then 186 | arg=$( cygpath --path --ignore --mixed "$arg" ) 187 | fi 188 | # Roll the args list around exactly as many times as the number of 189 | # args, so each arg winds up back in the position where it started, but 190 | # possibly modified. 191 | # 192 | # NB: a `for` loop captures its iteration list before it begins, so 193 | # changing the positional parameters here affects neither the number of 194 | # iterations, nor the values presented in `arg`. 195 | shift # remove old arg 196 | set -- "$@" "$arg" # push replacement arg 197 | done 198 | fi 199 | 200 | # Collect all arguments for the java command; 201 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of 202 | # shell script including quotes and variable substitutions, so put them in 203 | # double quotes to make sure that they get re-expanded; and 204 | # * put everything else in single quotes, so that it's not re-expanded. 205 | 206 | set -- \ 207 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 208 | -classpath "$CLASSPATH" \ 209 | org.gradle.wrapper.GradleWrapperMain \ 210 | "$@" 211 | 212 | # Stop when "xargs" is not available. 213 | if ! command -v xargs >/dev/null 2>&1 214 | then 215 | die "xargs is not available" 216 | fi 217 | 218 | # Use "xargs" to parse quoted args. 219 | # 220 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 221 | # 222 | # In Bash we could simply go: 223 | # 224 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 225 | # set -- "${ARGS[@]}" "$@" 226 | # 227 | # but POSIX shell has neither arrays nor command substitution, so instead we 228 | # post-process each arg (as a line of input to sed) to backslash-escape any 229 | # character that might be a shell metacharacter, then use eval to reverse 230 | # that process (while maintaining the separation between arguments), and wrap 231 | # the whole thing up as a single "set" statement. 232 | # 233 | # This will of course break if any of these variables contains a newline or 234 | # an unmatched quote. 235 | # 236 | 237 | eval "set -- $( 238 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 239 | xargs -n1 | 240 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 241 | tr '\n' ' ' 242 | )" '"$@"' 243 | 244 | exec "$JAVACMD" "$@" 245 | -------------------------------------------------------------------------------- /example/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%"=="" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%"=="" set DIRNAME=. 29 | @rem This is normally unused 30 | set APP_BASE_NAME=%~n0 31 | set APP_HOME=%DIRNAME% 32 | 33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 35 | 36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 38 | 39 | @rem Find java.exe 40 | if defined JAVA_HOME goto findJavaFromJavaHome 41 | 42 | set JAVA_EXE=java.exe 43 | %JAVA_EXE% -version >NUL 2>&1 44 | if %ERRORLEVEL% equ 0 goto execute 45 | 46 | echo. 47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 48 | echo. 49 | echo Please set the JAVA_HOME variable in your environment to match the 50 | echo location of your Java installation. 51 | 52 | goto fail 53 | 54 | :findJavaFromJavaHome 55 | set JAVA_HOME=%JAVA_HOME:"=% 56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 57 | 58 | if exist "%JAVA_EXE%" goto execute 59 | 60 | echo. 61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 62 | echo. 63 | echo Please set the JAVA_HOME variable in your environment to match the 64 | echo location of your Java installation. 65 | 66 | goto fail 67 | 68 | :execute 69 | @rem Setup the command line 70 | 71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 72 | 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if %ERRORLEVEL% equ 0 goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | 85 | set EXIT_CODE=%ERRORLEVEL% 86 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 87 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 88 | exit /b %EXIT_CODE% 89 | 90 | :mainEnd 91 | if "%OS%"=="Windows_NT" endlocal 92 | 93 | :omega 94 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'TotpUtilsExample' 2 | apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) 3 | include ':app' 4 | includeBuild('../node_modules/@react-native/gradle-plugin') 5 | -------------------------------------------------------------------------------- /example/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "TotpUtilsExample", 3 | "displayName": "TotpUtilsExample" 4 | } -------------------------------------------------------------------------------- /example/babel.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const pak = require('../package.json'); 3 | 4 | module.exports = { 5 | presets: ['module:metro-react-native-babel-preset'], 6 | plugins: [ 7 | [ 8 | 'module-resolver', 9 | { 10 | extensions: ['.tsx', '.ts', '.js', '.json'], 11 | alias: { 12 | [pak.name]: path.join(__dirname, '..', pak.source), 13 | }, 14 | }, 15 | ], 16 | ], 17 | }; 18 | -------------------------------------------------------------------------------- /example/index.js: -------------------------------------------------------------------------------- 1 | import { AppRegistry } from 'react-native'; 2 | import App from './src/App'; 3 | import { name as appName } from './app.json'; 4 | 5 | AppRegistry.registerComponent(appName, () => App); 6 | -------------------------------------------------------------------------------- /example/ios/.xcode.env: -------------------------------------------------------------------------------- 1 | # This `.xcode.env` file is versioned and is used to source the environment 2 | # used when running script phases inside Xcode. 3 | # To customize your local environment, you can create an `.xcode.env.local` 4 | # file that is not versioned. 5 | 6 | # NODE_BINARY variable contains the PATH to the node executable. 7 | # 8 | # Customize the NODE_BINARY variable here. 9 | # For example, to use nvm with brew, add the following line 10 | # . "$(brew --prefix nvm)/nvm.sh" --no-use 11 | export NODE_BINARY=$(command -v node) 12 | -------------------------------------------------------------------------------- /example/ios/File.swift: -------------------------------------------------------------------------------- 1 | // 2 | // File.swift 3 | // TotpUtilsExample 4 | // 5 | 6 | import Foundation 7 | -------------------------------------------------------------------------------- /example/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Resolve react_native_pods.rb with node to allow for hoisting 2 | require Pod::Executable.execute_command('node', ['-p', 3 | 'require.resolve( 4 | "react-native/scripts/react_native_pods.rb", 5 | {paths: [process.argv[1]]}, 6 | )', __dir__]).strip 7 | 8 | platform :ios, min_ios_version_supported 9 | prepare_react_native_project! 10 | 11 | # If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set. 12 | # because `react-native-flipper` depends on (FlipperKit,...) that will be excluded 13 | # 14 | # To fix this you can also exclude `react-native-flipper` using a `react-native.config.js` 15 | # ```js 16 | # module.exports = { 17 | # dependencies: { 18 | # ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}), 19 | # ``` 20 | flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled 21 | 22 | linkage = ENV['USE_FRAMEWORKS'] 23 | if linkage != nil 24 | Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green 25 | use_frameworks! :linkage => linkage.to_sym 26 | end 27 | 28 | target 'TotpUtilsExample' do 29 | config = use_native_modules! 30 | 31 | # Flags change depending on the env values. 32 | flags = get_default_flags() 33 | 34 | use_react_native!( 35 | :path => config[:reactNativePath], 36 | # Hermes is now enabled by default. Disable by setting this flag to false. 37 | :hermes_enabled => flags[:hermes_enabled], 38 | :fabric_enabled => flags[:fabric_enabled], 39 | # Enables Flipper. 40 | # 41 | # Note that if you have use_frameworks! enabled, Flipper will not work and 42 | # you should disable the next line. 43 | :flipper_configuration => flipper_config, 44 | # An absolute path to your application root. 45 | :app_path => "#{Pod::Config.instance.installation_root}/.." 46 | ) 47 | 48 | target 'TotpUtilsExampleTests' do 49 | inherit! :complete 50 | # Pods for testing 51 | end 52 | 53 | post_install do |installer| 54 | # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202 55 | react_native_post_install( 56 | installer, 57 | config[:reactNativePath], 58 | :mac_catalyst_enabled => false 59 | ) 60 | __apply_Xcode_12_5_M1_post_install_workaround(installer) 61 | end 62 | end 63 | -------------------------------------------------------------------------------- /example/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - boost (1.76.0) 3 | - DoubleConversion (1.1.6) 4 | - FBLazyVector (0.72.0) 5 | - fmt (6.2.1) 6 | - glog (0.3.5) 7 | - hermes-engine (0.72.0): 8 | - hermes-engine/Pre-built (= 0.72.0) 9 | - hermes-engine/Pre-built (0.72.0) 10 | - libevent (2.1.12) 11 | - RCT-Folly (2021.07.22.00): 12 | - boost 13 | - DoubleConversion 14 | - fmt (~> 6.2.1) 15 | - glog 16 | - RCT-Folly/Default (= 2021.07.22.00) 17 | - RCT-Folly/Default (2021.07.22.00): 18 | - boost 19 | - DoubleConversion 20 | - fmt (~> 6.2.1) 21 | - glog 22 | - RCT-Folly/Fabric (2021.07.22.00): 23 | - boost 24 | - DoubleConversion 25 | - fmt (~> 6.2.1) 26 | - glog 27 | - RCT-Folly/Futures (2021.07.22.00): 28 | - boost 29 | - DoubleConversion 30 | - fmt (~> 6.2.1) 31 | - glog 32 | - libevent 33 | - RCTRequired (0.72.0) 34 | - RCTTypeSafety (0.72.0): 35 | - FBLazyVector (= 0.72.0) 36 | - RCTRequired (= 0.72.0) 37 | - React-Core (= 0.72.0) 38 | - React (0.72.0): 39 | - React-Core (= 0.72.0) 40 | - React-Core/DevSupport (= 0.72.0) 41 | - React-Core/RCTWebSocket (= 0.72.0) 42 | - React-RCTActionSheet (= 0.72.0) 43 | - React-RCTAnimation (= 0.72.0) 44 | - React-RCTBlob (= 0.72.0) 45 | - React-RCTImage (= 0.72.0) 46 | - React-RCTLinking (= 0.72.0) 47 | - React-RCTNetwork (= 0.72.0) 48 | - React-RCTSettings (= 0.72.0) 49 | - React-RCTText (= 0.72.0) 50 | - React-RCTVibration (= 0.72.0) 51 | - React-callinvoker (0.72.0) 52 | - React-Codegen (0.72.0): 53 | - DoubleConversion 54 | - glog 55 | - hermes-engine 56 | - RCT-Folly 57 | - RCTRequired 58 | - RCTTypeSafety 59 | - React-Core 60 | - React-debug 61 | - React-Fabric 62 | - React-graphics 63 | - React-jsi 64 | - React-jsiexecutor 65 | - React-NativeModulesApple 66 | - React-utils 67 | - ReactCommon/turbomodule/bridging 68 | - ReactCommon/turbomodule/core 69 | - React-Core (0.72.0): 70 | - glog 71 | - hermes-engine 72 | - RCT-Folly (= 2021.07.22.00) 73 | - React-Core/Default (= 0.72.0) 74 | - React-cxxreact 75 | - React-hermes 76 | - React-jsi 77 | - React-jsiexecutor 78 | - React-perflogger 79 | - React-runtimeexecutor 80 | - React-utils 81 | - SocketRocket (= 0.6.0) 82 | - Yoga 83 | - React-Core/CoreModulesHeaders (0.72.0): 84 | - glog 85 | - hermes-engine 86 | - RCT-Folly (= 2021.07.22.00) 87 | - React-Core/Default 88 | - React-cxxreact 89 | - React-hermes 90 | - React-jsi 91 | - React-jsiexecutor 92 | - React-perflogger 93 | - React-runtimeexecutor 94 | - React-utils 95 | - SocketRocket (= 0.6.0) 96 | - Yoga 97 | - React-Core/Default (0.72.0): 98 | - glog 99 | - hermes-engine 100 | - RCT-Folly (= 2021.07.22.00) 101 | - React-cxxreact 102 | - React-hermes 103 | - React-jsi 104 | - React-jsiexecutor 105 | - React-perflogger 106 | - React-runtimeexecutor 107 | - React-utils 108 | - SocketRocket (= 0.6.0) 109 | - Yoga 110 | - React-Core/DevSupport (0.72.0): 111 | - glog 112 | - hermes-engine 113 | - RCT-Folly (= 2021.07.22.00) 114 | - React-Core/Default (= 0.72.0) 115 | - React-Core/RCTWebSocket (= 0.72.0) 116 | - React-cxxreact 117 | - React-hermes 118 | - React-jsi 119 | - React-jsiexecutor 120 | - React-jsinspector (= 0.72.0) 121 | - React-perflogger 122 | - React-runtimeexecutor 123 | - React-utils 124 | - SocketRocket (= 0.6.0) 125 | - Yoga 126 | - React-Core/RCTActionSheetHeaders (0.72.0): 127 | - glog 128 | - hermes-engine 129 | - RCT-Folly (= 2021.07.22.00) 130 | - React-Core/Default 131 | - React-cxxreact 132 | - React-hermes 133 | - React-jsi 134 | - React-jsiexecutor 135 | - React-perflogger 136 | - React-runtimeexecutor 137 | - React-utils 138 | - SocketRocket (= 0.6.0) 139 | - Yoga 140 | - React-Core/RCTAnimationHeaders (0.72.0): 141 | - glog 142 | - hermes-engine 143 | - RCT-Folly (= 2021.07.22.00) 144 | - React-Core/Default 145 | - React-cxxreact 146 | - React-hermes 147 | - React-jsi 148 | - React-jsiexecutor 149 | - React-perflogger 150 | - React-runtimeexecutor 151 | - React-utils 152 | - SocketRocket (= 0.6.0) 153 | - Yoga 154 | - React-Core/RCTBlobHeaders (0.72.0): 155 | - glog 156 | - hermes-engine 157 | - RCT-Folly (= 2021.07.22.00) 158 | - React-Core/Default 159 | - React-cxxreact 160 | - React-hermes 161 | - React-jsi 162 | - React-jsiexecutor 163 | - React-perflogger 164 | - React-runtimeexecutor 165 | - React-utils 166 | - SocketRocket (= 0.6.0) 167 | - Yoga 168 | - React-Core/RCTImageHeaders (0.72.0): 169 | - glog 170 | - hermes-engine 171 | - RCT-Folly (= 2021.07.22.00) 172 | - React-Core/Default 173 | - React-cxxreact 174 | - React-hermes 175 | - React-jsi 176 | - React-jsiexecutor 177 | - React-perflogger 178 | - React-runtimeexecutor 179 | - React-utils 180 | - SocketRocket (= 0.6.0) 181 | - Yoga 182 | - React-Core/RCTLinkingHeaders (0.72.0): 183 | - glog 184 | - hermes-engine 185 | - RCT-Folly (= 2021.07.22.00) 186 | - React-Core/Default 187 | - React-cxxreact 188 | - React-hermes 189 | - React-jsi 190 | - React-jsiexecutor 191 | - React-perflogger 192 | - React-runtimeexecutor 193 | - React-utils 194 | - SocketRocket (= 0.6.0) 195 | - Yoga 196 | - React-Core/RCTNetworkHeaders (0.72.0): 197 | - glog 198 | - hermes-engine 199 | - RCT-Folly (= 2021.07.22.00) 200 | - React-Core/Default 201 | - React-cxxreact 202 | - React-hermes 203 | - React-jsi 204 | - React-jsiexecutor 205 | - React-perflogger 206 | - React-runtimeexecutor 207 | - React-utils 208 | - SocketRocket (= 0.6.0) 209 | - Yoga 210 | - React-Core/RCTSettingsHeaders (0.72.0): 211 | - glog 212 | - hermes-engine 213 | - RCT-Folly (= 2021.07.22.00) 214 | - React-Core/Default 215 | - React-cxxreact 216 | - React-hermes 217 | - React-jsi 218 | - React-jsiexecutor 219 | - React-perflogger 220 | - React-runtimeexecutor 221 | - React-utils 222 | - SocketRocket (= 0.6.0) 223 | - Yoga 224 | - React-Core/RCTTextHeaders (0.72.0): 225 | - glog 226 | - hermes-engine 227 | - RCT-Folly (= 2021.07.22.00) 228 | - React-Core/Default 229 | - React-cxxreact 230 | - React-hermes 231 | - React-jsi 232 | - React-jsiexecutor 233 | - React-perflogger 234 | - React-runtimeexecutor 235 | - React-utils 236 | - SocketRocket (= 0.6.0) 237 | - Yoga 238 | - React-Core/RCTVibrationHeaders (0.72.0): 239 | - glog 240 | - hermes-engine 241 | - RCT-Folly (= 2021.07.22.00) 242 | - React-Core/Default 243 | - React-cxxreact 244 | - React-hermes 245 | - React-jsi 246 | - React-jsiexecutor 247 | - React-perflogger 248 | - React-runtimeexecutor 249 | - React-utils 250 | - SocketRocket (= 0.6.0) 251 | - Yoga 252 | - React-Core/RCTWebSocket (0.72.0): 253 | - glog 254 | - hermes-engine 255 | - RCT-Folly (= 2021.07.22.00) 256 | - React-Core/Default (= 0.72.0) 257 | - React-cxxreact 258 | - React-hermes 259 | - React-jsi 260 | - React-jsiexecutor 261 | - React-perflogger 262 | - React-runtimeexecutor 263 | - React-utils 264 | - SocketRocket (= 0.6.0) 265 | - Yoga 266 | - React-CoreModules (0.72.0): 267 | - RCT-Folly (= 2021.07.22.00) 268 | - RCTTypeSafety (= 0.72.0) 269 | - React-Codegen (= 0.72.0) 270 | - React-Core/CoreModulesHeaders (= 0.72.0) 271 | - React-jsi (= 0.72.0) 272 | - React-RCTBlob 273 | - React-RCTImage (= 0.72.0) 274 | - ReactCommon/turbomodule/core (= 0.72.0) 275 | - SocketRocket (= 0.6.0) 276 | - React-cxxreact (0.72.0): 277 | - boost (= 1.76.0) 278 | - DoubleConversion 279 | - glog 280 | - hermes-engine 281 | - RCT-Folly (= 2021.07.22.00) 282 | - React-callinvoker (= 0.72.0) 283 | - React-jsi (= 0.72.0) 284 | - React-jsinspector (= 0.72.0) 285 | - React-logger (= 0.72.0) 286 | - React-perflogger (= 0.72.0) 287 | - React-runtimeexecutor (= 0.72.0) 288 | - React-debug (0.72.0) 289 | - React-Fabric (0.72.0): 290 | - DoubleConversion 291 | - glog 292 | - hermes-engine 293 | - RCT-Folly/Fabric (= 2021.07.22.00) 294 | - RCTRequired (= 0.72.0) 295 | - RCTTypeSafety (= 0.72.0) 296 | - React-Core 297 | - React-debug 298 | - React-Fabric/animations (= 0.72.0) 299 | - React-Fabric/attributedstring (= 0.72.0) 300 | - React-Fabric/butter (= 0.72.0) 301 | - React-Fabric/componentregistry (= 0.72.0) 302 | - React-Fabric/componentregistrynative (= 0.72.0) 303 | - React-Fabric/components (= 0.72.0) 304 | - React-Fabric/config (= 0.72.0) 305 | - React-Fabric/core (= 0.72.0) 306 | - React-Fabric/debug_renderer (= 0.72.0) 307 | - React-Fabric/imagemanager (= 0.72.0) 308 | - React-Fabric/leakchecker (= 0.72.0) 309 | - React-Fabric/mapbuffer (= 0.72.0) 310 | - React-Fabric/mounting (= 0.72.0) 311 | - React-Fabric/scheduler (= 0.72.0) 312 | - React-Fabric/telemetry (= 0.72.0) 313 | - React-Fabric/templateprocessor (= 0.72.0) 314 | - React-Fabric/textlayoutmanager (= 0.72.0) 315 | - React-Fabric/uimanager (= 0.72.0) 316 | - React-graphics (= 0.72.0) 317 | - React-jsi (= 0.72.0) 318 | - React-jsiexecutor (= 0.72.0) 319 | - React-logger 320 | - React-runtimescheduler 321 | - React-utils 322 | - ReactCommon/turbomodule/core (= 0.72.0) 323 | - React-Fabric/animations (0.72.0): 324 | - DoubleConversion 325 | - glog 326 | - hermes-engine 327 | - RCT-Folly/Fabric (= 2021.07.22.00) 328 | - RCTRequired (= 0.72.0) 329 | - RCTTypeSafety (= 0.72.0) 330 | - React-Core 331 | - React-debug 332 | - React-graphics (= 0.72.0) 333 | - React-jsi (= 0.72.0) 334 | - React-jsiexecutor (= 0.72.0) 335 | - React-logger 336 | - React-runtimescheduler 337 | - React-utils 338 | - ReactCommon/turbomodule/core (= 0.72.0) 339 | - React-Fabric/attributedstring (0.72.0): 340 | - DoubleConversion 341 | - glog 342 | - hermes-engine 343 | - RCT-Folly/Fabric (= 2021.07.22.00) 344 | - RCTRequired (= 0.72.0) 345 | - RCTTypeSafety (= 0.72.0) 346 | - React-Core 347 | - React-debug 348 | - React-graphics (= 0.72.0) 349 | - React-jsi (= 0.72.0) 350 | - React-jsiexecutor (= 0.72.0) 351 | - React-logger 352 | - React-runtimescheduler 353 | - React-utils 354 | - ReactCommon/turbomodule/core (= 0.72.0) 355 | - React-Fabric/butter (0.72.0): 356 | - DoubleConversion 357 | - glog 358 | - hermes-engine 359 | - RCT-Folly/Fabric (= 2021.07.22.00) 360 | - RCTRequired (= 0.72.0) 361 | - RCTTypeSafety (= 0.72.0) 362 | - React-Core 363 | - React-debug 364 | - React-graphics (= 0.72.0) 365 | - React-jsi (= 0.72.0) 366 | - React-jsiexecutor (= 0.72.0) 367 | - React-logger 368 | - React-runtimescheduler 369 | - React-utils 370 | - ReactCommon/turbomodule/core (= 0.72.0) 371 | - React-Fabric/componentregistry (0.72.0): 372 | - DoubleConversion 373 | - glog 374 | - hermes-engine 375 | - RCT-Folly/Fabric (= 2021.07.22.00) 376 | - RCTRequired (= 0.72.0) 377 | - RCTTypeSafety (= 0.72.0) 378 | - React-Core 379 | - React-debug 380 | - React-graphics (= 0.72.0) 381 | - React-jsi (= 0.72.0) 382 | - React-jsiexecutor (= 0.72.0) 383 | - React-logger 384 | - React-runtimescheduler 385 | - React-utils 386 | - ReactCommon/turbomodule/core (= 0.72.0) 387 | - React-Fabric/componentregistrynative (0.72.0): 388 | - DoubleConversion 389 | - glog 390 | - hermes-engine 391 | - RCT-Folly/Fabric (= 2021.07.22.00) 392 | - RCTRequired (= 0.72.0) 393 | - RCTTypeSafety (= 0.72.0) 394 | - React-Core 395 | - React-debug 396 | - React-graphics (= 0.72.0) 397 | - React-jsi (= 0.72.0) 398 | - React-jsiexecutor (= 0.72.0) 399 | - React-logger 400 | - React-runtimescheduler 401 | - React-utils 402 | - ReactCommon/turbomodule/core (= 0.72.0) 403 | - React-Fabric/components (0.72.0): 404 | - DoubleConversion 405 | - glog 406 | - hermes-engine 407 | - RCT-Folly/Fabric (= 2021.07.22.00) 408 | - RCTRequired (= 0.72.0) 409 | - RCTTypeSafety (= 0.72.0) 410 | - React-Core 411 | - React-debug 412 | - React-Fabric/components/activityindicator (= 0.72.0) 413 | - React-Fabric/components/image (= 0.72.0) 414 | - React-Fabric/components/inputaccessory (= 0.72.0) 415 | - React-Fabric/components/legacyviewmanagerinterop (= 0.72.0) 416 | - React-Fabric/components/modal (= 0.72.0) 417 | - React-Fabric/components/rncore (= 0.72.0) 418 | - React-Fabric/components/root (= 0.72.0) 419 | - React-Fabric/components/safeareaview (= 0.72.0) 420 | - React-Fabric/components/scrollview (= 0.72.0) 421 | - React-Fabric/components/text (= 0.72.0) 422 | - React-Fabric/components/textinput (= 0.72.0) 423 | - React-Fabric/components/unimplementedview (= 0.72.0) 424 | - React-Fabric/components/view (= 0.72.0) 425 | - React-graphics (= 0.72.0) 426 | - React-jsi (= 0.72.0) 427 | - React-jsiexecutor (= 0.72.0) 428 | - React-logger 429 | - React-runtimescheduler 430 | - React-utils 431 | - ReactCommon/turbomodule/core (= 0.72.0) 432 | - React-Fabric/components/activityindicator (0.72.0): 433 | - DoubleConversion 434 | - glog 435 | - hermes-engine 436 | - RCT-Folly/Fabric (= 2021.07.22.00) 437 | - RCTRequired (= 0.72.0) 438 | - RCTTypeSafety (= 0.72.0) 439 | - React-Core 440 | - React-debug 441 | - React-graphics (= 0.72.0) 442 | - React-jsi (= 0.72.0) 443 | - React-jsiexecutor (= 0.72.0) 444 | - React-logger 445 | - React-runtimescheduler 446 | - React-utils 447 | - ReactCommon/turbomodule/core (= 0.72.0) 448 | - React-Fabric/components/image (0.72.0): 449 | - DoubleConversion 450 | - glog 451 | - hermes-engine 452 | - RCT-Folly/Fabric (= 2021.07.22.00) 453 | - RCTRequired (= 0.72.0) 454 | - RCTTypeSafety (= 0.72.0) 455 | - React-Core 456 | - React-debug 457 | - React-graphics (= 0.72.0) 458 | - React-jsi (= 0.72.0) 459 | - React-jsiexecutor (= 0.72.0) 460 | - React-logger 461 | - React-runtimescheduler 462 | - React-utils 463 | - ReactCommon/turbomodule/core (= 0.72.0) 464 | - React-Fabric/components/inputaccessory (0.72.0): 465 | - DoubleConversion 466 | - glog 467 | - hermes-engine 468 | - RCT-Folly/Fabric (= 2021.07.22.00) 469 | - RCTRequired (= 0.72.0) 470 | - RCTTypeSafety (= 0.72.0) 471 | - React-Core 472 | - React-debug 473 | - React-graphics (= 0.72.0) 474 | - React-jsi (= 0.72.0) 475 | - React-jsiexecutor (= 0.72.0) 476 | - React-logger 477 | - React-runtimescheduler 478 | - React-utils 479 | - ReactCommon/turbomodule/core (= 0.72.0) 480 | - React-Fabric/components/legacyviewmanagerinterop (0.72.0): 481 | - DoubleConversion 482 | - glog 483 | - hermes-engine 484 | - RCT-Folly/Fabric (= 2021.07.22.00) 485 | - RCTRequired (= 0.72.0) 486 | - RCTTypeSafety (= 0.72.0) 487 | - React-Core 488 | - React-debug 489 | - React-graphics (= 0.72.0) 490 | - React-jsi (= 0.72.0) 491 | - React-jsiexecutor (= 0.72.0) 492 | - React-logger 493 | - React-runtimescheduler 494 | - React-utils 495 | - ReactCommon/turbomodule/core (= 0.72.0) 496 | - React-Fabric/components/modal (0.72.0): 497 | - DoubleConversion 498 | - glog 499 | - hermes-engine 500 | - RCT-Folly/Fabric (= 2021.07.22.00) 501 | - RCTRequired (= 0.72.0) 502 | - RCTTypeSafety (= 0.72.0) 503 | - React-Core 504 | - React-debug 505 | - React-graphics (= 0.72.0) 506 | - React-jsi (= 0.72.0) 507 | - React-jsiexecutor (= 0.72.0) 508 | - React-logger 509 | - React-runtimescheduler 510 | - React-utils 511 | - ReactCommon/turbomodule/core (= 0.72.0) 512 | - React-Fabric/components/rncore (0.72.0): 513 | - DoubleConversion 514 | - glog 515 | - hermes-engine 516 | - RCT-Folly/Fabric (= 2021.07.22.00) 517 | - RCTRequired (= 0.72.0) 518 | - RCTTypeSafety (= 0.72.0) 519 | - React-Core 520 | - React-debug 521 | - React-graphics (= 0.72.0) 522 | - React-jsi (= 0.72.0) 523 | - React-jsiexecutor (= 0.72.0) 524 | - React-logger 525 | - React-runtimescheduler 526 | - React-utils 527 | - ReactCommon/turbomodule/core (= 0.72.0) 528 | - React-Fabric/components/root (0.72.0): 529 | - DoubleConversion 530 | - glog 531 | - hermes-engine 532 | - RCT-Folly/Fabric (= 2021.07.22.00) 533 | - RCTRequired (= 0.72.0) 534 | - RCTTypeSafety (= 0.72.0) 535 | - React-Core 536 | - React-debug 537 | - React-graphics (= 0.72.0) 538 | - React-jsi (= 0.72.0) 539 | - React-jsiexecutor (= 0.72.0) 540 | - React-logger 541 | - React-runtimescheduler 542 | - React-utils 543 | - ReactCommon/turbomodule/core (= 0.72.0) 544 | - React-Fabric/components/safeareaview (0.72.0): 545 | - DoubleConversion 546 | - glog 547 | - hermes-engine 548 | - RCT-Folly/Fabric (= 2021.07.22.00) 549 | - RCTRequired (= 0.72.0) 550 | - RCTTypeSafety (= 0.72.0) 551 | - React-Core 552 | - React-debug 553 | - React-graphics (= 0.72.0) 554 | - React-jsi (= 0.72.0) 555 | - React-jsiexecutor (= 0.72.0) 556 | - React-logger 557 | - React-runtimescheduler 558 | - React-utils 559 | - ReactCommon/turbomodule/core (= 0.72.0) 560 | - React-Fabric/components/scrollview (0.72.0): 561 | - DoubleConversion 562 | - glog 563 | - hermes-engine 564 | - RCT-Folly/Fabric (= 2021.07.22.00) 565 | - RCTRequired (= 0.72.0) 566 | - RCTTypeSafety (= 0.72.0) 567 | - React-Core 568 | - React-debug 569 | - React-graphics (= 0.72.0) 570 | - React-jsi (= 0.72.0) 571 | - React-jsiexecutor (= 0.72.0) 572 | - React-logger 573 | - React-runtimescheduler 574 | - React-utils 575 | - ReactCommon/turbomodule/core (= 0.72.0) 576 | - React-Fabric/components/text (0.72.0): 577 | - DoubleConversion 578 | - glog 579 | - hermes-engine 580 | - RCT-Folly/Fabric (= 2021.07.22.00) 581 | - RCTRequired (= 0.72.0) 582 | - RCTTypeSafety (= 0.72.0) 583 | - React-Core 584 | - React-debug 585 | - React-graphics (= 0.72.0) 586 | - React-jsi (= 0.72.0) 587 | - React-jsiexecutor (= 0.72.0) 588 | - React-logger 589 | - React-runtimescheduler 590 | - React-utils 591 | - ReactCommon/turbomodule/core (= 0.72.0) 592 | - React-Fabric/components/textinput (0.72.0): 593 | - DoubleConversion 594 | - glog 595 | - hermes-engine 596 | - RCT-Folly/Fabric (= 2021.07.22.00) 597 | - RCTRequired (= 0.72.0) 598 | - RCTTypeSafety (= 0.72.0) 599 | - React-Core 600 | - React-debug 601 | - React-graphics (= 0.72.0) 602 | - React-jsi (= 0.72.0) 603 | - React-jsiexecutor (= 0.72.0) 604 | - React-logger 605 | - React-runtimescheduler 606 | - React-utils 607 | - ReactCommon/turbomodule/core (= 0.72.0) 608 | - React-Fabric/components/unimplementedview (0.72.0): 609 | - DoubleConversion 610 | - glog 611 | - hermes-engine 612 | - RCT-Folly/Fabric (= 2021.07.22.00) 613 | - RCTRequired (= 0.72.0) 614 | - RCTTypeSafety (= 0.72.0) 615 | - React-Core 616 | - React-debug 617 | - React-graphics (= 0.72.0) 618 | - React-jsi (= 0.72.0) 619 | - React-jsiexecutor (= 0.72.0) 620 | - React-logger 621 | - React-runtimescheduler 622 | - React-utils 623 | - ReactCommon/turbomodule/core (= 0.72.0) 624 | - React-Fabric/components/view (0.72.0): 625 | - DoubleConversion 626 | - glog 627 | - hermes-engine 628 | - RCT-Folly/Fabric (= 2021.07.22.00) 629 | - RCTRequired (= 0.72.0) 630 | - RCTTypeSafety (= 0.72.0) 631 | - React-Core 632 | - React-debug 633 | - React-graphics (= 0.72.0) 634 | - React-jsi (= 0.72.0) 635 | - React-jsiexecutor (= 0.72.0) 636 | - React-logger 637 | - React-runtimescheduler 638 | - React-utils 639 | - ReactCommon/turbomodule/core (= 0.72.0) 640 | - Yoga 641 | - React-Fabric/config (0.72.0): 642 | - DoubleConversion 643 | - glog 644 | - hermes-engine 645 | - RCT-Folly/Fabric (= 2021.07.22.00) 646 | - RCTRequired (= 0.72.0) 647 | - RCTTypeSafety (= 0.72.0) 648 | - React-Core 649 | - React-debug 650 | - React-graphics (= 0.72.0) 651 | - React-jsi (= 0.72.0) 652 | - React-jsiexecutor (= 0.72.0) 653 | - React-logger 654 | - React-runtimescheduler 655 | - React-utils 656 | - ReactCommon/turbomodule/core (= 0.72.0) 657 | - React-Fabric/core (0.72.0): 658 | - DoubleConversion 659 | - glog 660 | - hermes-engine 661 | - RCT-Folly/Fabric (= 2021.07.22.00) 662 | - RCTRequired (= 0.72.0) 663 | - RCTTypeSafety (= 0.72.0) 664 | - React-Core 665 | - React-debug 666 | - React-graphics (= 0.72.0) 667 | - React-jsi (= 0.72.0) 668 | - React-jsiexecutor (= 0.72.0) 669 | - React-logger 670 | - React-runtimescheduler 671 | - React-utils 672 | - ReactCommon/turbomodule/core (= 0.72.0) 673 | - React-Fabric/debug_renderer (0.72.0): 674 | - DoubleConversion 675 | - glog 676 | - hermes-engine 677 | - RCT-Folly/Fabric (= 2021.07.22.00) 678 | - RCTRequired (= 0.72.0) 679 | - RCTTypeSafety (= 0.72.0) 680 | - React-Core 681 | - React-debug 682 | - React-graphics (= 0.72.0) 683 | - React-jsi (= 0.72.0) 684 | - React-jsiexecutor (= 0.72.0) 685 | - React-logger 686 | - React-runtimescheduler 687 | - React-utils 688 | - ReactCommon/turbomodule/core (= 0.72.0) 689 | - React-Fabric/imagemanager (0.72.0): 690 | - DoubleConversion 691 | - glog 692 | - hermes-engine 693 | - RCT-Folly/Fabric (= 2021.07.22.00) 694 | - RCTRequired (= 0.72.0) 695 | - RCTTypeSafety (= 0.72.0) 696 | - React-Core 697 | - React-debug 698 | - React-graphics (= 0.72.0) 699 | - React-jsi (= 0.72.0) 700 | - React-jsiexecutor (= 0.72.0) 701 | - React-logger 702 | - React-runtimescheduler 703 | - React-utils 704 | - ReactCommon/turbomodule/core (= 0.72.0) 705 | - React-Fabric/leakchecker (0.72.0): 706 | - DoubleConversion 707 | - glog 708 | - hermes-engine 709 | - RCT-Folly/Fabric (= 2021.07.22.00) 710 | - RCTRequired (= 0.72.0) 711 | - RCTTypeSafety (= 0.72.0) 712 | - React-Core 713 | - React-debug 714 | - React-graphics (= 0.72.0) 715 | - React-jsi (= 0.72.0) 716 | - React-jsiexecutor (= 0.72.0) 717 | - React-logger 718 | - React-runtimescheduler 719 | - React-utils 720 | - ReactCommon/turbomodule/core (= 0.72.0) 721 | - React-Fabric/mapbuffer (0.72.0): 722 | - DoubleConversion 723 | - glog 724 | - hermes-engine 725 | - RCT-Folly/Fabric (= 2021.07.22.00) 726 | - RCTRequired (= 0.72.0) 727 | - RCTTypeSafety (= 0.72.0) 728 | - React-Core 729 | - React-debug 730 | - React-graphics (= 0.72.0) 731 | - React-jsi (= 0.72.0) 732 | - React-jsiexecutor (= 0.72.0) 733 | - React-logger 734 | - React-runtimescheduler 735 | - React-utils 736 | - ReactCommon/turbomodule/core (= 0.72.0) 737 | - React-Fabric/mounting (0.72.0): 738 | - DoubleConversion 739 | - glog 740 | - hermes-engine 741 | - RCT-Folly/Fabric (= 2021.07.22.00) 742 | - RCTRequired (= 0.72.0) 743 | - RCTTypeSafety (= 0.72.0) 744 | - React-Core 745 | - React-debug 746 | - React-graphics (= 0.72.0) 747 | - React-jsi (= 0.72.0) 748 | - React-jsiexecutor (= 0.72.0) 749 | - React-logger 750 | - React-runtimescheduler 751 | - React-utils 752 | - ReactCommon/turbomodule/core (= 0.72.0) 753 | - React-Fabric/scheduler (0.72.0): 754 | - DoubleConversion 755 | - glog 756 | - hermes-engine 757 | - RCT-Folly/Fabric (= 2021.07.22.00) 758 | - RCTRequired (= 0.72.0) 759 | - RCTTypeSafety (= 0.72.0) 760 | - React-Core 761 | - React-debug 762 | - React-graphics (= 0.72.0) 763 | - React-jsi (= 0.72.0) 764 | - React-jsiexecutor (= 0.72.0) 765 | - React-logger 766 | - React-runtimescheduler 767 | - React-utils 768 | - ReactCommon/turbomodule/core (= 0.72.0) 769 | - React-Fabric/telemetry (0.72.0): 770 | - DoubleConversion 771 | - glog 772 | - hermes-engine 773 | - RCT-Folly/Fabric (= 2021.07.22.00) 774 | - RCTRequired (= 0.72.0) 775 | - RCTTypeSafety (= 0.72.0) 776 | - React-Core 777 | - React-debug 778 | - React-graphics (= 0.72.0) 779 | - React-jsi (= 0.72.0) 780 | - React-jsiexecutor (= 0.72.0) 781 | - React-logger 782 | - React-runtimescheduler 783 | - React-utils 784 | - ReactCommon/turbomodule/core (= 0.72.0) 785 | - React-Fabric/templateprocessor (0.72.0): 786 | - DoubleConversion 787 | - glog 788 | - hermes-engine 789 | - RCT-Folly/Fabric (= 2021.07.22.00) 790 | - RCTRequired (= 0.72.0) 791 | - RCTTypeSafety (= 0.72.0) 792 | - React-Core 793 | - React-debug 794 | - React-graphics (= 0.72.0) 795 | - React-jsi (= 0.72.0) 796 | - React-jsiexecutor (= 0.72.0) 797 | - React-logger 798 | - React-runtimescheduler 799 | - React-utils 800 | - ReactCommon/turbomodule/core (= 0.72.0) 801 | - React-Fabric/textlayoutmanager (0.72.0): 802 | - DoubleConversion 803 | - glog 804 | - hermes-engine 805 | - RCT-Folly/Fabric (= 2021.07.22.00) 806 | - RCTRequired (= 0.72.0) 807 | - RCTTypeSafety (= 0.72.0) 808 | - React-Core 809 | - React-debug 810 | - React-Fabric/uimanager 811 | - React-graphics (= 0.72.0) 812 | - React-jsi (= 0.72.0) 813 | - React-jsiexecutor (= 0.72.0) 814 | - React-logger 815 | - React-runtimescheduler 816 | - React-utils 817 | - ReactCommon/turbomodule/core (= 0.72.0) 818 | - React-Fabric/uimanager (0.72.0): 819 | - DoubleConversion 820 | - glog 821 | - hermes-engine 822 | - RCT-Folly/Fabric (= 2021.07.22.00) 823 | - RCTRequired (= 0.72.0) 824 | - RCTTypeSafety (= 0.72.0) 825 | - React-Core 826 | - React-debug 827 | - React-graphics (= 0.72.0) 828 | - React-jsi (= 0.72.0) 829 | - React-jsiexecutor (= 0.72.0) 830 | - React-logger 831 | - React-runtimescheduler 832 | - React-utils 833 | - ReactCommon/turbomodule/core (= 0.72.0) 834 | - React-graphics (0.72.0): 835 | - glog 836 | - RCT-Folly/Fabric (= 2021.07.22.00) 837 | - React-Core/Default (= 0.72.0) 838 | - React-hermes (0.72.0): 839 | - DoubleConversion 840 | - glog 841 | - hermes-engine 842 | - RCT-Folly (= 2021.07.22.00) 843 | - RCT-Folly/Futures (= 2021.07.22.00) 844 | - React-cxxreact (= 0.72.0) 845 | - React-jsi 846 | - React-jsiexecutor (= 0.72.0) 847 | - React-jsinspector (= 0.72.0) 848 | - React-perflogger (= 0.72.0) 849 | - React-ImageManager (0.72.0): 850 | - glog 851 | - RCT-Folly/Fabric 852 | - React-Core/Default 853 | - React-debug 854 | - React-Fabric 855 | - React-RCTImage 856 | - React-utils 857 | - React-jsi (0.72.0): 858 | - boost (= 1.76.0) 859 | - DoubleConversion 860 | - glog 861 | - hermes-engine 862 | - RCT-Folly (= 2021.07.22.00) 863 | - React-jsiexecutor (0.72.0): 864 | - DoubleConversion 865 | - glog 866 | - hermes-engine 867 | - RCT-Folly (= 2021.07.22.00) 868 | - React-cxxreact (= 0.72.0) 869 | - React-jsi (= 0.72.0) 870 | - React-perflogger (= 0.72.0) 871 | - React-jsinspector (0.72.0) 872 | - React-logger (0.72.0): 873 | - glog 874 | - react-native-totp-utils (1.0.4): 875 | - RCT-Folly 876 | - RCTRequired 877 | - RCTTypeSafety 878 | - React-Codegen 879 | - React-Core 880 | - ReactCommon/turbomodule/core 881 | - React-NativeModulesApple (0.72.0): 882 | - hermes-engine 883 | - React-callinvoker 884 | - React-Core 885 | - React-cxxreact 886 | - React-jsi 887 | - React-runtimeexecutor 888 | - ReactCommon/turbomodule/bridging 889 | - ReactCommon/turbomodule/core 890 | - React-perflogger (0.72.0) 891 | - React-RCTActionSheet (0.72.0): 892 | - React-Core/RCTActionSheetHeaders (= 0.72.0) 893 | - React-RCTAnimation (0.72.0): 894 | - RCT-Folly (= 2021.07.22.00) 895 | - RCTTypeSafety (= 0.72.0) 896 | - React-Codegen (= 0.72.0) 897 | - React-Core/RCTAnimationHeaders (= 0.72.0) 898 | - React-jsi (= 0.72.0) 899 | - ReactCommon/turbomodule/core (= 0.72.0) 900 | - React-RCTAppDelegate (0.72.0): 901 | - RCT-Folly 902 | - RCTRequired 903 | - RCTTypeSafety 904 | - React-Core 905 | - React-CoreModules 906 | - React-debug 907 | - React-graphics 908 | - React-hermes 909 | - React-NativeModulesApple 910 | - React-RCTFabric 911 | - React-RCTImage 912 | - React-RCTNetwork 913 | - React-runtimescheduler 914 | - React-utils 915 | - ReactCommon/turbomodule/core 916 | - React-RCTBlob (0.72.0): 917 | - hermes-engine 918 | - RCT-Folly (= 2021.07.22.00) 919 | - React-Codegen (= 0.72.0) 920 | - React-Core/RCTBlobHeaders (= 0.72.0) 921 | - React-Core/RCTWebSocket (= 0.72.0) 922 | - React-jsi (= 0.72.0) 923 | - React-RCTNetwork (= 0.72.0) 924 | - ReactCommon/turbomodule/core (= 0.72.0) 925 | - React-RCTFabric (0.72.0): 926 | - glog 927 | - hermes-engine 928 | - RCT-Folly/Fabric (= 2021.07.22.00) 929 | - React-Core (= 0.72.0) 930 | - React-Fabric (= 0.72.0) 931 | - React-ImageManager 932 | - React-RCTImage (= 0.72.0) 933 | - React-RCTText 934 | - React-runtimescheduler 935 | - React-utils 936 | - Yoga 937 | - React-RCTImage (0.72.0): 938 | - RCT-Folly (= 2021.07.22.00) 939 | - RCTTypeSafety (= 0.72.0) 940 | - React-Codegen (= 0.72.0) 941 | - React-Core/RCTImageHeaders (= 0.72.0) 942 | - React-jsi (= 0.72.0) 943 | - React-RCTNetwork (= 0.72.0) 944 | - ReactCommon/turbomodule/core (= 0.72.0) 945 | - React-RCTLinking (0.72.0): 946 | - React-Codegen (= 0.72.0) 947 | - React-Core/RCTLinkingHeaders (= 0.72.0) 948 | - React-jsi (= 0.72.0) 949 | - ReactCommon/turbomodule/core (= 0.72.0) 950 | - React-RCTNetwork (0.72.0): 951 | - RCT-Folly (= 2021.07.22.00) 952 | - RCTTypeSafety (= 0.72.0) 953 | - React-Codegen (= 0.72.0) 954 | - React-Core/RCTNetworkHeaders (= 0.72.0) 955 | - React-jsi (= 0.72.0) 956 | - ReactCommon/turbomodule/core (= 0.72.0) 957 | - React-RCTSettings (0.72.0): 958 | - RCT-Folly (= 2021.07.22.00) 959 | - RCTTypeSafety (= 0.72.0) 960 | - React-Codegen (= 0.72.0) 961 | - React-Core/RCTSettingsHeaders (= 0.72.0) 962 | - React-jsi (= 0.72.0) 963 | - ReactCommon/turbomodule/core (= 0.72.0) 964 | - React-RCTText (0.72.0): 965 | - React-Core/RCTTextHeaders (= 0.72.0) 966 | - React-RCTVibration (0.72.0): 967 | - RCT-Folly (= 2021.07.22.00) 968 | - React-Codegen (= 0.72.0) 969 | - React-Core/RCTVibrationHeaders (= 0.72.0) 970 | - React-jsi (= 0.72.0) 971 | - ReactCommon/turbomodule/core (= 0.72.0) 972 | - React-rncore (0.72.0) 973 | - React-runtimeexecutor (0.72.0): 974 | - React-jsi (= 0.72.0) 975 | - React-runtimescheduler (0.72.0): 976 | - glog 977 | - hermes-engine 978 | - RCT-Folly (= 2021.07.22.00) 979 | - React-callinvoker 980 | - React-debug 981 | - React-jsi 982 | - React-runtimeexecutor 983 | - React-utils (0.72.0): 984 | - glog 985 | - RCT-Folly (= 2021.07.22.00) 986 | - React-debug 987 | - ReactCommon/turbomodule/bridging (0.72.0): 988 | - DoubleConversion 989 | - glog 990 | - hermes-engine 991 | - RCT-Folly (= 2021.07.22.00) 992 | - React-callinvoker (= 0.72.0) 993 | - React-cxxreact (= 0.72.0) 994 | - React-jsi (= 0.72.0) 995 | - React-logger (= 0.72.0) 996 | - React-perflogger (= 0.72.0) 997 | - ReactCommon/turbomodule/core (0.72.0): 998 | - DoubleConversion 999 | - glog 1000 | - hermes-engine 1001 | - RCT-Folly (= 2021.07.22.00) 1002 | - React-callinvoker (= 0.72.0) 1003 | - React-cxxreact (= 0.72.0) 1004 | - React-jsi (= 0.72.0) 1005 | - React-logger (= 0.72.0) 1006 | - React-perflogger (= 0.72.0) 1007 | - SocketRocket (0.6.0) 1008 | - Yoga (1.14.0) 1009 | 1010 | DEPENDENCIES: 1011 | - boost (from `../node_modules/react-native/third-party-podspecs/boost.podspec`) 1012 | - DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`) 1013 | - FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`) 1014 | - glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`) 1015 | - hermes-engine (from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`) 1016 | - libevent (~> 2.1.12) 1017 | - RCT-Folly (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`) 1018 | - RCT-Folly/Fabric (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`) 1019 | - RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`) 1020 | - RCTTypeSafety (from `../node_modules/react-native/Libraries/TypeSafety`) 1021 | - React (from `../node_modules/react-native/`) 1022 | - React-callinvoker (from `../node_modules/react-native/ReactCommon/callinvoker`) 1023 | - React-Codegen (from `build/generated/ios`) 1024 | - React-Core (from `../node_modules/react-native/`) 1025 | - React-Core/RCTWebSocket (from `../node_modules/react-native/`) 1026 | - React-CoreModules (from `../node_modules/react-native/React/CoreModules`) 1027 | - React-cxxreact (from `../node_modules/react-native/ReactCommon/cxxreact`) 1028 | - React-debug (from `../node_modules/react-native/ReactCommon/react/debug`) 1029 | - React-Fabric (from `../node_modules/react-native/ReactCommon`) 1030 | - React-graphics (from `../node_modules/react-native/ReactCommon/react/renderer/graphics`) 1031 | - React-hermes (from `../node_modules/react-native/ReactCommon/hermes`) 1032 | - React-ImageManager (from `../node_modules/react-native/ReactCommon/react/renderer/imagemanager/platform/ios`) 1033 | - React-jsi (from `../node_modules/react-native/ReactCommon/jsi`) 1034 | - React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`) 1035 | - React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`) 1036 | - React-logger (from `../node_modules/react-native/ReactCommon/logger`) 1037 | - react-native-totp-utils (from `../..`) 1038 | - React-NativeModulesApple (from `../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios`) 1039 | - React-perflogger (from `../node_modules/react-native/ReactCommon/reactperflogger`) 1040 | - React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`) 1041 | - React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`) 1042 | - React-RCTAppDelegate (from `../node_modules/react-native/Libraries/AppDelegate`) 1043 | - React-RCTBlob (from `../node_modules/react-native/Libraries/Blob`) 1044 | - React-RCTFabric (from `../node_modules/react-native/React`) 1045 | - React-RCTImage (from `../node_modules/react-native/Libraries/Image`) 1046 | - React-RCTLinking (from `../node_modules/react-native/Libraries/LinkingIOS`) 1047 | - React-RCTNetwork (from `../node_modules/react-native/Libraries/Network`) 1048 | - React-RCTSettings (from `../node_modules/react-native/Libraries/Settings`) 1049 | - React-RCTText (from `../node_modules/react-native/Libraries/Text`) 1050 | - React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`) 1051 | - React-rncore (from `../node_modules/react-native/ReactCommon`) 1052 | - React-runtimeexecutor (from `../node_modules/react-native/ReactCommon/runtimeexecutor`) 1053 | - React-runtimescheduler (from `../node_modules/react-native/ReactCommon/react/renderer/runtimescheduler`) 1054 | - React-utils (from `../node_modules/react-native/ReactCommon/react/utils`) 1055 | - ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`) 1056 | - Yoga (from `../node_modules/react-native/ReactCommon/yoga`) 1057 | 1058 | SPEC REPOS: 1059 | trunk: 1060 | - fmt 1061 | - libevent 1062 | - SocketRocket 1063 | 1064 | EXTERNAL SOURCES: 1065 | boost: 1066 | :podspec: "../node_modules/react-native/third-party-podspecs/boost.podspec" 1067 | DoubleConversion: 1068 | :podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec" 1069 | FBLazyVector: 1070 | :path: "../node_modules/react-native/Libraries/FBLazyVector" 1071 | glog: 1072 | :podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec" 1073 | hermes-engine: 1074 | :podspec: "../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec" 1075 | :tag: hermes-2023-03-20-RNv0.72.0-49794cfc7c81fb8f69fd60c3bbf85a7480cc5a77 1076 | RCT-Folly: 1077 | :podspec: "../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec" 1078 | RCTRequired: 1079 | :path: "../node_modules/react-native/Libraries/RCTRequired" 1080 | RCTTypeSafety: 1081 | :path: "../node_modules/react-native/Libraries/TypeSafety" 1082 | React: 1083 | :path: "../node_modules/react-native/" 1084 | React-callinvoker: 1085 | :path: "../node_modules/react-native/ReactCommon/callinvoker" 1086 | React-Codegen: 1087 | :path: build/generated/ios 1088 | React-Core: 1089 | :path: "../node_modules/react-native/" 1090 | React-CoreModules: 1091 | :path: "../node_modules/react-native/React/CoreModules" 1092 | React-cxxreact: 1093 | :path: "../node_modules/react-native/ReactCommon/cxxreact" 1094 | React-debug: 1095 | :path: "../node_modules/react-native/ReactCommon/react/debug" 1096 | React-Fabric: 1097 | :path: "../node_modules/react-native/ReactCommon" 1098 | React-graphics: 1099 | :path: "../node_modules/react-native/ReactCommon/react/renderer/graphics" 1100 | React-hermes: 1101 | :path: "../node_modules/react-native/ReactCommon/hermes" 1102 | React-ImageManager: 1103 | :path: "../node_modules/react-native/ReactCommon/react/renderer/imagemanager/platform/ios" 1104 | React-jsi: 1105 | :path: "../node_modules/react-native/ReactCommon/jsi" 1106 | React-jsiexecutor: 1107 | :path: "../node_modules/react-native/ReactCommon/jsiexecutor" 1108 | React-jsinspector: 1109 | :path: "../node_modules/react-native/ReactCommon/jsinspector" 1110 | React-logger: 1111 | :path: "../node_modules/react-native/ReactCommon/logger" 1112 | react-native-totp-utils: 1113 | :path: "../.." 1114 | React-NativeModulesApple: 1115 | :path: "../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios" 1116 | React-perflogger: 1117 | :path: "../node_modules/react-native/ReactCommon/reactperflogger" 1118 | React-RCTActionSheet: 1119 | :path: "../node_modules/react-native/Libraries/ActionSheetIOS" 1120 | React-RCTAnimation: 1121 | :path: "../node_modules/react-native/Libraries/NativeAnimation" 1122 | React-RCTAppDelegate: 1123 | :path: "../node_modules/react-native/Libraries/AppDelegate" 1124 | React-RCTBlob: 1125 | :path: "../node_modules/react-native/Libraries/Blob" 1126 | React-RCTFabric: 1127 | :path: "../node_modules/react-native/React" 1128 | React-RCTImage: 1129 | :path: "../node_modules/react-native/Libraries/Image" 1130 | React-RCTLinking: 1131 | :path: "../node_modules/react-native/Libraries/LinkingIOS" 1132 | React-RCTNetwork: 1133 | :path: "../node_modules/react-native/Libraries/Network" 1134 | React-RCTSettings: 1135 | :path: "../node_modules/react-native/Libraries/Settings" 1136 | React-RCTText: 1137 | :path: "../node_modules/react-native/Libraries/Text" 1138 | React-RCTVibration: 1139 | :path: "../node_modules/react-native/Libraries/Vibration" 1140 | React-rncore: 1141 | :path: "../node_modules/react-native/ReactCommon" 1142 | React-runtimeexecutor: 1143 | :path: "../node_modules/react-native/ReactCommon/runtimeexecutor" 1144 | React-runtimescheduler: 1145 | :path: "../node_modules/react-native/ReactCommon/react/renderer/runtimescheduler" 1146 | React-utils: 1147 | :path: "../node_modules/react-native/ReactCommon/react/utils" 1148 | ReactCommon: 1149 | :path: "../node_modules/react-native/ReactCommon" 1150 | Yoga: 1151 | :path: "../node_modules/react-native/ReactCommon/yoga" 1152 | 1153 | SPEC CHECKSUMS: 1154 | boost: 57d2868c099736d80fcd648bf211b4431e51a558 1155 | DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54 1156 | FBLazyVector: bb17efca94c43508cbe54fb0a35e36df30da5213 1157 | fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9 1158 | glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b 1159 | hermes-engine: c85f703623cb12d7e1d9db91afe53b3ea8aa7219 1160 | libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913 1161 | RCT-Folly: 424b8c9a7a0b9ab2886ffe9c3b041ef628fd4fb1 1162 | RCTRequired: 656ef0536dd60a9740961ade6a64ba0cb0572d2b 1163 | RCTTypeSafety: 82bd23b63f043d1a6b8e80e72fd15c08e04528a4 1164 | React: 4f2c0b59d1a1c0ae02771deb69e5ee78999fee79 1165 | React-callinvoker: d5aa9fa6cd6b67d6033de2cb5af6de7ae3dac6ca 1166 | React-Codegen: 94b6dff61916095dd90b3f536743a404765767f1 1167 | React-Core: 668dad9409152ff684f52bcb125133b8fec4c941 1168 | React-CoreModules: b02ca7a4fb869bcbe4c0ed2c939d433f13a120c5 1169 | React-cxxreact: 2882426515cd264fac5b8a5501d2b1e8ba127544 1170 | React-debug: 77ab539975d81d27153e2998bc1214a2473cde01 1171 | React-Fabric: 7c7a04fdaa446d07a8d4606d6488d2fa84ebdebc 1172 | React-graphics: 0af7822772800c6d6a1791980d4a6a957a533003 1173 | React-hermes: 118fc1a6278dd1a4fddd627185dd21ef150c6423 1174 | React-ImageManager: 51cc4aef17d090fb7c69daff972200b0fd6c7f3c 1175 | React-jsi: deef1a7418729b2e7e1b99c87e1c6d9df23c2e18 1176 | React-jsiexecutor: 990287d74aedc4fdd08ebd80736b1a5c71b54da2 1177 | React-jsinspector: 8d754fc957255a29d93e52fc67a895045cdc8703 1178 | React-logger: 454ffb01980778a43b0153ee98721d0275b56616 1179 | react-native-totp-utils: 502c18083eb8681c2caf3bcdf6d07030f3e6af2d 1180 | React-NativeModulesApple: 038cd625999ff352fc13d11fd335ea7509794599 1181 | React-perflogger: 684a11499a0589cc42135d6d5cc04d0e4e0e261a 1182 | React-RCTActionSheet: 00b0a4c382a13b834124fa3f541a7d8d1d56efb9 1183 | React-RCTAnimation: 10c24c66fb504f2faa53f4ec0666c4568255cff9 1184 | React-RCTAppDelegate: 9f077d5ab0ca2a97b9405c4dc751c38d5e5c85a1 1185 | React-RCTBlob: 10814291c4e8ef09fd2ceca81825eae29ee5a4ec 1186 | React-RCTFabric: 3d9f20d934764b479bcb760c8bcd926b87e6f42c 1187 | React-RCTImage: 2f609dd1c80c4aec8edf2ca235cba476fdd442ec 1188 | React-RCTLinking: d7f20b7d51246bf34790ce1362d124cc1b42671b 1189 | React-RCTNetwork: 6b0133de954b5eff5e6a6294eef5fca45df7e5e8 1190 | React-RCTSettings: 9a1f3f5f3e104c0617d953acc54e60e4bfaf11bd 1191 | React-RCTText: f5b4c03708c0283699c0dc23c7fb9f97ce7ac6bd 1192 | React-RCTVibration: fb4135690f091ac9bcfbeb8dc4388208ca0e18b1 1193 | React-rncore: affc793e47d77df810cf5d242d6bdc3b8ea38082 1194 | React-runtimeexecutor: 56b9f7665138fe8cda0d6c210cf95ee3f625c237 1195 | React-runtimescheduler: 24614bcd31643eacb06c78c0b9101b453d6aac47 1196 | React-utils: c12d2e75c8bbc727939ddc4319ed95493395ed5a 1197 | ReactCommon: 517b45ed311ba9146aa8b55a8ef6617425f7448e 1198 | SocketRocket: fccef3f9c5cedea1353a9ef6ada904fde10d6608 1199 | Yoga: 1d6727ed193122f6adaf435c3de1a768326ff83b 1200 | 1201 | PODFILE CHECKSUM: ef4ee173e0ee6cb7bef4aa5a7fa6de820232d4ff 1202 | 1203 | COCOAPODS: 1.12.1 1204 | -------------------------------------------------------------------------------- /example/ios/TotpUtilsExample-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | -------------------------------------------------------------------------------- /example/ios/TotpUtilsExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 54; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 00E356F31AD99517003FC87E /* TotpUtilsExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* TotpUtilsExampleTests.m */; }; 11 | 0C80B921A6F3F58F76C31292 /* libPods-TotpUtilsExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5DCACB8F33CDC322A6C60F78 /* libPods-TotpUtilsExample.a */; }; 12 | 13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.mm */; }; 13 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 14 | 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 15 | 7699B88040F8A987B510C191 /* libPods-TotpUtilsExample-TotpUtilsExampleTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 19F6CBCC0A4E27FBF8BF4A61 /* libPods-TotpUtilsExample-TotpUtilsExampleTests.a */; }; 16 | 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXContainerItemProxy section */ 20 | 00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = { 21 | isa = PBXContainerItemProxy; 22 | containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; 23 | proxyType = 1; 24 | remoteGlobalIDString = 13B07F861A680F5B00A75B9A; 25 | remoteInfo = TotpUtilsExample; 26 | }; 27 | /* End PBXContainerItemProxy section */ 28 | 29 | /* Begin PBXFileReference section */ 30 | 00E356EE1AD99517003FC87E /* TotpUtilsExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TotpUtilsExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 31 | 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 32 | 00E356F21AD99517003FC87E /* TotpUtilsExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TotpUtilsExampleTests.m; sourceTree = ""; }; 33 | 13B07F961A680F5B00A75B9A /* TotpUtilsExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TotpUtilsExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 34 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = TotpUtilsExample/AppDelegate.h; sourceTree = ""; }; 35 | 13B07FB01A68108700A75B9A /* AppDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AppDelegate.mm; path = TotpUtilsExample/AppDelegate.mm; sourceTree = ""; }; 36 | 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = TotpUtilsExample/Images.xcassets; sourceTree = ""; }; 37 | 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = TotpUtilsExample/Info.plist; sourceTree = ""; }; 38 | 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = TotpUtilsExample/main.m; sourceTree = ""; }; 39 | 19F6CBCC0A4E27FBF8BF4A61 /* libPods-TotpUtilsExample-TotpUtilsExampleTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-TotpUtilsExample-TotpUtilsExampleTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 40 | 3B4392A12AC88292D35C810B /* Pods-TotpUtilsExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TotpUtilsExample.debug.xcconfig"; path = "Target Support Files/Pods-TotpUtilsExample/Pods-TotpUtilsExample.debug.xcconfig"; sourceTree = ""; }; 41 | 5709B34CF0A7D63546082F79 /* Pods-TotpUtilsExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TotpUtilsExample.release.xcconfig"; path = "Target Support Files/Pods-TotpUtilsExample/Pods-TotpUtilsExample.release.xcconfig"; sourceTree = ""; }; 42 | 5B7EB9410499542E8C5724F5 /* Pods-TotpUtilsExample-TotpUtilsExampleTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TotpUtilsExample-TotpUtilsExampleTests.debug.xcconfig"; path = "Target Support Files/Pods-TotpUtilsExample-TotpUtilsExampleTests/Pods-TotpUtilsExample-TotpUtilsExampleTests.debug.xcconfig"; sourceTree = ""; }; 43 | 5DCACB8F33CDC322A6C60F78 /* libPods-TotpUtilsExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-TotpUtilsExample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 44 | 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = TotpUtilsExample/LaunchScreen.storyboard; sourceTree = ""; }; 45 | 89C6BE57DB24E9ADA2F236DE /* Pods-TotpUtilsExample-TotpUtilsExampleTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TotpUtilsExample-TotpUtilsExampleTests.release.xcconfig"; path = "Target Support Files/Pods-TotpUtilsExample-TotpUtilsExampleTests/Pods-TotpUtilsExample-TotpUtilsExampleTests.release.xcconfig"; sourceTree = ""; }; 46 | ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; 47 | /* End PBXFileReference section */ 48 | 49 | /* Begin PBXFrameworksBuildPhase section */ 50 | 00E356EB1AD99517003FC87E /* Frameworks */ = { 51 | isa = PBXFrameworksBuildPhase; 52 | buildActionMask = 2147483647; 53 | files = ( 54 | 7699B88040F8A987B510C191 /* libPods-TotpUtilsExample-TotpUtilsExampleTests.a in Frameworks */, 55 | ); 56 | runOnlyForDeploymentPostprocessing = 0; 57 | }; 58 | 13B07F8C1A680F5B00A75B9A /* Frameworks */ = { 59 | isa = PBXFrameworksBuildPhase; 60 | buildActionMask = 2147483647; 61 | files = ( 62 | 0C80B921A6F3F58F76C31292 /* libPods-TotpUtilsExample.a in Frameworks */, 63 | ); 64 | runOnlyForDeploymentPostprocessing = 0; 65 | }; 66 | /* End PBXFrameworksBuildPhase section */ 67 | 68 | /* Begin PBXGroup section */ 69 | 00E356EF1AD99517003FC87E /* TotpUtilsExampleTests */ = { 70 | isa = PBXGroup; 71 | children = ( 72 | 00E356F21AD99517003FC87E /* TotpUtilsExampleTests.m */, 73 | 00E356F01AD99517003FC87E /* Supporting Files */, 74 | ); 75 | path = TotpUtilsExampleTests; 76 | sourceTree = ""; 77 | }; 78 | 00E356F01AD99517003FC87E /* Supporting Files */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 00E356F11AD99517003FC87E /* Info.plist */, 82 | ); 83 | name = "Supporting Files"; 84 | sourceTree = ""; 85 | }; 86 | 13B07FAE1A68108700A75B9A /* TotpUtilsExample */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */, 90 | 13B07FB01A68108700A75B9A /* AppDelegate.mm */, 91 | 13B07FB51A68108700A75B9A /* Images.xcassets */, 92 | 13B07FB61A68108700A75B9A /* Info.plist */, 93 | 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */, 94 | 13B07FB71A68108700A75B9A /* main.m */, 95 | ); 96 | name = TotpUtilsExample; 97 | sourceTree = ""; 98 | }; 99 | 2D16E6871FA4F8E400B85C8A /* Frameworks */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | ED297162215061F000B7C4FE /* JavaScriptCore.framework */, 103 | 5DCACB8F33CDC322A6C60F78 /* libPods-TotpUtilsExample.a */, 104 | 19F6CBCC0A4E27FBF8BF4A61 /* libPods-TotpUtilsExample-TotpUtilsExampleTests.a */, 105 | ); 106 | name = Frameworks; 107 | sourceTree = ""; 108 | }; 109 | 832341AE1AAA6A7D00B99B32 /* Libraries */ = { 110 | isa = PBXGroup; 111 | children = ( 112 | ); 113 | name = Libraries; 114 | sourceTree = ""; 115 | }; 116 | 83CBB9F61A601CBA00E9B192 = { 117 | isa = PBXGroup; 118 | children = ( 119 | 13B07FAE1A68108700A75B9A /* TotpUtilsExample */, 120 | 832341AE1AAA6A7D00B99B32 /* Libraries */, 121 | 00E356EF1AD99517003FC87E /* TotpUtilsExampleTests */, 122 | 83CBBA001A601CBA00E9B192 /* Products */, 123 | 2D16E6871FA4F8E400B85C8A /* Frameworks */, 124 | BBD78D7AC51CEA395F1C20DB /* Pods */, 125 | ); 126 | indentWidth = 2; 127 | sourceTree = ""; 128 | tabWidth = 2; 129 | usesTabs = 0; 130 | }; 131 | 83CBBA001A601CBA00E9B192 /* Products */ = { 132 | isa = PBXGroup; 133 | children = ( 134 | 13B07F961A680F5B00A75B9A /* TotpUtilsExample.app */, 135 | 00E356EE1AD99517003FC87E /* TotpUtilsExampleTests.xctest */, 136 | ); 137 | name = Products; 138 | sourceTree = ""; 139 | }; 140 | BBD78D7AC51CEA395F1C20DB /* Pods */ = { 141 | isa = PBXGroup; 142 | children = ( 143 | 3B4392A12AC88292D35C810B /* Pods-TotpUtilsExample.debug.xcconfig */, 144 | 5709B34CF0A7D63546082F79 /* Pods-TotpUtilsExample.release.xcconfig */, 145 | 5B7EB9410499542E8C5724F5 /* Pods-TotpUtilsExample-TotpUtilsExampleTests.debug.xcconfig */, 146 | 89C6BE57DB24E9ADA2F236DE /* Pods-TotpUtilsExample-TotpUtilsExampleTests.release.xcconfig */, 147 | ); 148 | path = Pods; 149 | sourceTree = ""; 150 | }; 151 | /* End PBXGroup section */ 152 | 153 | /* Begin PBXNativeTarget section */ 154 | 00E356ED1AD99517003FC87E /* TotpUtilsExampleTests */ = { 155 | isa = PBXNativeTarget; 156 | buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "TotpUtilsExampleTests" */; 157 | buildPhases = ( 158 | A55EABD7B0C7F3A422A6CC61 /* [CP] Check Pods Manifest.lock */, 159 | 00E356EA1AD99517003FC87E /* Sources */, 160 | 00E356EB1AD99517003FC87E /* Frameworks */, 161 | 00E356EC1AD99517003FC87E /* Resources */, 162 | C59DA0FBD6956966B86A3779 /* [CP] Embed Pods Frameworks */, 163 | F6A41C54EA430FDDC6A6ED99 /* [CP] Copy Pods Resources */, 164 | ); 165 | buildRules = ( 166 | ); 167 | dependencies = ( 168 | 00E356F51AD99517003FC87E /* PBXTargetDependency */, 169 | ); 170 | name = TotpUtilsExampleTests; 171 | productName = TotpUtilsExampleTests; 172 | productReference = 00E356EE1AD99517003FC87E /* TotpUtilsExampleTests.xctest */; 173 | productType = "com.apple.product-type.bundle.unit-test"; 174 | }; 175 | 13B07F861A680F5B00A75B9A /* TotpUtilsExample */ = { 176 | isa = PBXNativeTarget; 177 | buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "TotpUtilsExample" */; 178 | buildPhases = ( 179 | C38B50BA6285516D6DCD4F65 /* [CP] Check Pods Manifest.lock */, 180 | FD10A7F022414F080027D42C /* Start Packager */, 181 | 13B07F871A680F5B00A75B9A /* Sources */, 182 | 13B07F8C1A680F5B00A75B9A /* Frameworks */, 183 | 13B07F8E1A680F5B00A75B9A /* Resources */, 184 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, 185 | 00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */, 186 | E235C05ADACE081382539298 /* [CP] Copy Pods Resources */, 187 | ); 188 | buildRules = ( 189 | ); 190 | dependencies = ( 191 | ); 192 | name = TotpUtilsExample; 193 | productName = TotpUtilsExample; 194 | productReference = 13B07F961A680F5B00A75B9A /* TotpUtilsExample.app */; 195 | productType = "com.apple.product-type.application"; 196 | }; 197 | /* End PBXNativeTarget section */ 198 | 199 | /* Begin PBXProject section */ 200 | 83CBB9F71A601CBA00E9B192 /* Project object */ = { 201 | isa = PBXProject; 202 | attributes = { 203 | LastUpgradeCheck = 1210; 204 | TargetAttributes = { 205 | 00E356ED1AD99517003FC87E = { 206 | CreatedOnToolsVersion = 6.2; 207 | TestTargetID = 13B07F861A680F5B00A75B9A; 208 | }; 209 | 13B07F861A680F5B00A75B9A = { 210 | LastSwiftMigration = 1120; 211 | }; 212 | }; 213 | }; 214 | buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "TotpUtilsExample" */; 215 | compatibilityVersion = "Xcode 12.0"; 216 | developmentRegion = en; 217 | hasScannedForEncodings = 0; 218 | knownRegions = ( 219 | en, 220 | Base, 221 | ); 222 | mainGroup = 83CBB9F61A601CBA00E9B192; 223 | productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; 224 | projectDirPath = ""; 225 | projectRoot = ""; 226 | targets = ( 227 | 13B07F861A680F5B00A75B9A /* TotpUtilsExample */, 228 | 00E356ED1AD99517003FC87E /* TotpUtilsExampleTests */, 229 | ); 230 | }; 231 | /* End PBXProject section */ 232 | 233 | /* Begin PBXResourcesBuildPhase section */ 234 | 00E356EC1AD99517003FC87E /* Resources */ = { 235 | isa = PBXResourcesBuildPhase; 236 | buildActionMask = 2147483647; 237 | files = ( 238 | ); 239 | runOnlyForDeploymentPostprocessing = 0; 240 | }; 241 | 13B07F8E1A680F5B00A75B9A /* Resources */ = { 242 | isa = PBXResourcesBuildPhase; 243 | buildActionMask = 2147483647; 244 | files = ( 245 | 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */, 246 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, 247 | ); 248 | runOnlyForDeploymentPostprocessing = 0; 249 | }; 250 | /* End PBXResourcesBuildPhase section */ 251 | 252 | /* Begin PBXShellScriptBuildPhase section */ 253 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = { 254 | isa = PBXShellScriptBuildPhase; 255 | buildActionMask = 2147483647; 256 | files = ( 257 | ); 258 | inputPaths = ( 259 | "$(SRCROOT)/.xcode.env.local", 260 | "$(SRCROOT)/.xcode.env", 261 | ); 262 | name = "Bundle React Native code and images"; 263 | outputPaths = ( 264 | ); 265 | runOnlyForDeploymentPostprocessing = 0; 266 | shellPath = /bin/sh; 267 | shellScript = "set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n"; 268 | }; 269 | 00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */ = { 270 | isa = PBXShellScriptBuildPhase; 271 | buildActionMask = 2147483647; 272 | files = ( 273 | ); 274 | inputFileListPaths = ( 275 | "${PODS_ROOT}/Target Support Files/Pods-TotpUtilsExample/Pods-TotpUtilsExample-frameworks-${CONFIGURATION}-input-files.xcfilelist", 276 | ); 277 | name = "[CP] Embed Pods Frameworks"; 278 | outputFileListPaths = ( 279 | "${PODS_ROOT}/Target Support Files/Pods-TotpUtilsExample/Pods-TotpUtilsExample-frameworks-${CONFIGURATION}-output-files.xcfilelist", 280 | ); 281 | runOnlyForDeploymentPostprocessing = 0; 282 | shellPath = /bin/sh; 283 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-TotpUtilsExample/Pods-TotpUtilsExample-frameworks.sh\"\n"; 284 | showEnvVarsInLog = 0; 285 | }; 286 | A55EABD7B0C7F3A422A6CC61 /* [CP] Check Pods Manifest.lock */ = { 287 | isa = PBXShellScriptBuildPhase; 288 | buildActionMask = 2147483647; 289 | files = ( 290 | ); 291 | inputFileListPaths = ( 292 | ); 293 | inputPaths = ( 294 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 295 | "${PODS_ROOT}/Manifest.lock", 296 | ); 297 | name = "[CP] Check Pods Manifest.lock"; 298 | outputFileListPaths = ( 299 | ); 300 | outputPaths = ( 301 | "$(DERIVED_FILE_DIR)/Pods-TotpUtilsExample-TotpUtilsExampleTests-checkManifestLockResult.txt", 302 | ); 303 | runOnlyForDeploymentPostprocessing = 0; 304 | shellPath = /bin/sh; 305 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 306 | showEnvVarsInLog = 0; 307 | }; 308 | C38B50BA6285516D6DCD4F65 /* [CP] Check Pods Manifest.lock */ = { 309 | isa = PBXShellScriptBuildPhase; 310 | buildActionMask = 2147483647; 311 | files = ( 312 | ); 313 | inputFileListPaths = ( 314 | ); 315 | inputPaths = ( 316 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 317 | "${PODS_ROOT}/Manifest.lock", 318 | ); 319 | name = "[CP] Check Pods Manifest.lock"; 320 | outputFileListPaths = ( 321 | ); 322 | outputPaths = ( 323 | "$(DERIVED_FILE_DIR)/Pods-TotpUtilsExample-checkManifestLockResult.txt", 324 | ); 325 | runOnlyForDeploymentPostprocessing = 0; 326 | shellPath = /bin/sh; 327 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 328 | showEnvVarsInLog = 0; 329 | }; 330 | C59DA0FBD6956966B86A3779 /* [CP] Embed Pods Frameworks */ = { 331 | isa = PBXShellScriptBuildPhase; 332 | buildActionMask = 2147483647; 333 | files = ( 334 | ); 335 | inputFileListPaths = ( 336 | "${PODS_ROOT}/Target Support Files/Pods-TotpUtilsExample-TotpUtilsExampleTests/Pods-TotpUtilsExample-TotpUtilsExampleTests-frameworks-${CONFIGURATION}-input-files.xcfilelist", 337 | ); 338 | name = "[CP] Embed Pods Frameworks"; 339 | outputFileListPaths = ( 340 | "${PODS_ROOT}/Target Support Files/Pods-TotpUtilsExample-TotpUtilsExampleTests/Pods-TotpUtilsExample-TotpUtilsExampleTests-frameworks-${CONFIGURATION}-output-files.xcfilelist", 341 | ); 342 | runOnlyForDeploymentPostprocessing = 0; 343 | shellPath = /bin/sh; 344 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-TotpUtilsExample-TotpUtilsExampleTests/Pods-TotpUtilsExample-TotpUtilsExampleTests-frameworks.sh\"\n"; 345 | showEnvVarsInLog = 0; 346 | }; 347 | E235C05ADACE081382539298 /* [CP] Copy Pods Resources */ = { 348 | isa = PBXShellScriptBuildPhase; 349 | buildActionMask = 2147483647; 350 | files = ( 351 | ); 352 | inputFileListPaths = ( 353 | "${PODS_ROOT}/Target Support Files/Pods-TotpUtilsExample/Pods-TotpUtilsExample-resources-${CONFIGURATION}-input-files.xcfilelist", 354 | ); 355 | name = "[CP] Copy Pods Resources"; 356 | outputFileListPaths = ( 357 | "${PODS_ROOT}/Target Support Files/Pods-TotpUtilsExample/Pods-TotpUtilsExample-resources-${CONFIGURATION}-output-files.xcfilelist", 358 | ); 359 | runOnlyForDeploymentPostprocessing = 0; 360 | shellPath = /bin/sh; 361 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-TotpUtilsExample/Pods-TotpUtilsExample-resources.sh\"\n"; 362 | showEnvVarsInLog = 0; 363 | }; 364 | F6A41C54EA430FDDC6A6ED99 /* [CP] Copy Pods Resources */ = { 365 | isa = PBXShellScriptBuildPhase; 366 | buildActionMask = 2147483647; 367 | files = ( 368 | ); 369 | inputFileListPaths = ( 370 | "${PODS_ROOT}/Target Support Files/Pods-TotpUtilsExample-TotpUtilsExampleTests/Pods-TotpUtilsExample-TotpUtilsExampleTests-resources-${CONFIGURATION}-input-files.xcfilelist", 371 | ); 372 | name = "[CP] Copy Pods Resources"; 373 | outputFileListPaths = ( 374 | "${PODS_ROOT}/Target Support Files/Pods-TotpUtilsExample-TotpUtilsExampleTests/Pods-TotpUtilsExample-TotpUtilsExampleTests-resources-${CONFIGURATION}-output-files.xcfilelist", 375 | ); 376 | runOnlyForDeploymentPostprocessing = 0; 377 | shellPath = /bin/sh; 378 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-TotpUtilsExample-TotpUtilsExampleTests/Pods-TotpUtilsExample-TotpUtilsExampleTests-resources.sh\"\n"; 379 | showEnvVarsInLog = 0; 380 | }; 381 | FD10A7F022414F080027D42C /* Start Packager */ = { 382 | isa = PBXShellScriptBuildPhase; 383 | buildActionMask = 2147483647; 384 | files = ( 385 | ); 386 | inputFileListPaths = ( 387 | ); 388 | inputPaths = ( 389 | ); 390 | name = "Start Packager"; 391 | outputFileListPaths = ( 392 | ); 393 | outputPaths = ( 394 | ); 395 | runOnlyForDeploymentPostprocessing = 0; 396 | shellPath = /bin/sh; 397 | shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../node_modules/react-native/scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open \"$SRCROOT/../node_modules/react-native/scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi\n"; 398 | showEnvVarsInLog = 0; 399 | }; 400 | /* End PBXShellScriptBuildPhase section */ 401 | 402 | /* Begin PBXSourcesBuildPhase section */ 403 | 00E356EA1AD99517003FC87E /* Sources */ = { 404 | isa = PBXSourcesBuildPhase; 405 | buildActionMask = 2147483647; 406 | files = ( 407 | 00E356F31AD99517003FC87E /* TotpUtilsExampleTests.m in Sources */, 408 | ); 409 | runOnlyForDeploymentPostprocessing = 0; 410 | }; 411 | 13B07F871A680F5B00A75B9A /* Sources */ = { 412 | isa = PBXSourcesBuildPhase; 413 | buildActionMask = 2147483647; 414 | files = ( 415 | 13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */, 416 | 13B07FC11A68108700A75B9A /* main.m in Sources */, 417 | ); 418 | runOnlyForDeploymentPostprocessing = 0; 419 | }; 420 | /* End PBXSourcesBuildPhase section */ 421 | 422 | /* Begin PBXTargetDependency section */ 423 | 00E356F51AD99517003FC87E /* PBXTargetDependency */ = { 424 | isa = PBXTargetDependency; 425 | target = 13B07F861A680F5B00A75B9A /* TotpUtilsExample */; 426 | targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */; 427 | }; 428 | /* End PBXTargetDependency section */ 429 | 430 | /* Begin XCBuildConfiguration section */ 431 | 00E356F61AD99517003FC87E /* Debug */ = { 432 | isa = XCBuildConfiguration; 433 | baseConfigurationReference = 5B7EB9410499542E8C5724F5 /* Pods-TotpUtilsExample-TotpUtilsExampleTests.debug.xcconfig */; 434 | buildSettings = { 435 | BUNDLE_LOADER = "$(TEST_HOST)"; 436 | GCC_PREPROCESSOR_DEFINITIONS = ( 437 | "DEBUG=1", 438 | "$(inherited)", 439 | ); 440 | INFOPLIST_FILE = TotpUtilsExampleTests/Info.plist; 441 | IPHONEOS_DEPLOYMENT_TARGET = 12.4; 442 | LD_RUNPATH_SEARCH_PATHS = ( 443 | "$(inherited)", 444 | "@executable_path/Frameworks", 445 | "@loader_path/Frameworks", 446 | ); 447 | OTHER_LDFLAGS = ( 448 | "-ObjC", 449 | "-lc++", 450 | "$(inherited)", 451 | ); 452 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; 453 | PRODUCT_NAME = "$(TARGET_NAME)"; 454 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TotpUtilsExample.app/TotpUtilsExample"; 455 | }; 456 | name = Debug; 457 | }; 458 | 00E356F71AD99517003FC87E /* Release */ = { 459 | isa = XCBuildConfiguration; 460 | baseConfigurationReference = 89C6BE57DB24E9ADA2F236DE /* Pods-TotpUtilsExample-TotpUtilsExampleTests.release.xcconfig */; 461 | buildSettings = { 462 | BUNDLE_LOADER = "$(TEST_HOST)"; 463 | COPY_PHASE_STRIP = NO; 464 | INFOPLIST_FILE = TotpUtilsExampleTests/Info.plist; 465 | IPHONEOS_DEPLOYMENT_TARGET = 12.4; 466 | LD_RUNPATH_SEARCH_PATHS = ( 467 | "$(inherited)", 468 | "@executable_path/Frameworks", 469 | "@loader_path/Frameworks", 470 | ); 471 | OTHER_LDFLAGS = ( 472 | "-ObjC", 473 | "-lc++", 474 | "$(inherited)", 475 | ); 476 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; 477 | PRODUCT_NAME = "$(TARGET_NAME)"; 478 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TotpUtilsExample.app/TotpUtilsExample"; 479 | }; 480 | name = Release; 481 | }; 482 | 13B07F941A680F5B00A75B9A /* Debug */ = { 483 | isa = XCBuildConfiguration; 484 | baseConfigurationReference = 3B4392A12AC88292D35C810B /* Pods-TotpUtilsExample.debug.xcconfig */; 485 | buildSettings = { 486 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 487 | CLANG_ENABLE_MODULES = YES; 488 | CURRENT_PROJECT_VERSION = 1; 489 | ENABLE_BITCODE = NO; 490 | INFOPLIST_FILE = TotpUtilsExample/Info.plist; 491 | LD_RUNPATH_SEARCH_PATHS = ( 492 | "$(inherited)", 493 | "@executable_path/Frameworks", 494 | ); 495 | MARKETING_VERSION = 1.0; 496 | OTHER_LDFLAGS = ( 497 | "$(inherited)", 498 | "-ObjC", 499 | "-lc++", 500 | ); 501 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; 502 | PRODUCT_NAME = TotpUtilsExample; 503 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 504 | SWIFT_VERSION = 5.0; 505 | VERSIONING_SYSTEM = "apple-generic"; 506 | }; 507 | name = Debug; 508 | }; 509 | 13B07F951A680F5B00A75B9A /* Release */ = { 510 | isa = XCBuildConfiguration; 511 | baseConfigurationReference = 5709B34CF0A7D63546082F79 /* Pods-TotpUtilsExample.release.xcconfig */; 512 | buildSettings = { 513 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 514 | CLANG_ENABLE_MODULES = YES; 515 | CURRENT_PROJECT_VERSION = 1; 516 | INFOPLIST_FILE = TotpUtilsExample/Info.plist; 517 | LD_RUNPATH_SEARCH_PATHS = ( 518 | "$(inherited)", 519 | "@executable_path/Frameworks", 520 | ); 521 | MARKETING_VERSION = 1.0; 522 | OTHER_LDFLAGS = ( 523 | "$(inherited)", 524 | "-ObjC", 525 | "-lc++", 526 | ); 527 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; 528 | PRODUCT_NAME = TotpUtilsExample; 529 | SWIFT_VERSION = 5.0; 530 | VERSIONING_SYSTEM = "apple-generic"; 531 | }; 532 | name = Release; 533 | }; 534 | 83CBBA201A601CBA00E9B192 /* Debug */ = { 535 | isa = XCBuildConfiguration; 536 | buildSettings = { 537 | ALWAYS_SEARCH_USER_PATHS = NO; 538 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 539 | CLANG_CXX_LANGUAGE_STANDARD = "c++17"; 540 | CLANG_CXX_LIBRARY = "libc++"; 541 | CLANG_ENABLE_MODULES = YES; 542 | CLANG_ENABLE_OBJC_ARC = YES; 543 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 544 | CLANG_WARN_BOOL_CONVERSION = YES; 545 | CLANG_WARN_COMMA = YES; 546 | CLANG_WARN_CONSTANT_CONVERSION = YES; 547 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 548 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 549 | CLANG_WARN_EMPTY_BODY = YES; 550 | CLANG_WARN_ENUM_CONVERSION = YES; 551 | CLANG_WARN_INFINITE_RECURSION = YES; 552 | CLANG_WARN_INT_CONVERSION = YES; 553 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 554 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 555 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 556 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 557 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 558 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 559 | CLANG_WARN_STRICT_PROTOTYPES = YES; 560 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 561 | CLANG_WARN_UNREACHABLE_CODE = YES; 562 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 563 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 564 | COPY_PHASE_STRIP = NO; 565 | ENABLE_STRICT_OBJC_MSGSEND = YES; 566 | ENABLE_TESTABILITY = YES; 567 | "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386; 568 | GCC_C_LANGUAGE_STANDARD = gnu99; 569 | GCC_DYNAMIC_NO_PIC = NO; 570 | GCC_NO_COMMON_BLOCKS = YES; 571 | GCC_OPTIMIZATION_LEVEL = 0; 572 | GCC_PREPROCESSOR_DEFINITIONS = ( 573 | "DEBUG=1", 574 | "$(inherited)", 575 | ); 576 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 577 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 578 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 579 | GCC_WARN_UNDECLARED_SELECTOR = YES; 580 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 581 | GCC_WARN_UNUSED_FUNCTION = YES; 582 | GCC_WARN_UNUSED_VARIABLE = YES; 583 | IPHONEOS_DEPLOYMENT_TARGET = 12.4; 584 | LD_RUNPATH_SEARCH_PATHS = ( 585 | /usr/lib/swift, 586 | "$(inherited)", 587 | ); 588 | LIBRARY_SEARCH_PATHS = ( 589 | "\"$(SDKROOT)/usr/lib/swift\"", 590 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", 591 | "\"$(inherited)\"", 592 | ); 593 | MTL_ENABLE_DEBUG_INFO = YES; 594 | ONLY_ACTIVE_ARCH = YES; 595 | OTHER_CFLAGS = ( 596 | "$(inherited)", 597 | "-DRN_FABRIC_ENABLED", 598 | ); 599 | OTHER_CPLUSPLUSFLAGS = ( 600 | "$(OTHER_CFLAGS)", 601 | "-DFOLLY_NO_CONFIG", 602 | "-DFOLLY_MOBILE=1", 603 | "-DFOLLY_USE_LIBCPP=1", 604 | "-DRN_FABRIC_ENABLED", 605 | ); 606 | REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; 607 | SDKROOT = iphoneos; 608 | }; 609 | name = Debug; 610 | }; 611 | 83CBBA211A601CBA00E9B192 /* Release */ = { 612 | isa = XCBuildConfiguration; 613 | buildSettings = { 614 | ALWAYS_SEARCH_USER_PATHS = NO; 615 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 616 | CLANG_CXX_LANGUAGE_STANDARD = "c++17"; 617 | CLANG_CXX_LIBRARY = "libc++"; 618 | CLANG_ENABLE_MODULES = YES; 619 | CLANG_ENABLE_OBJC_ARC = YES; 620 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 621 | CLANG_WARN_BOOL_CONVERSION = YES; 622 | CLANG_WARN_COMMA = YES; 623 | CLANG_WARN_CONSTANT_CONVERSION = YES; 624 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 625 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 626 | CLANG_WARN_EMPTY_BODY = YES; 627 | CLANG_WARN_ENUM_CONVERSION = YES; 628 | CLANG_WARN_INFINITE_RECURSION = YES; 629 | CLANG_WARN_INT_CONVERSION = YES; 630 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 631 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 632 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 633 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 634 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 635 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 636 | CLANG_WARN_STRICT_PROTOTYPES = YES; 637 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 638 | CLANG_WARN_UNREACHABLE_CODE = YES; 639 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 640 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 641 | COPY_PHASE_STRIP = YES; 642 | ENABLE_NS_ASSERTIONS = NO; 643 | ENABLE_STRICT_OBJC_MSGSEND = YES; 644 | "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386; 645 | GCC_C_LANGUAGE_STANDARD = gnu99; 646 | GCC_NO_COMMON_BLOCKS = YES; 647 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 648 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 649 | GCC_WARN_UNDECLARED_SELECTOR = YES; 650 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 651 | GCC_WARN_UNUSED_FUNCTION = YES; 652 | GCC_WARN_UNUSED_VARIABLE = YES; 653 | IPHONEOS_DEPLOYMENT_TARGET = 12.4; 654 | LD_RUNPATH_SEARCH_PATHS = ( 655 | /usr/lib/swift, 656 | "$(inherited)", 657 | ); 658 | LIBRARY_SEARCH_PATHS = ( 659 | "\"$(SDKROOT)/usr/lib/swift\"", 660 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", 661 | "\"$(inherited)\"", 662 | ); 663 | MTL_ENABLE_DEBUG_INFO = NO; 664 | OTHER_CFLAGS = ( 665 | "$(inherited)", 666 | "-DRN_FABRIC_ENABLED", 667 | ); 668 | OTHER_CPLUSPLUSFLAGS = ( 669 | "$(OTHER_CFLAGS)", 670 | "-DFOLLY_NO_CONFIG", 671 | "-DFOLLY_MOBILE=1", 672 | "-DFOLLY_USE_LIBCPP=1", 673 | "-DRN_FABRIC_ENABLED", 674 | ); 675 | REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; 676 | SDKROOT = iphoneos; 677 | VALIDATE_PRODUCT = YES; 678 | }; 679 | name = Release; 680 | }; 681 | /* End XCBuildConfiguration section */ 682 | 683 | /* Begin XCConfigurationList section */ 684 | 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "TotpUtilsExampleTests" */ = { 685 | isa = XCConfigurationList; 686 | buildConfigurations = ( 687 | 00E356F61AD99517003FC87E /* Debug */, 688 | 00E356F71AD99517003FC87E /* Release */, 689 | ); 690 | defaultConfigurationIsVisible = 0; 691 | defaultConfigurationName = Release; 692 | }; 693 | 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "TotpUtilsExample" */ = { 694 | isa = XCConfigurationList; 695 | buildConfigurations = ( 696 | 13B07F941A680F5B00A75B9A /* Debug */, 697 | 13B07F951A680F5B00A75B9A /* Release */, 698 | ); 699 | defaultConfigurationIsVisible = 0; 700 | defaultConfigurationName = Release; 701 | }; 702 | 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "TotpUtilsExample" */ = { 703 | isa = XCConfigurationList; 704 | buildConfigurations = ( 705 | 83CBBA201A601CBA00E9B192 /* Debug */, 706 | 83CBBA211A601CBA00E9B192 /* Release */, 707 | ); 708 | defaultConfigurationIsVisible = 0; 709 | defaultConfigurationName = Release; 710 | }; 711 | /* End XCConfigurationList section */ 712 | }; 713 | rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; 714 | } 715 | -------------------------------------------------------------------------------- /example/ios/TotpUtilsExample.xcodeproj/xcshareddata/xcschemes/TotpUtilsExample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 53 | 55 | 61 | 62 | 63 | 64 | 70 | 72 | 78 | 79 | 80 | 81 | 83 | 84 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /example/ios/TotpUtilsExample.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/ios/TotpUtilsExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/TotpUtilsExample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : RCTAppDelegate 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /example/ios/TotpUtilsExample/AppDelegate.mm: -------------------------------------------------------------------------------- 1 | #import "AppDelegate.h" 2 | 3 | #import 4 | 5 | @implementation AppDelegate 6 | 7 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 8 | { 9 | self.moduleName = @"TotpUtilsExample"; 10 | // You can add your custom initial props in the dictionary below. 11 | // They will be passed down to the ViewController used by React Native. 12 | self.initialProps = @{}; 13 | 14 | return [super application:application didFinishLaunchingWithOptions:launchOptions]; 15 | } 16 | 17 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge 18 | { 19 | #if DEBUG 20 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"]; 21 | #else 22 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 23 | #endif 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /example/ios/TotpUtilsExample/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "2x", 6 | "size" : "20x20" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "scale" : "3x", 11 | "size" : "20x20" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "scale" : "2x", 16 | "size" : "29x29" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "scale" : "3x", 21 | "size" : "29x29" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "scale" : "2x", 26 | "size" : "40x40" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "scale" : "3x", 31 | "size" : "40x40" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "scale" : "2x", 36 | "size" : "60x60" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "scale" : "3x", 41 | "size" : "60x60" 42 | }, 43 | { 44 | "idiom" : "ios-marketing", 45 | "scale" : "1x", 46 | "size" : "1024x1024" 47 | } 48 | ], 49 | "info" : { 50 | "author" : "xcode", 51 | "version" : 1 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /example/ios/TotpUtilsExample/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /example/ios/TotpUtilsExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | TotpUtilsExample 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(MARKETING_VERSION) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(CURRENT_PROJECT_VERSION) 25 | LSRequiresIPhoneOS 26 | 27 | NSAppTransportSecurity 28 | 29 | NSExceptionDomains 30 | 31 | localhost 32 | 33 | NSExceptionAllowsInsecureHTTPLoads 34 | 35 | 36 | 37 | 38 | NSLocationWhenInUseUsageDescription 39 | 40 | UILaunchStoryboardName 41 | LaunchScreen 42 | UIRequiredDeviceCapabilities 43 | 44 | armv7 45 | 46 | UISupportedInterfaceOrientations 47 | 48 | UIInterfaceOrientationPortrait 49 | UIInterfaceOrientationLandscapeLeft 50 | UIInterfaceOrientationLandscapeRight 51 | 52 | UIViewControllerBasedStatusBarAppearance 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /example/ios/TotpUtilsExample/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 24 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /example/ios/TotpUtilsExample/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | @autoreleasepool { 8 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /example/ios/TotpUtilsExampleTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /example/ios/TotpUtilsExampleTests/TotpUtilsExampleTests.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | #import 5 | #import 6 | 7 | #define TIMEOUT_SECONDS 600 8 | #define TEXT_TO_LOOK_FOR @"Welcome to React" 9 | 10 | @interface TotpUtilsExampleTests : XCTestCase 11 | 12 | @end 13 | 14 | @implementation TotpUtilsExampleTests 15 | 16 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL (^)(UIView *view))test 17 | { 18 | if (test(view)) { 19 | return YES; 20 | } 21 | for (UIView *subview in [view subviews]) { 22 | if ([self findSubviewInView:subview matching:test]) { 23 | return YES; 24 | } 25 | } 26 | return NO; 27 | } 28 | 29 | - (void)testRendersWelcomeScreen 30 | { 31 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController]; 32 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 33 | BOOL foundElement = NO; 34 | 35 | __block NSString *redboxError = nil; 36 | #ifdef DEBUG 37 | RCTSetLogFunction( 38 | ^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { 39 | if (level >= RCTLogLevelError) { 40 | redboxError = message; 41 | } 42 | }); 43 | #endif 44 | 45 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 46 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 47 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 48 | 49 | foundElement = [self findSubviewInView:vc.view 50 | matching:^BOOL(UIView *view) { 51 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 52 | return YES; 53 | } 54 | return NO; 55 | }]; 56 | } 57 | 58 | #ifdef DEBUG 59 | RCTSetLogFunction(RCTDefaultLogFunction); 60 | #endif 61 | 62 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 63 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 64 | } 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /example/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: 'react-native', 3 | }; 4 | -------------------------------------------------------------------------------- /example/metro.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const escape = require('escape-string-regexp'); 3 | const exclusionList = require('metro-config/src/defaults/exclusionList'); 4 | const pak = require('../package.json'); 5 | 6 | const root = path.resolve(__dirname, '..'); 7 | 8 | const modules = Object.keys({ 9 | ...pak.peerDependencies, 10 | }); 11 | 12 | module.exports = { 13 | projectRoot: __dirname, 14 | watchFolders: [root], 15 | 16 | // We need to make sure that only one version is loaded for peerDependencies 17 | // So we block them at the root, and alias them to the versions in example's node_modules 18 | resolver: { 19 | blacklistRE: exclusionList( 20 | modules.map( 21 | (m) => 22 | new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`) 23 | ) 24 | ), 25 | 26 | extraNodeModules: modules.reduce((acc, name) => { 27 | acc[name] = path.join(__dirname, 'node_modules', name); 28 | return acc; 29 | }, {}), 30 | }, 31 | 32 | transformer: { 33 | getTransformOptions: async () => ({ 34 | transform: { 35 | experimentalImportSupport: false, 36 | inlineRequires: true, 37 | }, 38 | }), 39 | }, 40 | }; 41 | -------------------------------------------------------------------------------- /example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "TotpUtilsExample", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "android": "react-native run-android", 7 | "ios": "react-native run-ios --simulator=\"iPhone 14 Pro\"", 8 | "start": "react-native start", 9 | "pods": "NO_FLIPPER=1 RCT_NEW_ARCH_ENABLED=1 pod-install --quiet" 10 | }, 11 | "dependencies": { 12 | "react": "18.2.0", 13 | "react-native": "^0.72.0" 14 | }, 15 | "devDependencies": { 16 | "@babel/core": "^7.20.0", 17 | "@babel/preset-env": "^7.20.0", 18 | "@babel/runtime": "^7.20.0", 19 | "babel-plugin-module-resolver": "^4.1.0", 20 | "metro-react-native-babel-preset": "0.76.5" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /example/react-native.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const pak = require('../package.json'); 3 | 4 | module.exports = { 5 | dependencies: { 6 | [pak.name]: { 7 | root: path.join(__dirname, '..'), 8 | }, 9 | }, 10 | }; 11 | -------------------------------------------------------------------------------- /example/src/App.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | 3 | import { StyleSheet, View, Text } from 'react-native'; 4 | import { 5 | generateOTP, 6 | generateSecretKey, 7 | validateOTP, 8 | formatSecretKey, 9 | formatOTP, 10 | } from 'react-native-totp-utils'; 11 | 12 | export default function App() { 13 | const [secretKey, setSecretKey] = React.useState(''); 14 | const [otp, setOTP] = React.useState(''); 15 | const [isValid, setIsValid] = React.useState(false); 16 | 17 | React.useEffect(() => { 18 | // generate secret key 19 | const secret = generateSecretKey(); 20 | // set formatted secret 21 | setSecretKey(formatSecretKey(secret)); 22 | 23 | // generate OTP 24 | const totp = generateOTP(secret); 25 | // set formatted OTP 26 | setOTP(formatOTP(totp)); 27 | 28 | // validate OTP 29 | const valid = validateOTP(secret, totp); 30 | setIsValid(valid); 31 | }, []); 32 | 33 | return ( 34 | 35 | Secret Key: {secretKey} 36 | OTP: {otp} 37 | Is Valid: {`${isValid}`} 38 | 39 | ); 40 | } 41 | 42 | const styles = StyleSheet.create({ 43 | container: { 44 | flex: 1, 45 | alignItems: 'center', 46 | justifyContent: 'center', 47 | backgroundColor: 'white', 48 | }, 49 | box: { 50 | width: 60, 51 | height: 60, 52 | marginVertical: 20, 53 | }, 54 | }); 55 | -------------------------------------------------------------------------------- /ios/TotpUtils.h: -------------------------------------------------------------------------------- 1 | #ifdef __cplusplus 2 | #import "react-native-totp-utils.h" 3 | #endif 4 | 5 | #import 6 | 7 | @interface TotpUtils : NSObject 8 | 9 | @property (nonatomic, assign) BOOL setBridgeOnMainQueue; 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /ios/TotpUtils.mm: -------------------------------------------------------------------------------- 1 | #import "TotpUtils.h" 2 | 3 | #import 4 | #import 5 | #import 6 | 7 | @implementation TotpUtils 8 | 9 | @synthesize bridge = _bridge; 10 | @synthesize methodQueue = _methodQueue; 11 | 12 | RCT_EXPORT_MODULE() 13 | 14 | + (BOOL)requiresMainQueueSetup { 15 | 16 | return YES; 17 | } 18 | 19 | - (void)setBridge:(RCTBridge *)bridge { 20 | _bridge = bridge; 21 | _setBridgeOnMainQueue = RCTIsMainQueue(); 22 | } 23 | 24 | 25 | RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(install) 26 | { 27 | NSLog(@"Installing TotpUtils Bindings..."); 28 | RCTCxxBridge* cxxBridge = (RCTCxxBridge*) self.bridge; 29 | if (cxxBridge == nil) { 30 | return @false; 31 | } 32 | 33 | // Totp JSI Binding 34 | totputils::install(*(facebook::jsi::Runtime *)cxxBridge.runtime); 35 | 36 | NSLog(@"Installed TotpUtils Bindings!"); 37 | return @true; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /ios/TotpUtils.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 5E46D8CD2428F78900513E24 /* example.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E46D8CB2428F78900513E24 /* example.cpp */; }; 11 | 5E555C0D2413F4C50049A1A2 /* TotpUtils.mm in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* TotpUtils.mm */; }; 12 | /* End PBXBuildFile section */ 13 | 14 | /* Begin PBXCopyFilesBuildPhase section */ 15 | 58B511D91A9E6C8500147676 /* CopyFiles */ = { 16 | isa = PBXCopyFilesBuildPhase; 17 | buildActionMask = 2147483647; 18 | dstPath = "include/$(PRODUCT_NAME)"; 19 | dstSubfolderSpec = 16; 20 | files = ( 21 | ); 22 | runOnlyForDeploymentPostprocessing = 0; 23 | }; 24 | /* End PBXCopyFilesBuildPhase section */ 25 | 26 | /* Begin PBXFileReference section */ 27 | 134814201AA4EA6300B7C361 /* libTotpUtils.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libTotpUtils.a; sourceTree = BUILT_PRODUCTS_DIR; }; 28 | 5E46D8CB2428F78900513E24 /* example.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = example.cpp; path = ../cpp/example.cpp; sourceTree = ""; }; 29 | 5E46D8CC2428F78900513E24 /* example.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = example.h; path = ../cpp/example.h; sourceTree = ""; }; 30 | B3E7B5891CC2AC0600A0062D /* TotpUtils.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TotpUtils.mm; sourceTree = ""; }; 31 | /* End PBXFileReference section */ 32 | 33 | /* Begin PBXFrameworksBuildPhase section */ 34 | 58B511D81A9E6C8500147676 /* Frameworks */ = { 35 | isa = PBXFrameworksBuildPhase; 36 | buildActionMask = 2147483647; 37 | files = ( 38 | ); 39 | runOnlyForDeploymentPostprocessing = 0; 40 | }; 41 | /* End PBXFrameworksBuildPhase section */ 42 | 43 | /* Begin PBXGroup section */ 44 | 134814211AA4EA7D00B7C361 /* Products */ = { 45 | isa = PBXGroup; 46 | children = ( 47 | 134814201AA4EA6300B7C361 /* libTotpUtils.a */, 48 | ); 49 | name = Products; 50 | sourceTree = ""; 51 | }; 52 | 58B511D21A9E6C8500147676 = { 53 | isa = PBXGroup; 54 | children = ( 55 | 5E46D8CB2428F78900513E24 /* example.cpp */, 56 | 5E46D8CC2428F78900513E24 /* example.h */, 57 | B3E7B5891CC2AC0600A0062D /* TotpUtils.mm */, 58 | 134814211AA4EA7D00B7C361 /* Products */, 59 | ); 60 | sourceTree = ""; 61 | }; 62 | /* End PBXGroup section */ 63 | 64 | /* Begin PBXNativeTarget section */ 65 | 58B511DA1A9E6C8500147676 /* TotpUtils */ = { 66 | isa = PBXNativeTarget; 67 | buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "TotpUtils" */; 68 | buildPhases = ( 69 | 58B511D71A9E6C8500147676 /* Sources */, 70 | 58B511D81A9E6C8500147676 /* Frameworks */, 71 | 58B511D91A9E6C8500147676 /* CopyFiles */, 72 | ); 73 | buildRules = ( 74 | ); 75 | dependencies = ( 76 | ); 77 | name = TotpUtils; 78 | productName = RCTDataManager; 79 | productReference = 134814201AA4EA6300B7C361 /* libTotpUtils.a */; 80 | productType = "com.apple.product-type.library.static"; 81 | }; 82 | /* End PBXNativeTarget section */ 83 | 84 | /* Begin PBXProject section */ 85 | 58B511D31A9E6C8500147676 /* Project object */ = { 86 | isa = PBXProject; 87 | attributes = { 88 | LastUpgradeCheck = 0920; 89 | ORGANIZATIONNAME = Facebook; 90 | TargetAttributes = { 91 | 58B511DA1A9E6C8500147676 = { 92 | CreatedOnToolsVersion = 6.1.1; 93 | }; 94 | }; 95 | }; 96 | buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "TotpUtils" */; 97 | compatibilityVersion = "Xcode 3.2"; 98 | developmentRegion = English; 99 | hasScannedForEncodings = 0; 100 | knownRegions = ( 101 | English, 102 | en, 103 | ); 104 | mainGroup = 58B511D21A9E6C8500147676; 105 | productRefGroup = 58B511D21A9E6C8500147676; 106 | projectDirPath = ""; 107 | projectRoot = ""; 108 | targets = ( 109 | 58B511DA1A9E6C8500147676 /* TotpUtils */, 110 | ); 111 | }; 112 | /* End PBXProject section */ 113 | 114 | /* Begin PBXSourcesBuildPhase section */ 115 | 58B511D71A9E6C8500147676 /* Sources */ = { 116 | isa = PBXSourcesBuildPhase; 117 | buildActionMask = 2147483647; 118 | files = ( 119 | 5E46D8CD2428F78900513E24 /* example.cpp in Sources */, 120 | 5E555C0D2413F4C50049A1A2 /* TotpUtils.mm in Sources */, 121 | ); 122 | runOnlyForDeploymentPostprocessing = 0; 123 | }; 124 | /* End PBXSourcesBuildPhase section */ 125 | 126 | /* Begin XCBuildConfiguration section */ 127 | 58B511ED1A9E6C8500147676 /* Debug */ = { 128 | isa = XCBuildConfiguration; 129 | buildSettings = { 130 | ALWAYS_SEARCH_USER_PATHS = NO; 131 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 132 | CLANG_CXX_LIBRARY = "libc++"; 133 | CLANG_ENABLE_MODULES = YES; 134 | CLANG_ENABLE_OBJC_ARC = YES; 135 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 136 | CLANG_WARN_BOOL_CONVERSION = YES; 137 | CLANG_WARN_COMMA = YES; 138 | CLANG_WARN_CONSTANT_CONVERSION = YES; 139 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 140 | CLANG_WARN_EMPTY_BODY = YES; 141 | CLANG_WARN_ENUM_CONVERSION = YES; 142 | CLANG_WARN_INFINITE_RECURSION = YES; 143 | CLANG_WARN_INT_CONVERSION = YES; 144 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 145 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 146 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 147 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 148 | CLANG_WARN_STRICT_PROTOTYPES = YES; 149 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 150 | CLANG_WARN_UNREACHABLE_CODE = YES; 151 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 152 | COPY_PHASE_STRIP = NO; 153 | ENABLE_STRICT_OBJC_MSGSEND = YES; 154 | ENABLE_TESTABILITY = YES; 155 | "EXCLUDED_ARCHS[sdk=*]" = arm64; 156 | GCC_C_LANGUAGE_STANDARD = gnu99; 157 | GCC_DYNAMIC_NO_PIC = NO; 158 | GCC_NO_COMMON_BLOCKS = YES; 159 | GCC_OPTIMIZATION_LEVEL = 0; 160 | GCC_PREPROCESSOR_DEFINITIONS = ( 161 | "DEBUG=1", 162 | "$(inherited)", 163 | ); 164 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 165 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 166 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 167 | GCC_WARN_UNDECLARED_SELECTOR = YES; 168 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 169 | GCC_WARN_UNUSED_FUNCTION = YES; 170 | GCC_WARN_UNUSED_VARIABLE = YES; 171 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 172 | MTL_ENABLE_DEBUG_INFO = YES; 173 | ONLY_ACTIVE_ARCH = YES; 174 | SDKROOT = iphoneos; 175 | }; 176 | name = Debug; 177 | }; 178 | 58B511EE1A9E6C8500147676 /* Release */ = { 179 | isa = XCBuildConfiguration; 180 | buildSettings = { 181 | ALWAYS_SEARCH_USER_PATHS = NO; 182 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 183 | CLANG_CXX_LIBRARY = "libc++"; 184 | CLANG_ENABLE_MODULES = YES; 185 | CLANG_ENABLE_OBJC_ARC = YES; 186 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 187 | CLANG_WARN_BOOL_CONVERSION = YES; 188 | CLANG_WARN_COMMA = YES; 189 | CLANG_WARN_CONSTANT_CONVERSION = YES; 190 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 191 | CLANG_WARN_EMPTY_BODY = YES; 192 | CLANG_WARN_ENUM_CONVERSION = YES; 193 | CLANG_WARN_INFINITE_RECURSION = YES; 194 | CLANG_WARN_INT_CONVERSION = YES; 195 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 196 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 197 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 198 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 199 | CLANG_WARN_STRICT_PROTOTYPES = YES; 200 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 201 | CLANG_WARN_UNREACHABLE_CODE = YES; 202 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 203 | COPY_PHASE_STRIP = YES; 204 | ENABLE_NS_ASSERTIONS = NO; 205 | ENABLE_STRICT_OBJC_MSGSEND = YES; 206 | "EXCLUDED_ARCHS[sdk=*]" = arm64; 207 | GCC_C_LANGUAGE_STANDARD = gnu99; 208 | GCC_NO_COMMON_BLOCKS = YES; 209 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 210 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 211 | GCC_WARN_UNDECLARED_SELECTOR = YES; 212 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 213 | GCC_WARN_UNUSED_FUNCTION = YES; 214 | GCC_WARN_UNUSED_VARIABLE = YES; 215 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 216 | MTL_ENABLE_DEBUG_INFO = NO; 217 | SDKROOT = iphoneos; 218 | VALIDATE_PRODUCT = YES; 219 | }; 220 | name = Release; 221 | }; 222 | 58B511F01A9E6C8500147676 /* Debug */ = { 223 | isa = XCBuildConfiguration; 224 | buildSettings = { 225 | HEADER_SEARCH_PATHS = ( 226 | "$(inherited)", 227 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 228 | "$(SRCROOT)/../../../React/**", 229 | "$(SRCROOT)/../../react-native/React/**", 230 | ); 231 | LIBRARY_SEARCH_PATHS = "$(inherited)"; 232 | OTHER_LDFLAGS = "-ObjC"; 233 | PRODUCT_NAME = TotpUtils; 234 | SKIP_INSTALL = YES; 235 | }; 236 | name = Debug; 237 | }; 238 | 58B511F11A9E6C8500147676 /* Release */ = { 239 | isa = XCBuildConfiguration; 240 | buildSettings = { 241 | HEADER_SEARCH_PATHS = ( 242 | "$(inherited)", 243 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 244 | "$(SRCROOT)/../../../React/**", 245 | "$(SRCROOT)/../../react-native/React/**", 246 | ); 247 | LIBRARY_SEARCH_PATHS = "$(inherited)"; 248 | OTHER_LDFLAGS = "-ObjC"; 249 | PRODUCT_NAME = TotpUtils; 250 | SKIP_INSTALL = YES; 251 | }; 252 | name = Release; 253 | }; 254 | /* End XCBuildConfiguration section */ 255 | 256 | /* Begin XCConfigurationList section */ 257 | 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "TotpUtils" */ = { 258 | isa = XCConfigurationList; 259 | buildConfigurations = ( 260 | 58B511ED1A9E6C8500147676 /* Debug */, 261 | 58B511EE1A9E6C8500147676 /* Release */, 262 | ); 263 | defaultConfigurationIsVisible = 0; 264 | defaultConfigurationName = Release; 265 | }; 266 | 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "TotpUtils" */ = { 267 | isa = XCConfigurationList; 268 | buildConfigurations = ( 269 | 58B511F01A9E6C8500147676 /* Debug */, 270 | 58B511F11A9E6C8500147676 /* Release */, 271 | ); 272 | defaultConfigurationIsVisible = 0; 273 | defaultConfigurationName = Release; 274 | }; 275 | /* End XCConfigurationList section */ 276 | }; 277 | rootObject = 58B511D31A9E6C8500147676 /* Project object */; 278 | } 279 | -------------------------------------------------------------------------------- /lefthook.yml: -------------------------------------------------------------------------------- 1 | pre-commit: 2 | parallel: true 3 | commands: 4 | lint: 5 | files: git diff --name-only @{push} 6 | glob: "*.{js,ts,jsx,tsx}" 7 | run: npx eslint {files} 8 | types: 9 | files: git diff --name-only @{push} 10 | glob: "*.{js,ts, jsx, tsx}" 11 | run: npx tsc --noEmit 12 | commit-msg: 13 | parallel: true 14 | commands: 15 | commitlint: 16 | run: npx commitlint --edit 17 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-totp-utils", 3 | "version": "1.0.5", 4 | "description": "test", 5 | "main": "lib/commonjs/index", 6 | "module": "lib/module/index", 7 | "types": "lib/typescript/index.d.ts", 8 | "react-native": "src/index", 9 | "source": "src/index", 10 | "files": [ 11 | "src", 12 | "lib", 13 | "android", 14 | "ios", 15 | "cpp", 16 | "*.podspec", 17 | "!lib/typescript/example", 18 | "!ios/build", 19 | "!android/build", 20 | "!android/gradle", 21 | "!android/gradlew", 22 | "!android/gradlew.bat", 23 | "!android/local.properties", 24 | "!**/__tests__", 25 | "!**/__fixtures__", 26 | "!**/__mocks__", 27 | "!**/.*" 28 | ], 29 | "scripts": { 30 | "test": "jest", 31 | "typecheck": "tsc --noEmit", 32 | "lint": "eslint \"**/*.{js,ts,tsx}\"", 33 | "prepack": "bob build", 34 | "release": "release-it", 35 | "example": "yarn --cwd example", 36 | "bootstrap": "yarn example && yarn install && yarn example pods", 37 | "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build" 38 | }, 39 | "keywords": [ 40 | "react-native", 41 | "ios", 42 | "android", 43 | "totp", 44 | "totp-utils" 45 | ], 46 | "repository": "https://github.com/4cc3ssX/react-native-totp-utils", 47 | "author": "Ryam (https://github.com/4cc3ssX)", 48 | "license": "MIT", 49 | "bugs": { 50 | "url": "https://github.com/4cc3ssX/react-native-totp-utils/issues" 51 | }, 52 | "homepage": "https://github.com/4cc3ssX/react-native-totp-utils#readme", 53 | "publishConfig": { 54 | "registry": "https://registry.npmjs.org/" 55 | }, 56 | "devDependencies": { 57 | "@evilmartians/lefthook": "^1.2.2", 58 | "@commitlint/config-conventional": "^17.0.2", 59 | "@react-native-community/eslint-config": "^3.0.2", 60 | "@release-it/conventional-changelog": "^5.0.0", 61 | "@types/jest": "^28.1.2", 62 | "@types/react": "~17.0.21", 63 | "@types/react-native": "0.70.0", 64 | "commitlint": "^17.0.2", 65 | "del-cli": "^5.0.0", 66 | "eslint": "^8.4.1", 67 | "eslint-config-prettier": "^8.5.0", 68 | "eslint-plugin-prettier": "^4.0.0", 69 | "jest": "^28.1.1", 70 | "pod-install": "^0.1.0", 71 | "prettier": "^2.0.5", 72 | "react": "18.2.0", 73 | "react-native": "0.71.10", 74 | "react-native-builder-bob": "^0.20.4", 75 | "release-it": "^15.0.0", 76 | "typescript": "^4.5.2" 77 | }, 78 | "resolutions": { 79 | "@types/react": "17.0.21" 80 | }, 81 | "peerDependencies": { 82 | "react": "*", 83 | "react-native": "*" 84 | }, 85 | "engines": { 86 | "node": ">= 16.0.0" 87 | }, 88 | "packageManager": "^yarn@1.22.15", 89 | "jest": { 90 | "preset": "react-native", 91 | "modulePathIgnorePatterns": [ 92 | "/example/node_modules", 93 | "/lib/" 94 | ] 95 | }, 96 | "commitlint": { 97 | "extends": [ 98 | "@commitlint/config-conventional" 99 | ] 100 | }, 101 | "release-it": { 102 | "git": { 103 | "commitMessage": "chore: release ${version}", 104 | "tagName": "v${version}" 105 | }, 106 | "npm": { 107 | "publish": true 108 | }, 109 | "github": { 110 | "release": true 111 | }, 112 | "plugins": { 113 | "@release-it/conventional-changelog": { 114 | "preset": "angular" 115 | } 116 | } 117 | }, 118 | "eslintConfig": { 119 | "root": true, 120 | "extends": [ 121 | "@react-native-community", 122 | "prettier" 123 | ], 124 | "rules": { 125 | "prettier/prettier": [ 126 | "error", 127 | { 128 | "quoteProps": "consistent", 129 | "singleQuote": true, 130 | "tabWidth": 2, 131 | "trailingComma": "es5", 132 | "useTabs": false 133 | } 134 | ] 135 | } 136 | }, 137 | "eslintIgnore": [ 138 | "node_modules/", 139 | "lib/" 140 | ], 141 | "prettier": { 142 | "quoteProps": "consistent", 143 | "singleQuote": true, 144 | "tabWidth": 2, 145 | "trailingComma": "es5", 146 | "useTabs": false 147 | }, 148 | "react-native-builder-bob": { 149 | "source": "src", 150 | "output": "lib", 151 | "targets": [ 152 | "commonjs", 153 | "module", 154 | [ 155 | "typescript", 156 | { 157 | "project": "tsconfig.build.json" 158 | } 159 | ] 160 | ] 161 | }, 162 | "codegenConfig": { 163 | "name": "RNTotpUtilsSpec", 164 | "type": "modules", 165 | "jsSrcsDir": "src" 166 | } 167 | } 168 | -------------------------------------------------------------------------------- /react-native-totp-utils.podspec: -------------------------------------------------------------------------------- 1 | require "json" 2 | 3 | package = JSON.parse(File.read(File.join(__dir__, "package.json"))) 4 | folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32' 5 | 6 | Pod::Spec.new do |s| 7 | s.name = "react-native-totp-utils" 8 | s.version = package["version"] 9 | s.summary = package["description"] 10 | s.homepage = package["homepage"] 11 | s.license = package["license"] 12 | s.authors = package["author"] 13 | 14 | s.platforms = { :ios => "11.0" } 15 | s.source = { :git => "https://github.com/4cc3ssX/react-native-totp-utils.git", :tag => "#{s.version}" } 16 | 17 | s.source_files = "ios/**/*.{h,m,mm}", "cpp/**/*.{h,cpp}" 18 | 19 | s.dependency "React-Core" 20 | 21 | # Don't install the dependencies when we run `pod install` in the old architecture. 22 | if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then 23 | s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1" 24 | s.pod_target_xcconfig = { 25 | "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"", 26 | "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1", 27 | "CLANG_CXX_LANGUAGE_STANDARD" => "c++17" 28 | } 29 | s.dependency "React-Codegen" 30 | s.dependency "RCT-Folly" 31 | s.dependency "RCTRequired" 32 | s.dependency "RCTTypeSafety" 33 | s.dependency "ReactCommon/turbomodule/core" 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /scripts/bootstrap.js: -------------------------------------------------------------------------------- 1 | const os = require('os'); 2 | const path = require('path'); 3 | const child_process = require('child_process'); 4 | 5 | const root = path.resolve(__dirname, '..'); 6 | const args = process.argv.slice(2); 7 | const options = { 8 | cwd: process.cwd(), 9 | env: process.env, 10 | stdio: 'inherit', 11 | encoding: 'utf-8', 12 | }; 13 | 14 | if (os.type() === 'Windows_NT') { 15 | options.shell = true; 16 | } 17 | 18 | let result; 19 | 20 | if (process.cwd() !== root || args.length) { 21 | // We're not in the root of the project, or additional arguments were passed 22 | // In this case, forward the command to `yarn` 23 | result = child_process.spawnSync('yarn', args, options); 24 | } else { 25 | // If `yarn` is run without arguments, perform bootstrap 26 | result = child_process.spawnSync('yarn', ['bootstrap'], options); 27 | } 28 | 29 | process.exitCode = result.status; 30 | -------------------------------------------------------------------------------- /src/__tests__/index.test.tsx: -------------------------------------------------------------------------------- 1 | it.todo('write a test'); 2 | -------------------------------------------------------------------------------- /src/index.tsx: -------------------------------------------------------------------------------- 1 | import { NativeModules, Platform } from 'react-native'; 2 | import type { 3 | IGenerateOTPOptions, 4 | IGenerateSecretKeyOptions, 5 | IValidateOTPOptions, 6 | } from './types'; 7 | 8 | const LINKING_ERROR = 9 | `The package 'react-native-totp-utils' doesn't seem to be linked. Make sure: \n\n` + 10 | Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) + 11 | '- You rebuilt the app after installing the package\n' + 12 | '- You are not using Expo Go\n'; 13 | 14 | const TotpUtilsModule = NativeModules.TotpUtils; 15 | 16 | const TotpUtils = TotpUtilsModule 17 | ? TotpUtilsModule 18 | : new Proxy( 19 | {}, 20 | { 21 | get() { 22 | throw new Error(LINKING_ERROR); 23 | }, 24 | } 25 | ); 26 | 27 | TotpUtils.install(); 28 | 29 | const g = global as any; 30 | 31 | export enum Constants { 32 | DEFAULT_DIGITS = 6, 33 | DEFAULT_TIME_STEP = 30, 34 | DEFAULT_SECRET_KEY_LENGTH = 16, 35 | DEFAULT_WINDOW = 1, 36 | } 37 | 38 | export const defaultOptions = { 39 | digits: Constants.DEFAULT_DIGITS, 40 | timeStep: Constants.DEFAULT_TIME_STEP, 41 | window: Constants.DEFAULT_WINDOW, 42 | length: Constants.DEFAULT_SECRET_KEY_LENGTH, 43 | }; 44 | 45 | /** 46 | * Generates a secret key for TOTP. 47 | * @param {IGenerateSecretKeyOptions} options - The length of the secret key. 48 | * @returns {string} The generated secret key. 49 | */ 50 | export function generateSecretKey( 51 | options: IGenerateSecretKeyOptions = defaultOptions 52 | ): string { 53 | options = { 54 | ...defaultOptions, 55 | ...options, 56 | }; 57 | return g.totpUtilsGenerateSecretKey(options.length); 58 | } 59 | 60 | /** 61 | * Generates a TOTP (Time-Based One-Time Password) using the provided secret key. 62 | * @param {string} secretKey - The secret key used for TOTP generation. 63 | * @param {IGenerateOTPOptions} options - The number of digits in the generated OTP. 64 | * @returns {string} The generated TOTP. 65 | */ 66 | export function generateOTP( 67 | secretKey: string, 68 | options: IGenerateOTPOptions = defaultOptions 69 | ): string { 70 | // overwrite undefined options with default 71 | options = { 72 | ...defaultOptions, 73 | ...options, 74 | }; 75 | return g.totpUtilsGenerateOTP(secretKey, options.digits, options.timeStep); 76 | } 77 | 78 | /** 79 | * Validates a TOTP against the provided secret key and OTP. 80 | * @param {string} secretKey - The secret key used for TOTP validation. 81 | * @param {string} otp - The OTP to validate. 82 | * @param {IValidateOTPOptions} options - The number of digits in the OTP. 83 | * @returns {boolean} True if the OTP is valid, false otherwise. 84 | */ 85 | export function validateOTP( 86 | secretKey: string, 87 | otp: string, 88 | options: IValidateOTPOptions = {} 89 | ): boolean { 90 | // overwrite undefined options with default 91 | options = { 92 | ...defaultOptions, 93 | ...options, 94 | }; 95 | return g.totpUtilsValidateOTP( 96 | secretKey, 97 | otp, 98 | options.digits, 99 | options.timeStep, 100 | options.window 101 | ); 102 | } 103 | 104 | const RNTOTP = { 105 | generateSecretKey, 106 | generateOTP, 107 | validateOTP, 108 | }; 109 | 110 | export * from './utils'; 111 | export default RNTOTP; 112 | -------------------------------------------------------------------------------- /src/types/index.ts: -------------------------------------------------------------------------------- 1 | export interface IGenerateOTPOptions { 2 | /** 3 | * The time step in seconds. 4 | * @type {number} 5 | */ 6 | timeStep?: number; 7 | /** 8 | * The number of digits in the OTP. 9 | * @type {number} 10 | */ 11 | digits?: number; 12 | } 13 | 14 | export interface IGenerateSecretKeyOptions { 15 | /** 16 | * Generates a random secret key of the specified length. 17 | * @type {number} 18 | */ 19 | length?: number; 20 | } 21 | 22 | export interface IValidateOTPOptions extends IGenerateOTPOptions { 23 | /** 24 | * The window of time to allow for OTP validation, in steps. 25 | * @type {number} 26 | * @default 1 27 | */ 28 | window?: number; 29 | } 30 | -------------------------------------------------------------------------------- /src/utils/index.ts: -------------------------------------------------------------------------------- 1 | import { defaultOptions } from '../index'; 2 | import type { IGenerateOTPOptions, IGenerateSecretKeyOptions } from '../types'; 3 | 4 | /** 5 | * Checks if the given OTP (One-Time Password) has a valid format. 6 | * 7 | * @param {string} otp - The OTP to check. 8 | * @param {IGenerateOTPOptions} [options=defaultOptions] - The options for OTP generation (optional). 9 | * @returns {boolean} True if the OTP format is valid, false otherwise. 10 | */ 11 | export const isOTPValid = ( 12 | otp: string, 13 | options: IGenerateOTPOptions = defaultOptions 14 | ): boolean => { 15 | otp = otp.replace(/\D+/g, ''); 16 | return otp.length === options.digits; 17 | }; 18 | 19 | /** 20 | * Checks if the given secret key has a valid format. 21 | * 22 | * @param {string} secretKey - The secret key to check. 23 | * @param {IGenerateSecretKeyOptions} [options=defaultOptions] - The options for secret key generation (optional). 24 | * @returns {boolean} True if the secret key format is valid, false otherwise. 25 | */ 26 | export const isSecretKeyValid = ( 27 | secretKey: string, 28 | options: IGenerateSecretKeyOptions = defaultOptions 29 | ): boolean => { 30 | secretKey = secretKey.replace(/-/g, ''); 31 | return secretKey.length === options.length; 32 | }; 33 | 34 | /** 35 | * Formats the secret key for display by inserting hyphens in a specific pattern. 36 | * If the secret key is valid, it is formatted as follows: AAAA-BBBB-CCCC-DDDD. 37 | * If the secret key is invalid, it is returned as is. 38 | * 39 | * @param {string} secretKey - The secret key to format. 40 | * @returns {string} The formatted secret key. 41 | */ 42 | export const formatSecretKey = (secretKey: string): string => { 43 | const isValid = isSecretKeyValid(secretKey); 44 | if (isValid) { 45 | return secretKey.replace(/(.{4})(.{4})(.{4})(.{4})/, '$1-$2-$3-$4'); 46 | } 47 | return secretKey; 48 | }; 49 | 50 | /** 51 | * Formats an OTP (One-Time Password) with a specified pattern. 52 | * @param {string} otp - The OTP to format. 53 | * @returns {string} The formatted OTP. 54 | */ 55 | export const formatOTP = (otp: string): string => { 56 | const isValid = isOTPValid(otp); 57 | if (isValid) { 58 | return otp.replace(/(\d{3})(?=\d)/g, '$1 '); 59 | } 60 | return otp; 61 | }; 62 | 63 | /** 64 | * Parses the secret key by removing any hyphens from it. 65 | * If the secret key is valid, the hyphens are removed. 66 | * If the secret key is invalid, it is returned as is. 67 | * 68 | * @param {string} secretKey - The secret key to parse. 69 | * @returns {string} The parsed secret key. 70 | */ 71 | export const parseSecretKey = (secretKey: string): string => { 72 | const isValid = isSecretKeyValid(secretKey); 73 | if (isValid) { 74 | return secretKey.replace(/-/g, ''); 75 | } 76 | return secretKey; 77 | }; 78 | -------------------------------------------------------------------------------- /tsconfig.build.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "extends": "./tsconfig", 4 | "exclude": ["example"] 5 | } 6 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": "./", 4 | "paths": { 5 | "react-native-totp-utils": ["./src/index"] 6 | }, 7 | "allowUnreachableCode": false, 8 | "allowUnusedLabels": false, 9 | "esModuleInterop": true, 10 | "importsNotUsedAsValues": "error", 11 | "forceConsistentCasingInFileNames": true, 12 | "jsx": "react", 13 | "lib": ["esnext"], 14 | "module": "esnext", 15 | "moduleResolution": "node", 16 | "noFallthroughCasesInSwitch": true, 17 | "noImplicitReturns": true, 18 | "noImplicitUseStrict": false, 19 | "noStrictGenericChecks": false, 20 | "noUncheckedIndexedAccess": true, 21 | "noUnusedLocals": true, 22 | "noUnusedParameters": true, 23 | "resolveJsonModule": true, 24 | "skipLibCheck": true, 25 | "strict": true, 26 | "target": "esnext" 27 | } 28 | } 29 | --------------------------------------------------------------------------------