Optic is an app that helps you securely generate OTP tokens for 2FA protected npm accounts. It allows auto-publish npm packages using CI.
The Optic documentation is available on the website
To get started, visit the Getting Started page for a brief overview.
- Node LTS
- Yarn
- The latest development build app installed via TestFlight (instructions update needed) if you are using an iPhone. If you are using an android phone or emulator, or an iPhone simulator, a build should be created and installed automatically.
A development build is essentially a modified version of the expo go app, with custom native code added in - the standard method of using Expo nowadays.
Ensure an Android emulator is set up on your machine, or connect a real android device and enable USB debugging
yarn
yarn android
This should build a new expo development build and install it automatically on your device, as well as start the Expo server. Changes to the typescript in the codebase should now be automatically reflected on your device.
In order to successfully create EAS builds or edit EAS config, you will need the following:
- Expo user account. You can sign up here.
- Once you have an Expo account, your account needs to be added to the NearForm organization (ask @simoneb to do that for you).
- See EAS builds for the various commands to run. EAS is a cloud-based service, but the cli offers the choice to build locally too.
Creating builds is necessary if you want to generate standalone applications for ios or android for testing or publishing.
Outdated - written when the app was using Expo Go (and npm?!) rather than development builds (and yarn). Should be rewritten to support this.
- Create an issue in this repo asking for apple connect developer access for the app (see section: Providing Apple Developer Access)
- Install expo-cli globally:
npm i -g expo-cli
- Run in the simulator first:
npm run ios
- Install expo go on your device
- Connect the ios device to your mac and select trust computer when prompted.
- Confirm your device is in developer mode
- Setup code signing certificates in xcode for developement
- In Xcode select your device as deployment target and select the development certificate (you may need to connect the device to your account if it was not done before)
- Run:
expo run:ios --device
- Select your device from the list
- Running
yarn android
will help you throughout the process. - Follow the expo tutorial.
- Java Runtime will be necessary. OpenJDK version 11 worked. Homebrew
- Read the output of the installation and execute the suggested commands related to symlink and including in the PATH variable.
- Running
yarn ios
will help you throughout the following steps; - Create an Apple ID if you don't have one. If applicable, use your NearForm email.
- Download Xcode from the App Store.
- Open Xcode, navigate to "Preferences / Locations" and select the appropriate version in Command Line Tools.
- Login to Apple Developer using an account with "App Manager" role
- You might need to use the nearform root account to provide permission above 'developer'
- 'App Manager' role is needed if you want to give access to create new releases in play store
- Navigate to https://appstoreconnect.apple.com/access/users
- Click on the "+" button on the top left corner and add the user info (most of the time will be developer or app manager) and choose what apps they have access to
This should already be all set up, but in case of Google Signin errors such as DEVELOPER_ERROR
, ensure OAuth 2.0 Client IDs are set up for each build method keystore's SHA-1
- Run
eas credentials
to obtain SHA-1 fingerprint for EAS build - Run
cd android && ./gradlew signingReport
to obtain local build SHA-1 fingerprints (if you have run a local build) - Ensure each SHA-1 has a matching OAuth Client ID in GCC
- The app doesn't run on the web, as it utilises native functionality. This could be potentially supported, but web-specific setup would need to be added to support things like push-notifications, camera qr-scanning and Google Signin
The figma designs can be found here.
The Android app is published to the Play Store once the release workflow is run.
For the iOS version, please follow this guide.