Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge dev into main #237

Merged
merged 24 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
5e8a8f9
add generateCountryOptions.ts
remicolin Oct 26, 2024
72a89fc
add countries.ts
remicolin Oct 26, 2024
4bc4c23
upgrade tamagui version to 1.110.0
remicolin Oct 26, 2024
1337c89
init: ecdsa r1 & k1 with sha256 check
0xVikasRushi Oct 28, 2024
bc5dd41
test: noir ecdsa_secp256r1_sha256
0xVikasRushi Oct 28, 2024
a4347a0
init: dg1 circuit with rsa inputs
0xVikasRushi Oct 30, 2024
12fee6d
Merge branch 'dev' of https://github.com/zk-passport/openpassport int…
remicolin Oct 30, 2024
df6539b
use tamagui sheet instead of select component
remicolin Oct 30, 2024
19414ca
remove countries.ts
remicolin Oct 30, 2024
428ef0b
Merge pull request #233 from zk-passport/frontend-optimization
remicolin Oct 30, 2024
2b8c1bf
fix typing issue
remicolin Oct 30, 2024
e39155c
add customeHasherTester
seshanthS Oct 30, 2024
414cc72
run linter
seshanthS Oct 30, 2024
537b895
refactor to commitment_tester
seshanthS Oct 30, 2024
5da994d
lint
seshanthS Oct 30, 2024
da8fb06
add brainpool circuits
seshanthS Oct 30, 2024
fb70252
update sdk imports
remicolin Oct 30, 2024
30608d2
display 'sha256 rsa' instead of 'sha256_rsa' in UI
remicolin Oct 30, 2024
a9bdc05
fix ProveScreen padding
remicolin Oct 30, 2024
2e4489e
fix padding on ValidProofScreen and WrongProofScreen
remicolin Oct 30, 2024
c58e609
Merge pull request #234 from zk-passport/feat/custom-hasher
remicolin Oct 30, 2024
40c3b25
Merge pull request #235 from zk-passport/feat/refactor-to-commitment
remicolin Oct 30, 2024
e514b08
Merge pull request #236 from zk-passport/feat/brainpool-circuits
remicolin Oct 30, 2024
8f76d3b
Merge pull request #238 from zk-passport/feat/noir
remicolin Oct 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
"@react-native-async-storage/async-storage": "^1.23.1",
"@react-native-community/cli": "^14.1.1",
"@react-native-community/netinfo": "^11.3.1",
"@tamagui/colors": "1.105.0",
"@tamagui/config": "1.105.0",
"@tamagui/core": "1.105.0",
"@tamagui/lucide-icons": "1.105.0",
"@tamagui/toast": "1.105.0",
"@tamagui/types": "1.105.0",
"@tamagui/colors": "1.110.0",
"@tamagui/config": "1.110.0",
"@tamagui/core": "1.110.0",
"@tamagui/lucide-icons": "1.110.0",
"@tamagui/toast": "1.110.0",
"@tamagui/types": "1.110.0",
"@types/msgpack-lite": "^0.1.11",
"@types/pako": "^2.0.3",
"@openpassport/zk-kit-imt": "^0.0.5",
Expand Down Expand Up @@ -52,7 +52,7 @@
"react-native-svg": "13.4.0",
"react-native-zip-archive": "^6.1.0",
"socket.io-client": "^4.7.5",
"tamagui": "1.105.0",
"tamagui": "1.110.0",
"zustand": "^4.5.2"
},
"devDependencies": {
Expand Down
104 changes: 101 additions & 3 deletions app/src/screens/MainScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState, useEffect } from 'react';
import { NativeEventEmitter, NativeModules, Linking, Modal, Platform, Pressable } from 'react-native';
import { NativeEventEmitter, NativeModules, Linking, Modal, Platform, Pressable, TouchableOpacity, ScrollView } from 'react-native';
import { YStack, XStack, Text, Button, Tabs, Sheet, Label, Fieldset, Input, Switch, H2, Image, useWindowDimensions, H4, H3, View, Separator } from 'tamagui'
import { HelpCircle, IterationCw, VenetianMask, Cog, CheckCircle2, ChevronLeft, Share, Eraser, ArrowRight, UserPlus, CalendarSearch, X, ShieldCheck } from '@tamagui/lucide-icons';
import Telegram from '../images/telegram.png'
Expand Down Expand Up @@ -36,6 +36,9 @@ import ValidProofScreen from './ValidProofScreen';
import WrongProofScreen from './WrongProofScreen';
import MockDataScreen from './MockDataScreen';
import OPENPASSPORT_LOGO from '../images/openpassport.png'
import { countryCodes } from '../../../common/src/constants/constants';
import getCountryISO2 from "country-iso-3-to-2";
import { flag } from 'country-emoji';

const emitter = (Platform.OS === 'android')
? new NativeEventEmitter(NativeModules.nativeModule)
Expand All @@ -57,6 +60,10 @@ const MainScreen: React.FC = () => {
const [dateOfBirthDatePickerIsOpen, setDateOfBirthDatePickerIsOpen] = useState(false)
const [dateOfExpiryDatePickerIsOpen, setDateOfExpiryDatePickerIsOpen] = useState(false)
const [isFormComplete, setIsFormComplete] = useState(false);
const [countrySheetOpen, setCountrySheetOpen] = useState(false);
const [algorithmSheetOpen, setAlgorithmSheetOpen] = useState(false);
const [selectedCountry, setSelectedCountry] = useState('USA');
const [selectedAlgorithm, setSelectedAlgorithm] = useState('rsa sha256');

const {
passportNumber,
Expand Down Expand Up @@ -179,7 +186,7 @@ const MainScreen: React.FC = () => {
setSelectedTab("start");
}
else if (selectedTab === "next") {
if (passportData.mockUser) {
if (passportData?.mockUser) {
setSelectedTab("mock");
} else {
setSelectedTab("nfc");
Expand All @@ -206,6 +213,16 @@ const MainScreen: React.FC = () => {

const { height } = useWindowDimensions();

const handleCountrySelect = (countryCode: string) => {
setSelectedCountry(countryCode);
setCountrySheetOpen(false);
};

const handleAlgorithmSelect = (algorithm: string) => {
setSelectedAlgorithm(algorithm);
setAlgorithmSheetOpen(false);
};

return (
<YStack f={1}>
<ToastViewport portalToRoot flexDirection="column-reverse" top={85} right={0} left={0} />
Expand Down Expand Up @@ -773,6 +790,82 @@ const MainScreen: React.FC = () => {
</Sheet.Frame>
</Sheet>

<Sheet
modal
open={countrySheetOpen}
onOpenChange={setCountrySheetOpen}
snapPoints={[60]}
animation="medium"
disableDrag
>
<Sheet.Overlay />
<Sheet.Frame bg={bgWhite} borderTopLeftRadius="$9" borderTopRightRadius="$9">
<YStack p="$4">
<XStack ai="center" jc="space-between" mb="$4">
<Text fontSize="$8">Select a country</Text>
<XStack onPress={() => setCountrySheetOpen(false)} p="$2">
<X color={borderColor} size="$1.5" mr="$2" />
</XStack>
</XStack>
<Separator borderColor={separatorColor} mb="$4" />
<ScrollView showsVerticalScrollIndicator={false}>
{Object.keys(countryCodes).map((countryCode) => (
<TouchableOpacity
key={countryCode}
onPress={() => {
handleCountrySelect(countryCode);
setCountrySheetOpen(false);
}}
>
<XStack py="$3" px="$2">
<Text fontSize="$4">
{countryCodes[countryCode as keyof typeof countryCodes]} {flag(getCountryISO2(countryCode))}
</Text>
</XStack>
</TouchableOpacity>
))}
</ScrollView>
</YStack>
</Sheet.Frame>
</Sheet>

<Sheet
modal
open={algorithmSheetOpen}
onOpenChange={setAlgorithmSheetOpen}
snapPoints={[40]}
animation="medium"
disableDrag
>
<Sheet.Overlay />
<Sheet.Frame bg={bgWhite} borderTopLeftRadius="$9" borderTopRightRadius="$9">
<YStack p="$4">
<XStack ai="center" jc="space-between" mb="$4">
<Text fontSize="$8">Select an algorithm</Text>
<XStack onPress={() => setAlgorithmSheetOpen(false)} p="$2">
<X color={borderColor} size="$1.5" mr="$2" />
</XStack>
</XStack>
<Separator borderColor={separatorColor} mb="$4" />
<ScrollView showsVerticalScrollIndicator={false}>
{["rsa sha256", "rsa sha1", "rsapss sha256"].map((algorithm) => (
<TouchableOpacity
key={algorithm}
onPress={() => {
handleAlgorithmSelect(algorithm);
setAlgorithmSheetOpen(false);
}}
>
<XStack py="$3" px="$2">
<Text fontSize="$4">{algorithm}</Text>
</XStack>
</TouchableOpacity>
))}
</ScrollView>
</YStack>
</Sheet.Frame>
</Sheet>

</YStack>

<Tabs f={1} orientation="horizontal" flexDirection="column" defaultValue={"splash"}
Expand All @@ -789,7 +882,12 @@ const MainScreen: React.FC = () => {
/>
</Tabs.Content>
<Tabs.Content value="mock" f={1}>
<MockDataScreen />
<MockDataScreen
onCountryPress={() => setCountrySheetOpen(true)}
onAlgorithmPress={() => setAlgorithmSheetOpen(true)}
selectedCountry={selectedCountry}
selectedAlgorithm={selectedAlgorithm}
/>
</Tabs.Content>
<Tabs.Content value="scan" f={1}>
<CameraScreen
Expand Down
Loading
Loading