Skip to content

Commit

Permalink
Merge branch 'dev' into feat/dsc_ecdsa_test
Browse files Browse the repository at this point in the history
  • Loading branch information
seshanthS committed Jan 8, 2025
2 parents 6b98913 + 8eb248d commit 0be4293
Show file tree
Hide file tree
Showing 257 changed files with 395,602 additions and 11,459 deletions.
30 changes: 30 additions & 0 deletions .github/actions/yarn-install/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Yarn Install

description: Install Yarn v4 and run yarn install.

inputs:
working_directory:
description: The directory to install dependencies in.
required: false
default: "."

runs:
using: "composite"
steps:
- name: Install Yarn v4
shell: bash
run: |
corepack enable
corepack prepare [email protected] --activate
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'
cache-dependency-path: ${{ inputs.working_directory }}/yarn.lock

- name: Install dependencies
shell: bash
run: yarn install --immutable
working-directory: ${{ inputs.working_directory }}
4 changes: 4 additions & 0 deletions .github/workflows/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ on:
branches:
- dev
- main
- openpassportv2
paths:
- 'circuits/**'
- 'common/**'
pull_request:
branches:
- dev
- main
- openpassportv2
paths:
- 'circuits/**'
- 'common/**'
Expand Down Expand Up @@ -59,6 +61,8 @@ jobs:

- name: Run Tests (Circuits)
working-directory: ./circuits
env:
FULL_TEST_SUITE: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/openpassportv2' }}
run: yarn test

- name: Run Tests (Common)
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: App CI

on:
push:
paths:
- "app/**"
- ".github/workflows/app.yml"
- ".github/actions/**"

jobs:
lint:
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: Install Dependencies
uses: ./.github/actions/yarn-install
with:
working_directory: ./app
- name: Run linter
run: yarn lint
working-directory: ./app
- name: Run prettier
run: yarn fmt
working-directory: ./app

test:
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: Install Dependencies
uses: ./.github/actions/yarn-install
with:
working_directory: ./app
- name: Install app dependencies
run: yarn install-app
working-directory: ./app
- name: Test
run: yarn test
working-directory: ./app
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ sdk/.env
dist
**/node_modules
**/node_modules/
showcase
showcase
.codegpt
6 changes: 2 additions & 4 deletions app/.babelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"plugins": [
["module:react-native-dotenv"]
]
}
"plugins": [["module:react-native-dotenv"]]
}
11 changes: 11 additions & 0 deletions app/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
module.exports = {
root: true,
extends: '@react-native',
ignorePatterns: [
'ios/',
'android/',
'deployments/',
'witnesscalc/',
'node_modules/',
],
rules: {
'react-native/no-inline-styles': 'off',
'react-hooks/exhaustive-deps': 'off',
},
};
5 changes: 5 additions & 0 deletions app/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
android/
deployments/
ios/
node_modules/
witnesscalc/
2 changes: 0 additions & 2 deletions app/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
nodeLinker: node-modules

# yarnPath: .yarn/releases/yarn-4.5.0.cjs
22 changes: 13 additions & 9 deletions app/App.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
import React, { useEffect } from 'react';
import "react-native-get-random-values"
import "@ethersproject/shims"
import MainScreen from './src/screens/MainScreen';

import * as amplitude from '@amplitude/analytics-react-native';
import { AMPLITUDE_KEY } from '@env';
import '@ethersproject/shims';
import { Buffer } from 'buffer';
import { YStack } from 'tamagui';
import 'react-native-get-random-values';

import { useToastController } from '@tamagui/toast';
import { YStack } from 'tamagui';

import MainScreen from './src/screens/MainScreen';
import useNavigationStore from './src/stores/navigationStore';
import { AMPLITUDE_KEY } from '@env';
import * as amplitude from '@amplitude/analytics-react-native';
import useUserStore from './src/stores/userStore';
import { bgWhite } from './src/utils/colors';
import { setupUniversalLinkListener } from './src/utils/qrCode'; // Adjust the import path as needed

global.Buffer = Buffer;

function App(): React.JSX.Element {
const toast = useToastController();
const setToast = useNavigationStore((state) => state.setToast);
const initUserStore = useUserStore((state) => state.initUserStore);
const setSelectedTab = useNavigationStore((state) => state.setSelectedTab);
const setToast = useNavigationStore(state => state.setToast);
const initUserStore = useUserStore(state => state.initUserStore);
const setSelectedTab = useNavigationStore(state => state.setSelectedTab);

useEffect(() => {
initUserStore();
Expand Down
46 changes: 30 additions & 16 deletions app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,28 @@

## Requirements

| Requirement | Version | Installation Guide |
|-------------|---------|--------------------|
| nodejs | > v18 | [Install nodejs](https://nodejs.org/) |
| circom | Latest | [Install circom](https://docs.circom.io/) |
| snarkjs | Latest | [Install snarkjs](https://github.com/iden3/snarkjs) |

| Requirement | Version | Installation Guide |
| ----------- | ------- | -------------------------------------------------------- |
| nodejs | > v18 | [Install nodejs](https://nodejs.org/) |
| circom | Latest | [Install circom](https://docs.circom.io/) |
| snarkjs | Latest | [Install snarkjs](https://github.com/iden3/snarkjs) |
| watchman | Latest | [Install watchman](https://facebook.github.io/watchman/) |

### Android
| Requirement | Version | Installation Guide |
|-------------|---------|--------------------|
| Java | 17 | [Install Java](https://www.oracle.com/java/technologies/javase-jdk17-downloads.html)|
| Android Studio | Latest | [Install Android Studio](https://developer.android.com/studio) |
| Android SDK | Latest | [Install Android SDK](https://developer.android.com/studio#downloads) |
| Android Ndk | 23.1.7779620 | [Install NDK](https://developer.android.com/studio) or [GPT4 guide](https://chatgpt.com/share/a6e2544b-d32a-4554-a452-402511d03ffc) |

| Requirement | Version | Installation Guide |
| -------------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------- |
| Java | 17 | [Install Java](https://www.oracle.com/java/technologies/javase-jdk17-downloads.html) |
| Android Studio | Latest | [Install Android Studio](https://developer.android.com/studio) |
| Android SDK | Latest | [Install Android SDK](https://developer.android.com/studio#downloads) |
| Android Ndk | 23.1.7779620 | [Install NDK](https://developer.android.com/studio) or [GPT4 guide](https://chatgpt.com/share/a6e2544b-d32a-4554-a452-402511d03ffc) |

### iOS
| Requirement | Version | Installation Guide |
|-------------|---------|--------------------|
| Xcode | Latest | [Install Xcode](https://developer.apple.com/xcode/) |
| cocoapods | Latest | [Install cocoapods](https://cocoapods.org/) |

| Requirement | Version | Installation Guide |
| ----------- | ------- | --------------------------------------------------- |
| Xcode | Latest | [Install Xcode](https://developer.apple.com/xcode/) |
| cocoapods | Latest | [Install cocoapods](https://cocoapods.org/) |

## Installation

Expand All @@ -37,11 +38,13 @@ First, connect your phone to your computer and allow access.
### Android

Create the file `android/local.properties` with the following content:

```
sdk.dir=/Users/<your-user-name>/Library/Android/sdk
```

Launch the react-native server:

```
yarn start
```
Expand All @@ -60,6 +63,7 @@ To see the Android logs you'll have to use the Android Studio Logcat.
Open the ios project on Xcode and add your provisionning profile in Targets > OpenPassport > Signing and Capabilities

Then, install pods:

```
cd ios
pod install
Expand All @@ -81,6 +85,7 @@ Adapt the input generation in `common/src/utils/generateInputs.ts`, and adapt an

Find your android ndk path. It should be something like `/Users/<your-user-name>/Library/Android/sdk/ndk/23.1.7779620`
Build the android native module:

```
export ANDROID_NDK="<your-android-ndk-path>"
./scripts/build_android_module.sh
Expand All @@ -89,6 +94,7 @@ export ANDROID_NDK="<your-android-ndk-path>"
### iOS

Find your [development team id](https://chat.openai.com/share/9d52c37f-d9da-4a62-acb9-9e4ee8179f95) and run:

```
export DEVELOPMENT_TEAM="<your-development-team-id>"
./scripts/build_ios_module.sh
Expand All @@ -104,16 +110,21 @@ export DEVELOPMENT_TEAM="<your-development-team-id>"
cd android
./gradlew assembleRelease
```

The built apk it located at `android/app/build/outputs/apk/release/app-release.apk`

#### Publish on the Play Store

As explained [here](https://reactnative.dev/docs/signed-apk-android), first setup `android/app/my-upload-key.keystore` and the private vars in `~/.gradle/gradle.properties`, then run:

```
npx react-native build-android --mode=release
```

This builds `android/app/build/outputs/bundle/release/app-release.aab`.

Then to test the release on an android phone, delete the previous version of the app and run:

```
yarn android --mode release
```
Expand All @@ -129,10 +140,13 @@ Don't forget to bump the build number.
## FAQ

If you get something like this:

```
'std::__1::system_error: open: /openpassport/app: Operation not permitted'
```

You might want to try [this](https://stackoverflow.com/questions/49443341/watchman-crawl-failed-retrying-once-with-node-crawler):

```
watchman watch-del-all
watchman shutdown-server
Expand Down
4 changes: 2 additions & 2 deletions app/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ android {
applicationId "com.proofofpassportapp"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 15
versionName "1.4"
versionCode 16
versionName "1.5"
externalNativeBuild {
cmake {
cppFlags += "-fexceptions -frtti -std=c++11"
Expand Down
13 changes: 12 additions & 1 deletion app/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
module.exports = {
presets: ['module:@react-native/babel-preset'],
plugins: [
["@babel/plugin-transform-private-methods", { "loose": true }],
['@babel/plugin-transform-private-methods', { loose: true }],
[
'module:react-native-dotenv',
{
moduleName: '@env',
path: '.env',
blacklist: null,
whitelist: null,
safe: false,
allowUndefined: true,
},
],
],
};
10 changes: 5 additions & 5 deletions app/declarations.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
declare module '@env';
declare module '*.png' {
const value: string;
export = value;
const value: string;
export = value;
}
declare module '*.jpeg' {
const value: string;
export = value;
}
const value: string;
export = value;
}
17 changes: 10 additions & 7 deletions app/index.clip.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,30 @@
* @format
*/

import React from 'react';

import { config } from '@tamagui/config/v2-native';
import { ToastProvider } from '@tamagui/toast';
import { AppRegistry, LogBox } from 'react-native';
import { TamaguiProvider, createTamagui } from 'tamagui';

import App from './App';
import { name as appName } from './app.json';
import { TamaguiProvider, createTamagui } from 'tamagui';
import { config } from '@tamagui/config/v2-native'
import { ToastProvider } from '@tamagui/toast';
const tamaguiConfig = createTamagui(config)

const tamaguiConfig = createTamagui(config);

LogBox.ignoreLogs([
/bad setState/,
'Warning, duplicate ID for input',
/Warning, duplicate ID for input/
])
/Warning, duplicate ID for input/,
]);

const Root = () => (
<TamaguiProvider config={tamaguiConfig}>
<ToastProvider swipeDirection="up">
<App />
</ToastProvider>
</TamaguiProvider>

);

AppRegistry.registerComponent(appName, () => Root);
Loading

0 comments on commit 0be4293

Please sign in to comment.