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

What's done for Zuzalu Passport #24

Draft
wants to merge 72 commits into
base: legacy-with-old-rln-and-zk-keeper
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
d3a2c91
semaphore(feat): add files and functions
NicoSerranoP Apr 13, 2023
4774644
semaphore(feat): change interep object by semaphore
NicoSerranoP Apr 19, 2023
42a1ef4
init
mhchia Apr 19, 2023
d74424c
make app work
mhchia Apr 19, 2023
5dec865
zk-chat-client uses latest rlnjs
mhchia Apr 19, 2023
e8b53fc
use test-zk-chat-client for easier bundling
mhchia Apr 19, 2023
0e760db
make server work with rlnjs
mhchia Apr 19, 2023
3989dc8
use zk-chat-client 0.1.5
mhchia Apr 19, 2023
8da01a2
change register to simply get identity from zuzalu passport
mhchia Apr 20, 2023
9d58e5b
fix: make proof correctly parsed by server
mhchia Apr 20, 2023
2362404
temp
mhchia Apr 20, 2023
b586ecf
fix: wrong zero values and wrong vkey
mhchia Apr 20, 2023
1403e6f
try interrep module w/ zuzalu
mhchia Apr 21, 2023
0a168a3
Change several to test slashing and get correct root
mhchia Apr 21, 2023
3d86cee
code(fix): remove unused code
NicoSerranoP Apr 23, 2023
fcc665f
fix: spam threshold should be 1
mhchia Apr 25, 2023
b685c14
use self deployed pcd for now
mhchia Apr 25, 2023
20c0fa5
server(fix): use semaphore syncer
NicoSerranoP Apr 25, 2023
91cba8c
app(fix): add key to message items
NicoSerranoP Apr 25, 2023
0c6da9f
server(fix): prevent execution in users for loop
NicoSerranoP Apr 26, 2023
d63211d
test: fix the failure because epoch calculation has been changed
mhchia Apr 26, 2023
6a9a8e0
Merge pull request #8 from mhchia/feat/replace-rln-with-pcd
mhchia Apr 26, 2023
9bdf2eb
app(fix): prevent findNode error in reactstrap
NicoSerranoP Apr 26, 2023
04a3022
app(feat): use passport server as env
NicoSerranoP Apr 26, 2023
c5daef3
app(fix): remove recover btn and change register to login
NicoSerranoP Apr 27, 2023
222bf3f
fix: tests failed since we changed how to calculate epoch
mhchia Apr 27, 2023
87dfb30
recover interrep, put semaphore into semaphore
mhchia Apr 27, 2023
74075a7
Merge pull request #10 from Rate-Limiting-Nullifier/fix/tests-broken-…
mhchia Apr 27, 2023
b57e685
recover ports
mhchia Apr 27, 2023
045adc3
Merge pull request #11 from Rate-Limiting-Nullifier/build/recover-ports
mhchia Apr 27, 2023
d19652c
app(fix): delete console logs
NicoSerranoP Apr 27, 2023
ceccc92
server(fix): user sync correctly with semaphore
NicoSerranoP Apr 27, 2023
7f3d626
Merge branch 'main' into nico-zuzalu-semaphore
NicoSerranoP Apr 27, 2023
8f3f451
fix: json-bigint is not present in package.json
mhchia Apr 28, 2023
1d98b3a
Merge pull request #13 from Rate-Limiting-Nullifier/fix/server-json-b…
mhchia Apr 28, 2023
123e8f7
Merge branch 'main' into nico-zuzalu-semaphore
NicoSerranoP Apr 28, 2023
41049ae
Apply suggestions from code review
NicoSerranoP Apr 28, 2023
895295d
change url to zuzalu passport
mhchia Apr 29, 2023
b729201
print errors when `init` fails
mhchia Apr 29, 2023
4d1f51c
Merge pull request #14 from Rate-Limiting-Nullifier/build/test-with-z…
mhchia Apr 29, 2023
cd96cda
update docker things
mhchia Apr 30, 2023
61af221
try traefik
mhchia Apr 30, 2023
3d51c2f
add missing packages for server
mhchia Apr 30, 2023
c55415d
t
mhchia Apr 30, 2023
247bb5d
try change server env
mhchia Apr 30, 2023
425505f
Merge pull request #15 from Rate-Limiting-Nullifier/test-deployment
mhchia Apr 30, 2023
6b5f8a9
build(traefik): slight modification for paths and urls
mhchia May 1, 2023
9e5b40b
Change seconds per epoch to 10
mhchia May 1, 2023
ed13771
Merge pull request #16 from Rate-Limiting-Nullifier/test-zk-chat-on-k…
mhchia May 1, 2023
a42816f
fix tests since seconds per epoch changed
mhchia May 1, 2023
f958478
fix: try new server config
mhchia May 1, 2023
569c172
Merge pull request #17 from Rate-Limiting-Nullifier/fix/dev-server-co…
mhchia May 1, 2023
809fef7
use forked zuzalu passport
mhchia May 3, 2023
6ed0af9
update test zupass hostname
mhchia May 3, 2023
d1a44ad
missing env
mhchia May 3, 2023
0088ef0
remove `www` to avoid two local storages
mhchia May 3, 2023
a3b7a68
update ports
mhchia May 4, 2023
2c881f9
Close old popup window
mhchia May 5, 2023
cb528a8
fix: don't register callback twice
mhchia May 8, 2023
d167714
fix: shows only 1 message in chatroom even we click the send button t…
mhchia May 10, 2023
84e432a
fix: don't use beforeunload
mhchia May 10, 2023
8fc352e
use latest zk-chat-client-lib
mhchia May 11, 2023
d2a59b7
default public room
mhchia May 11, 2023
4028e68
fix: `hash` is not imported. use the hardcoded one
mhchia May 13, 2023
e62726a
Merge branch 'nico-zuzalu-semaphore' into test/use-forked-zuzalu-pass…
mhchia May 13, 2023
e51eabf
docs: add fixme to seconds per epoch
mhchia May 13, 2023
f2bd637
Merge pull request #12 from Rate-Limiting-Nullifier/nico-zuzalu-semap…
mhchia May 13, 2023
da001a2
fix: use real zupass in main
mhchia May 13, 2023
c075ba2
change env from dev.zkchat.org to zkchat.org
mhchia May 17, 2023
7e72bc1
Support deploy for dev environment
ntampakas May 24, 2023
51cf8f3
Merge pull request #22 from ntampakas/main
mhchia May 24, 2023
cd51844
use pcd passport url in server/.env.example
mhchia Jun 13, 2023
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
6 changes: 4 additions & 2 deletions .github/scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#!/bin/bash
set -x


environment=$1

COMMIT_HASH=$(git rev-parse HEAD)
DEPLOY_ID=$(aws deploy create-deployment --application-name zkchat --deployment-group-name zkchat-group --github-location repository=$GITHUB_REPOSITORY,commitId=$COMMIT_HASH --ignore-application-stop-failures --file-exists OVERWRITE --output text)
DEPLOY_ID=$(aws deploy create-deployment --application-name zkchat-$environment --deployment-group-name zkchat-$environment-group --github-location repository=$GITHUB_REPOSITORY,commitId=$COMMIT_HASH --ignore-application-stop-failures --file-exists OVERWRITE --output text)

while true; do
STATUS=$(aws deploy get-deployment --deployment-id $DEPLOY_ID --query 'deploymentInfo.status' --output text)
Expand Down
20 changes: 19 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ on:
options:
- enable
- disable
environment:
description: "Environment"
required: true
default: "enable"
type: choice
options:
- prod
- dev

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -22,6 +30,7 @@ jobs:
runs-on: ubuntu-latest
env:
DATA: ${{ github.event.inputs.build }}
DATA_ENV: ${{ github.event.inputs.environment }}
permissions:
id-token: write
contents: read
Expand All @@ -32,6 +41,15 @@ jobs:
with:
persist-credentials: false

- name: Check branch and environment
run: |
if [ "${{ env.DATA_ENV }}" = "prod" ]; then
if [ "$GITHUB_BASE_REF" != "main" ]; then
echo "Operation not permitted"
exit 1
fi
fi

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
Expand All @@ -45,4 +63,4 @@ jobs:

- name: Create Deployment
run: |
.github/scripts/deploy.sh
.github/scripts/deploy.sh ${{ env.DATA_ENV }}
8 changes: 4 additions & 4 deletions app/.env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
SKIP_PREFLIGHT_CHECK=true
PORT=3000
REACT_APP_SERVER_HOST=http://localhost:8080
REACT_APP_SOCKET_HOST=ws://localhost:8081
REACT_APP_ENV=http://localhost:3000
PORT=5566
REACT_APP_SERVER_HOST=https://zkchat.mhchia.com:8080
REACT_APP_SOCKET_HOST=wss://zkchat.mhchia.com:8081
REACT_APP_ENV=https://zkchat.mhchia.com:5566
Binary file added app/circuitFiles/rln/rln.wasm
Binary file not shown.
Binary file added app/circuitFiles/rln/rln_final.zkey
Binary file not shown.
114 changes: 114 additions & 0 deletions app/circuitFiles/rln/verification_key.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
{
"protocol": "groth16",
"curve": "bn128",
"nPublic": 5,
"vk_alpha_1": [
"20491192805390485299153009773594534940189261866228447918068658471970481763042",
"9383485363053290200918347156157836566562967994039712273449902621266178545958",
"1"
],
"vk_beta_2": [
[
"6375614351688725206403948262868962793625744043794305715222011528459656738731",
"4252822878758300859123897981450591353533073413197771768651442665752259397132"
],
[
"10505242626370262277552901082094356697409835680220590971873171140371331206856",
"21847035105528745403288232691147584728191162732299865338377159692350059136679"
],
[
"1",
"0"
]
],
"vk_gamma_2": [
[
"10857046999023057135944570762232829481370756359578518086990519993285655852781",
"11559732032986387107991004021392285783925812861821192530917403151452391805634"
],
[
"8495653923123431417604973247489272438418190587263600148770280649306958101930",
"4082367875863433681332203403145435568316851327593401208105741076214120093531"
],
[
"1",
"0"
]
],
"vk_delta_2": [
[
"8804911247767743718582746182478817918330124079736727004921853200288163523142",
"6653518272868907124249134260279067650948116751796597374984090931574452724344"
],
[
"4289260481290368283859566071595686774015143711765997065849324601720881606188",
"18881861710269294750472671400972421342425334984858038435471651022146723199983"
],
[
"1",
"0"
]
],
"vk_alphabeta_12": [
[
[
"2029413683389138792403550203267699914886160938906632433982220835551125967885",
"21072700047562757817161031222997517981543347628379360635925549008442030252106"
],
[
"5940354580057074848093997050200682056184807770593307860589430076672439820312",
"12156638873931618554171829126792193045421052652279363021382169897324752428276"
],
[
"7898200236362823042373859371574133993780991612861777490112507062703164551277",
"7074218545237549455313236346927434013100842096812539264420499035217050630853"
]
],
[
[
"7077479683546002997211712695946002074877511277312570035766170199895071832130",
"10093483419865920389913245021038182291233451549023025229112148274109565435465"
],
[
"4595479056700221319381530156280926371456704509942304414423590385166031118820",
"19831328484489333784475432780421641293929726139240675179672856274388269393268"
],
[
"11934129596455521040620786944827826205713621633706285934057045369193958244500",
"8037395052364110730298837004334506829870972346962140206007064471173334027475"
]
]
],
"IC": [
[
"21245767436323310498849811602404578935106041268557716518170092969683557427022",
"1213884936807149462109807656412200533191299163229146611054071808178183458413",
"1"
],
[
"18918285612126485260632299226369290849398931955460583791434273697096747446843",
"4249003838522302297001105594846547434289852327219703307894847167138232160092",
"1"
],
[
"21131658339185658088093556861306418236805038262556197407580399419902487697625",
"5386386468756985708669825529724308439093753222660934460701014058899174604413",
"1"
],
[
"18069268769796561519681091164429972843385730470565406637067874672398809598927",
"616648665079672138683902077923207794820803708902120406822937751718367418986",
"1"
],
[
"10958383820320663513827315124914669815120228317480235889587788076650559040047",
"20130063098730806362220354043618677403032047167996551848609475247065044064058",
"1"
],
[
"1308064321846506082463084434058009031577104372690966188531318892539766962085",
"8205255831339720983923535788260434278529437037844159146692971472590880706967",
"1"
]
]
}
10 changes: 8 additions & 2 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
"@fortawesome/fontawesome-svg-core": "^1.2.36",
"@fortawesome/free-solid-svg-icons": "^5.15.4",
"@fortawesome/react-fontawesome": "^0.1.16",
"@pcd/pcd-types": "0.4.0",
"@semaphore-protocol/group": "^3.2.3",
"@semaphore-protocol/identity": "^3.2.3",
"@types/file-saver": "^2.0.4",
"@types/history": "^4.7.9",
"@types/redux-pack": "^0.1.6",
Expand All @@ -23,20 +26,23 @@
"react-scripts": "4.0.3",
"react-toastify": "^8.2.0",
"react-tooltip": "^4.2.21",
"reactstrap": "^9.0.1",
"reactstrap": "^9.1.9",
"redux": "^4.1.2",
"redux-devtools-extension": "^2.13.9",
"redux-pack": "^0.1.5",
"redux-thunk": "^2.4.0",
"zk-chat-client": "1.0.4",
"rlnjs": "2.0.8",
"sass": "^1.43.4",
"styled-components": "^5.3.3",
"test-pcd-semaphore-group-pcd": "^0.7.2",
"test-zk-chat-client": "1.0.34",
"typescript": "^4.1.2",
"web-vitals": "^1.0.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"build-with-lib": "cd ../zk-chat-client-lib; LIB_VERSION=`npm version patch` && yarn && yarn build && npm publish && cd ../app && yarn upgrade test-zk-chat-client@$LIB_VERSION && yarn && yarn build",
"prettier": "prettier -c src",
"prettier:fix": "prettier -w src"
},
Expand Down
8 changes: 5 additions & 3 deletions app/src/components/AppWrapper/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react"
import PublicRoomInvitedScreen from "../PublicRoomInvitedScreen"
import RegisterOrRecover from "../RegisterOrRecover"
import Dashboard from "../Dashboard"
Expand All @@ -18,9 +17,9 @@ import { ToastContainer } from "react-toastify"

import 'react-toastify/dist/ReactToastify.css';
import { generateProof } from "../../util/util";
import "react-toastify/dist/ReactToastify.css"
import { init, receive_message, get_rooms, IRooms } from 'zk-chat-client';
import { init, receive_message, get_rooms, IRooms } from 'test-zk-chat-client';
import { useAppSelector } from "../../redux/hooks/useAppSelector"
import AuthPopup from "../Passport/popup"

const AppWrapper = () => {
const navigate = useNavigate()
Expand Down Expand Up @@ -53,7 +52,9 @@ const AppWrapper = () => {
})
)
})
console.log("!@# AppWrapper/index.tsx: after init")
} catch (error) {
console.log("!@# AppWrapper/index.tsx: error =", error)
navigate("/r-procedure")
}
}
Expand Down Expand Up @@ -86,6 +87,7 @@ const AppWrapper = () => {
<Routes>
<Route path="/r-procedure" element={<RegisterOrRecover />} />
<Route path="/dashboard" element={<Dashboard />} />
<Route path="/popup" element={<AuthPopup />} />
<Route
path="/public/:roomId"
element={<PublicRoomInvitedScreen />}
Expand Down
7 changes: 5 additions & 2 deletions app/src/components/ChatMessages/ChatMessagesWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,11 @@ const ChatMessagesWrapper = ({
) : (
<StyledMessagesWrapper ref={chatRef}>
{sortedHistory.length > 0 &&
sortedHistory.map((messageObj) => (
<StyledSingleMessage isUserSender={userHandle === messageObj.sender}>
sortedHistory.map((messageObj, index) => (
<StyledSingleMessage
key={ 'message-'+index }
isUserSender={userHandle === messageObj.sender}
>
<StyledMessageSender
isUserSender={userHandle === messageObj.sender}
>
Expand Down
2 changes: 1 addition & 1 deletion app/src/components/ChatMessages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { useAppSelector } from "../../redux/hooks/useAppSelector"
import Input from "../Input"
import ReactTooltip from "react-tooltip"
import ChatMessagesWrapper from "./ChatMessagesWrapper"
import { delete_messages_for_room } from "zk-chat-client"
import { delete_messages_for_room } from "test-zk-chat-client"

const StyledChatContainer = styled.div`
background: white;
Expand Down
2 changes: 1 addition & 1 deletion app/src/components/Input/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import styled from "styled-components"
import * as Colors from "../../constants/colors"
import { faPaperPlane } from "@fortawesome/free-solid-svg-icons"
import { Room } from "../../redux/actions/actionCreator"
import { send_message } from "zk-chat-client"
import { send_message } from "test-zk-chat-client"
import { toast } from "react-toastify"

const StyledInput = styled.input`
Expand Down
2 changes: 1 addition & 1 deletion app/src/components/Modals/exchangeKeysModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import ReactTooltip from "react-tooltip"
import {
generate_encrypted_invite_direct_room,
update_direct_room_key
} from "zk-chat-client"
} from "test-zk-chat-client"
import { useAppSelector } from "../../redux/hooks/useAppSelector"

const StyledButton = styled.button`
Expand Down
2 changes: 1 addition & 1 deletion app/src/components/Modals/generatePublicKey.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as Colors from "../../constants/colors"
import { faCopy } from "@fortawesome/free-solid-svg-icons"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
import ReactTooltip from "react-tooltip"
import { get_public_key } from "zk-chat-client"
import { get_public_key } from "test-zk-chat-client"

const StyledTextarea = styled.textarea`
border: 1px solid #f0f2f5;
Expand Down
4 changes: 2 additions & 2 deletions app/src/components/Modals/inviteModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as Colors from "../../constants/colors";
import { faCopy } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import ReactTooltip from "react-tooltip";
import { invite_private_room } from "zk-chat-client";
import { invite_private_room } from "test-zk-chat-client";
import { useAppSelector } from "../../redux/hooks/useAppSelector";
import { Room } from "../../redux/actions/actionCreator";
import TrustedContactsList from "./trustedContactsList";
Expand Down Expand Up @@ -84,7 +84,7 @@ const InviteModal = ({

return (
<Modal centered isOpen={toggleInviteModal}>
<ModalHeader
<ModalHeader
toggle={() => {
setToggleInviteModal(false);
setKeyValue("");
Expand Down
3 changes: 2 additions & 1 deletion app/src/components/Modals/recoverModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
receive_message,
recover_profile,
IRooms
} from "zk-chat-client";
} from "test-zk-chat-client";
import { serverUrl, socketUrl } from "../../constants/constants";
import { generateProof } from "../../util/util";
import {
Expand Down Expand Up @@ -93,6 +93,7 @@ const RecoverModal = ({
);
});
} catch (error) {
console.log("!@# Modals/recoverModal.tsx: error=", error);
navigate("/r-procedure");
}
};
Expand Down
2 changes: 1 addition & 1 deletion app/src/components/Modals/trustedContactsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
get_contact,
insert_contact,
update_contact
} from "zk-chat-client"
} from "test-zk-chat-client"
import { useAppDispatch } from "../../redux/hooks/useAppDispatch"
import { getTrustedContacts } from "../../redux/actions/actionCreator"
import { useAppSelector } from "../../redux/hooks/useAppSelector"
Expand Down
4 changes: 2 additions & 2 deletions app/src/components/Modals/updateUsernameModal.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useEffect, useState } from "react"
import { Modal, ModalBody, ModalHeader } from "reactstrap"
import { update_username, get_username } from "zk-chat-client"
import { update_username, get_username } from "test-zk-chat-client"
import styled from "styled-components"
import * as Colors from "../../constants/colors"
import { getUserHandle } from "../../redux/actions/actionCreator"
Expand Down Expand Up @@ -52,7 +52,7 @@ const UpdateUsernameModal = ({
const currentUsername = get_username()
setUsername(currentUsername)
}

}, [toggleUpdateUsername])

const handleUsernameUpdate = () => {
Expand Down
Loading