Skip to content

Commit

Permalink
Merge pull request #296 from zk-passport/dev
Browse files Browse the repository at this point in the history
extends passport coverage
  • Loading branch information
remicolin authored Jan 9, 2025
2 parents 4ac739f + 7891336 commit 5dd4ae9
Show file tree
Hide file tree
Showing 255 changed files with 504,580 additions and 11,958 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 yarn@4.5.0 --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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ sdk/.env
dist
**/node_modules
**/node_modules/
showcase
showcase
.codegpt
**/.yarn/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Proof of Passport

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
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;
}
Loading

0 comments on commit 5dd4ae9

Please sign in to comment.