mirror of
https://github.com/semaphore-protocol/semaphore.git
synced 2026-01-11 07:38:14 -05:00
Compare commits
62 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a288ed7162 | ||
|
|
4f73284c06 | ||
|
|
bd7d3e352f | ||
|
|
0a181c1a9c | ||
|
|
37ad6e4aa7 | ||
|
|
2ec36d4097 | ||
|
|
88c3facbb7 | ||
|
|
2fc40bf710 | ||
|
|
78dcb705c5 | ||
|
|
3c75453e69 | ||
|
|
e48099b0f1 | ||
|
|
64e313a541 | ||
|
|
662c3b5af4 | ||
|
|
f0ffd47fae | ||
|
|
c636317c2e | ||
|
|
41a2f2f7cb | ||
|
|
c591cc48e9 | ||
|
|
b2a33eaf58 | ||
|
|
8b419a024b | ||
|
|
1e53e6fc49 | ||
|
|
f9dd755b63 | ||
|
|
78edf03771 | ||
|
|
70b9bb0ddc | ||
|
|
a6bb9bba73 | ||
|
|
8cc9d7feae | ||
|
|
f72d228e51 | ||
|
|
e6d30cdb7a | ||
|
|
841ed4bbd9 | ||
|
|
437ade277a | ||
|
|
fb66869a3c | ||
|
|
8afa2252e2 | ||
|
|
7af714bb98 | ||
|
|
c434f8af5b | ||
|
|
9fec16129b | ||
|
|
482b64d031 | ||
|
|
7163e6f460 | ||
|
|
5d2e1ca5a3 | ||
|
|
031229939a | ||
|
|
9d24c8184a | ||
|
|
ae359322e9 | ||
|
|
33998d90f7 | ||
|
|
d9de7c1033 | ||
|
|
120f99b416 | ||
|
|
b95cb17135 | ||
|
|
507c252d36 | ||
|
|
82db6a1eb7 | ||
|
|
c60ab38882 | ||
|
|
cba5940f36 | ||
|
|
110e3de844 | ||
|
|
f60e85335d | ||
|
|
ef4cef65cd | ||
|
|
f69534683d | ||
|
|
4d849b48c2 | ||
|
|
531e16e0d7 | ||
|
|
f2575f2bec | ||
|
|
3bfc7ce2bc | ||
|
|
ef88c9c84c | ||
|
|
6580b6620f | ||
|
|
42d33e2af7 | ||
|
|
594c612318 | ||
|
|
fbfa92023d | ||
|
|
caed0aecc1 |
2
.github/workflows/docs.yml
vendored
2
.github/workflows/docs.yml
vendored
@@ -40,7 +40,5 @@ jobs:
|
||||
uses: crazy-max/ghaction-github-pages@v2.5.0
|
||||
with:
|
||||
build_dir: docs
|
||||
jekyll: false
|
||||
fqdn: js.semaphore.appliedzkp.org
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -63,9 +63,7 @@ node_modules/
|
||||
# Production
|
||||
build
|
||||
dist
|
||||
docs/*
|
||||
!docs/CNAME
|
||||
!docs/index.html
|
||||
docs
|
||||
|
||||
# Hardhat
|
||||
artifacts
|
||||
|
||||
55
README.md
55
README.md
@@ -3,7 +3,7 @@
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/semaphore-protocol/website/blob/main/static/img/semaphore-icon-dark.svg">
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://github.com/semaphore-protocol/website/blob/main/static/img/semaphore-icon.svg">
|
||||
<img width="40" alt="Semaphore icon." src="https://github.com/semaphore-protocol/website/blob/main/static/img/semaphore-icon.svg">
|
||||
<img width="40" alt="Semaphore icon" src="https://github.com/semaphore-protocol/website/blob/main/static/img/semaphore-icon.svg">
|
||||
</picture>
|
||||
Semaphore
|
||||
</h1>
|
||||
@@ -52,7 +52,7 @@
|
||||
🔎 Issues
|
||||
</a>
|
||||
<span> | </span>
|
||||
<a href="https://semaphore.appliedzkp.org/discord">
|
||||
<a href="https://semaphore.pse.dev/discord">
|
||||
🗣️ Chat & Support
|
||||
</a>
|
||||
</h4>
|
||||
@@ -61,7 +61,7 @@
|
||||
| Semaphore is a protocol, designed to be a simple and generic privacy layer for Ethereum DApps. Using zero knowledge, Ethereum users can prove their membership of a group and send signals such as votes or endorsements without revealing their original identity. |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
|
||||
The core of the Semaphore protocol is in the [circuit logic](/packages/circuits/scheme.png). However Semaphore also provides [Solidity contracts](/packages/contracts) and JavaScript libraries to make the steps for offchain proof creation and onchain verification easier. To learn more about Semaphore visit [semaphore.appliedzkp.org](https://semaphore.appliedzkp.org).
|
||||
The core of the Semaphore protocol is in the [circuit logic](/packages/circuits/scheme.png). However Semaphore also provides [Solidity contracts](/packages/contracts) and JavaScript libraries to make the steps for offchain proof creation and onchain verification easier. To learn more about Semaphore visit [semaphore.pse.dev](https://semaphore.pse.dev).
|
||||
|
||||
## 📦 Packages
|
||||
|
||||
@@ -94,7 +94,7 @@ The core of the Semaphore protocol is in the [circuit logic](/packages/circuits/
|
||||
<a href="/packages/identity">
|
||||
@semaphore-protocol/identity
|
||||
</a>
|
||||
<a href="https://js.semaphore.appliedzkp.org/identity">
|
||||
<a href="https://js.semaphore.pse.dev/modules/_semaphore_protocol_identity">
|
||||
(docs)
|
||||
</a>
|
||||
</td>
|
||||
@@ -116,7 +116,7 @@ The core of the Semaphore protocol is in the [circuit logic](/packages/circuits/
|
||||
<a href="/packages/group">
|
||||
@semaphore-protocol/group
|
||||
</a>
|
||||
<a href="https://js.semaphore.appliedzkp.org/group">
|
||||
<a href="https://js.semaphore.pse.dev/modules/_semaphore_protocol_group">
|
||||
(docs)
|
||||
</a>
|
||||
</td>
|
||||
@@ -138,7 +138,7 @@ The core of the Semaphore protocol is in the [circuit logic](/packages/circuits/
|
||||
<a href="/packages/proof">
|
||||
@semaphore-protocol/proof
|
||||
</a>
|
||||
<a href="https://js.semaphore.appliedzkp.org/proof">
|
||||
<a href="https://js.semaphore.pse.dev/modules/_semaphore_protocol_proof">
|
||||
(docs)
|
||||
</a>
|
||||
</td>
|
||||
@@ -160,7 +160,7 @@ The core of the Semaphore protocol is in the [circuit logic](/packages/circuits/
|
||||
<a href="/packages/data">
|
||||
@semaphore-protocol/data
|
||||
</a>
|
||||
<a href="https://js.semaphore.appliedzkp.org/data">
|
||||
<a href="https://js.semaphore.pse.dev/modules/_semaphore_protocol_data">
|
||||
(docs)
|
||||
</a>
|
||||
</td>
|
||||
@@ -220,7 +220,7 @@ The core of the Semaphore protocol is in the [circuit logic](/packages/circuits/
|
||||
<a href="/packages/heyauthn">
|
||||
@semaphore-protocol/heyauthn
|
||||
</a>
|
||||
<a href="https://js.semaphore.appliedzkp.org/heyauthn">
|
||||
<a href="https://js.semaphore.pse.dev/modules/_semaphore_protocol_heyauthn">
|
||||
(docs)
|
||||
</a>
|
||||
</td>
|
||||
@@ -251,7 +251,25 @@ The following are some of the internal and external projects that use Semaphore.
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="https://explorer.semaphore.appliedzkp.org">
|
||||
<a href="https://bandada.pse.dev">
|
||||
Bandada
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
An open-source system for managing privacy-preserving groups of anonymous individuals. Create and manage onchain and offchain Semaphore groups using UI or API.
|
||||
</td>
|
||||
<td>
|
||||
<a href="https://github.com/privacy-scaling-explorations/bandada">
|
||||
Github
|
||||
</a>|
|
||||
<a href="https://discord.com/invite/sF5CT5rzrR">
|
||||
Discord
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="https://explorer.semaphore.pse.dev">
|
||||
Semaphore Explorer
|
||||
</a>
|
||||
</td>
|
||||
@@ -262,7 +280,7 @@ The following are some of the internal and external projects that use Semaphore.
|
||||
<a href="https://github.com/semaphore-protocol/explorer">
|
||||
Github
|
||||
</a>|
|
||||
<a href="https://semaphore.appliedzkp.org/discord">
|
||||
<a href="https://semaphore.pse.dev/discord">
|
||||
Discord
|
||||
</a>
|
||||
</td>
|
||||
@@ -280,7 +298,7 @@ The following are some of the internal and external projects that use Semaphore.
|
||||
<a href="https://github.com/semaphore-protocol/discord-bot">
|
||||
Github
|
||||
</a>|
|
||||
<a href="https://semaphore.appliedzkp.org/discord">
|
||||
<a href="https://semaphore.pse.dev/discord">
|
||||
Discord
|
||||
</a>
|
||||
</td>
|
||||
@@ -361,6 +379,21 @@ The following are some of the internal and external projects that use Semaphore.
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="https://stealthcomms.surge.sh/">
|
||||
StealthComms
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
A project that allows users to prove their membership in a group and send messages/signals without revealing their original identity.
|
||||
</td>
|
||||
<td>
|
||||
<a href="https://github.com/atomniketh/zk-app">
|
||||
Github
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tbody>
|
||||
</table>
|
||||
|
||||
|
||||
123
docs/index.html
123
docs/index.html
@@ -1,123 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html style="height: 100%">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="x-ua-compatible" content="IE=edge" />
|
||||
<title>Semaphore packages</title>
|
||||
<meta
|
||||
name="description"
|
||||
content="A monorepo of Semaphore packages."
|
||||
/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"
|
||||
/>
|
||||
</head>
|
||||
<body
|
||||
style="
|
||||
margin: 0;
|
||||
background-color: #EAF0F4;
|
||||
color: #000;
|
||||
height: 100%;
|
||||
font-family: 'Courier New', monospace;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
"
|
||||
>
|
||||
<div
|
||||
style="
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex: 1;
|
||||
padding: 0 20px;
|
||||
text-align: center;
|
||||
"
|
||||
>
|
||||
<div style="display: flex">
|
||||
<span style="margin-right: 5px">
|
||||
<img width="40" src="https://raw.githubusercontent.com/semaphore-protocol/website/main/static/img/semaphore-icon.svg">
|
||||
</span>
|
||||
<h1 style="margin: 0; font-size: 40px">Semaphore packages</h1>
|
||||
</div>
|
||||
<p style="max-width: 500px">
|
||||
A monorepo of Semaphore packages.
|
||||
</p>
|
||||
<ul style="list-style-type: none; padding: 0; margin: 0; margin-top: 10px"></ul>
|
||||
</div>
|
||||
<footer
|
||||
style="
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 15px 20px;
|
||||
background-color: #EAF0F4;
|
||||
"
|
||||
>
|
||||
<div
|
||||
style="
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
width: 900px;
|
||||
"
|
||||
>
|
||||
<p style="margin: 0; font-size: 16px">
|
||||
Copyright © 2022 Ethereum Foundation
|
||||
</p>
|
||||
<div>
|
||||
<a
|
||||
style="margin-right: 15px; text-decoration: none"
|
||||
target="_blank"
|
||||
href="https://github.com/semaphore-protocol/semaphore"
|
||||
>
|
||||
<i
|
||||
class="fa fa-github"
|
||||
style="font-size: 24px; color: #000"
|
||||
></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</body>
|
||||
<script>
|
||||
const url =
|
||||
"https://api.github.com/repos/semaphore-protocol/semaphore/contents?ref=gh-pages"
|
||||
|
||||
function insertLinks(packages) {
|
||||
const [element] = window.document.getElementsByTagName("ul")
|
||||
let html = ""
|
||||
|
||||
for (const package of packages) {
|
||||
html += `<li style="display: flex; align-items: center; margin-bottom: 8px">
|
||||
<a style="margin-right: 15px" target="_blank" href="https://github.com/semaphore-protocol/semaphore/tree/main/packages/${package}">
|
||||
<i class="fa fa-github" style="font-size: 24px; color: #000"></i>
|
||||
</a>
|
||||
<a style="color: #000; text-decoration: none; font-size: 16px"
|
||||
onmouseover="this.style.color='#404A4E';"
|
||||
onmouseout="this.style.color='#000';"
|
||||
target="_blank" href="https://semaphore-protocol.github.io/semaphore/${package}">
|
||||
@semaphore-protocol/${package} >
|
||||
</a></li>`
|
||||
}
|
||||
|
||||
element.innerHTML = html
|
||||
}
|
||||
|
||||
fetch(url)
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
const ignore = [".nojekyll", "index.html", "CNAME"]
|
||||
const packages = data
|
||||
.map((c) => c.name)
|
||||
.filter((name) => !ignore.includes(name))
|
||||
|
||||
localStorage.setItem("packages", JSON.stringify(packages))
|
||||
|
||||
insertLinks(packages)
|
||||
})
|
||||
</script>
|
||||
</html>
|
||||
@@ -17,7 +17,7 @@
|
||||
"lint": "eslint . --ext .js,.ts && yarn workspace contracts lint",
|
||||
"prettier": "prettier -c .",
|
||||
"prettier:write": "prettier -w .",
|
||||
"docs": "yarn workspaces foreach --no-private run docs",
|
||||
"docs": "typedoc --cname js.semaphore.pse.dev --githubPages true",
|
||||
"version:bump": "yarn workspaces foreach --no-private version -d ${0} && yarn version apply --all && git commit -am \"chore: v${0}\" && git tag v${0}",
|
||||
"version:publish": "yarn build:libraries && yarn remove:template-files && yarn workspaces foreach --no-private npm publish --tolerate-republish --access public",
|
||||
"version:release": "changelogithub",
|
||||
@@ -50,11 +50,13 @@
|
||||
"@commitlint/cli": "^16.0.2",
|
||||
"@commitlint/config-conventional": "^16.0.0",
|
||||
"@rollup/plugin-typescript": "^8.3.0",
|
||||
"@types/circomlibjs": "^0.1.4",
|
||||
"@types/download": "^8.0.1",
|
||||
"@types/glob": "^7.2.0",
|
||||
"@types/jest": "^27.4.0",
|
||||
"@types/node": "^17.0.9",
|
||||
"@types/rimraf": "^3.0.2",
|
||||
"@types/snarkjs": "^0.7.5",
|
||||
"@typescript-eslint/eslint-plugin": "^5.9.1",
|
||||
"@typescript-eslint/parser": "^5.9.1",
|
||||
"babel-jest": "^27.4.6",
|
||||
@@ -77,6 +79,7 @@
|
||||
"rollup": "^2.64.0",
|
||||
"ts-node": "^10.4.0",
|
||||
"tslib": "^2.3.1",
|
||||
"typedoc": "^0.25.1",
|
||||
"typescript": "^4.7.0"
|
||||
},
|
||||
"config": {
|
||||
|
||||
@@ -28,10 +28,10 @@
|
||||
🔎 Issues
|
||||
</a>
|
||||
<span> | </span>
|
||||
<a href="https://semaphore.appliedzkp.org/discord">
|
||||
<a href="https://semaphore.pse.dev/discord">
|
||||
🗣️ Chat & Support
|
||||
</a>
|
||||
</h4>
|
||||
</div>
|
||||
|
||||
To learn more about circuits visit [semaphore.appliedzkp.org](https://semaphore.appliedzkp.org/docs/technical-reference/circuits).
|
||||
To learn more about circuits visit [semaphore.pse.dev](https://semaphore.pse.dev/docs/technical-reference/circuits).
|
||||
|
||||
@@ -48,7 +48,7 @@ yarn deploy --semaphore <semaphore-address> --group <group-id> --network goerli
|
||||
```
|
||||
|
||||
> **Note**
|
||||
> Check the Semaphore contract addresses [here](https://semaphore.appliedzkp.org/docs/deployed-contracts#semaphore).
|
||||
> Check the Semaphore contract addresses [here](https://semaphore.pse.dev/docs/deployed-contracts#semaphore).
|
||||
|
||||
> **Warning**
|
||||
> The group id is a number!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/cli-template-contracts-hardhat",
|
||||
"version": "3.9.0",
|
||||
"version": "3.15.1",
|
||||
"description": "Semaphore Hardhat template.",
|
||||
"license": "Unlicense",
|
||||
"files": [
|
||||
@@ -36,10 +36,10 @@
|
||||
"@nomicfoundation/hardhat-toolbox": "^2.0.0",
|
||||
"@nomiclabs/hardhat-ethers": "^2.0.0",
|
||||
"@nomiclabs/hardhat-etherscan": "^3.0.0",
|
||||
"@semaphore-protocol/group": "3.9.0",
|
||||
"@semaphore-protocol/hardhat": "3.9.0",
|
||||
"@semaphore-protocol/identity": "3.9.0",
|
||||
"@semaphore-protocol/proof": "3.9.0",
|
||||
"@semaphore-protocol/group": "3.15.1",
|
||||
"@semaphore-protocol/hardhat": "3.15.1",
|
||||
"@semaphore-protocol/identity": "3.15.1",
|
||||
"@semaphore-protocol/proof": "3.15.1",
|
||||
"@typechain/ethers-v5": "^10.1.0",
|
||||
"@typechain/hardhat": "^6.1.2",
|
||||
"@types/chai": "^4.2.0",
|
||||
@@ -58,7 +58,7 @@
|
||||
"typescript": ">=4.5.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@semaphore-protocol/contracts": "3.9.0"
|
||||
"@semaphore-protocol/contracts": "3.15.1"
|
||||
},
|
||||
"config": {
|
||||
"solidity": {
|
||||
|
||||
@@ -33,7 +33,7 @@ yarn deploy --semaphore <semaphore-address> --group <group-id> --network arbitru
|
||||
3. Copy your contract artifacts from `apps/contracts/build/contracts/contracts` folder to `apps/web-app/contract-artifacts` folders manually. Or run `yarn copy:contract-artifacts` in the project root to do it automatically.
|
||||
|
||||
> **Note**
|
||||
> Check the Semaphore contract addresses [here](https://semaphore.appliedzkp.org/docs/deployed-contracts).
|
||||
> Check the Semaphore contract addresses [here](https://semaphore.pse.dev/docs/deployed-contracts).
|
||||
|
||||
> **Warning**
|
||||
> The group id is a number!
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
"@nomicfoundation/hardhat-chai-matchers": "^1.0.5",
|
||||
"@nomiclabs/hardhat-ethers": "^2.0.0",
|
||||
"@nomiclabs/hardhat-etherscan": "^3.1.7",
|
||||
"@semaphore-protocol/group": "3.9.0",
|
||||
"@semaphore-protocol/hardhat": "3.9.0",
|
||||
"@semaphore-protocol/identity": "3.9.0",
|
||||
"@semaphore-protocol/proof": "3.9.0",
|
||||
"@semaphore-protocol/group": "3.15.1",
|
||||
"@semaphore-protocol/hardhat": "3.15.1",
|
||||
"@semaphore-protocol/identity": "3.15.1",
|
||||
"@semaphore-protocol/proof": "3.15.1",
|
||||
"@typechain/ethers-v5": "^10.0.0",
|
||||
"@typechain/hardhat": "^6.0.0",
|
||||
"@types/chai": "^4.3.1",
|
||||
@@ -40,7 +40,7 @@
|
||||
"typechain": "^8.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@semaphore-protocol/contracts": "3.9.0"
|
||||
"@semaphore-protocol/contracts": "3.15.1"
|
||||
},
|
||||
"config": {
|
||||
"solidity": {
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@next/font": "13.0.3",
|
||||
"@semaphore-protocol/data": "3.9.0",
|
||||
"@semaphore-protocol/group": "3.9.0",
|
||||
"@semaphore-protocol/identity": "3.9.0",
|
||||
"@semaphore-protocol/proof": "3.9.0",
|
||||
"@semaphore-protocol/data": "3.15.1",
|
||||
"@semaphore-protocol/group": "3.15.1",
|
||||
"@semaphore-protocol/identity": "3.15.1",
|
||||
"@semaphore-protocol/proof": "3.15.1",
|
||||
"@types/react": "18.0.25",
|
||||
"@types/react-dom": "18.0.8",
|
||||
"dotenv": "^16.0.3",
|
||||
|
||||
@@ -84,7 +84,7 @@ export default function GroupsPage() {
|
||||
<p>
|
||||
Semaphore{" "}
|
||||
<a
|
||||
href="https://semaphore.appliedzkp.org/docs/guides/groups"
|
||||
href="https://semaphore.pse.dev/docs/guides/groups"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener nofollow"
|
||||
>
|
||||
|
||||
@@ -40,7 +40,7 @@ export default function IdentitiesPage() {
|
||||
<p>
|
||||
Users interact with the protocol using a Semaphore{" "}
|
||||
<a
|
||||
href="https://semaphore.appliedzkp.org/docs/guides/identities"
|
||||
href="https://semaphore.pse.dev/docs/guides/identities"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener nofollow"
|
||||
>
|
||||
|
||||
@@ -112,7 +112,7 @@ export default function ProofsPage() {
|
||||
<p>
|
||||
Semaphore members can anonymously{" "}
|
||||
<a
|
||||
href="https://semaphore.appliedzkp.org/docs/guides/proofs"
|
||||
href="https://semaphore.pse.dev/docs/guides/proofs"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener nofollow"
|
||||
>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/cli-template-monorepo-ethers",
|
||||
"version": "3.9.0",
|
||||
"version": "3.15.1",
|
||||
"description": "Semaphore Hardhat + Next.js + SemaphoreEthers template.",
|
||||
"license": "Unlicense",
|
||||
"files": [
|
||||
|
||||
@@ -33,7 +33,7 @@ yarn deploy --semaphore <semaphore-address> --group <group-id> --network arbitru
|
||||
3. Copy your contract artifacts from `apps/contracts/build/contracts/contracts` folder to `apps/web-app/contract-artifacts` folders manually. Or run `yarn copy:contract-artifacts` in the project root to do it automatically.
|
||||
|
||||
> **Note**
|
||||
> Check the Semaphore contract addresses [here](https://semaphore.appliedzkp.org/docs/deployed-contracts).
|
||||
> Check the Semaphore contract addresses [here](https://semaphore.pse.dev/docs/deployed-contracts).
|
||||
|
||||
> **Warning**
|
||||
> The group id is a number!
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
"@nomicfoundation/hardhat-chai-matchers": "^1.0.5",
|
||||
"@nomiclabs/hardhat-ethers": "^2.0.0",
|
||||
"@nomiclabs/hardhat-etherscan": "^3.1.7",
|
||||
"@semaphore-protocol/group": "3.9.0",
|
||||
"@semaphore-protocol/hardhat": "3.9.0",
|
||||
"@semaphore-protocol/identity": "3.9.0",
|
||||
"@semaphore-protocol/proof": "3.9.0",
|
||||
"@semaphore-protocol/group": "3.15.1",
|
||||
"@semaphore-protocol/hardhat": "3.15.1",
|
||||
"@semaphore-protocol/identity": "3.15.1",
|
||||
"@semaphore-protocol/proof": "3.15.1",
|
||||
"@typechain/ethers-v5": "^10.0.0",
|
||||
"@typechain/hardhat": "^6.0.0",
|
||||
"@types/chai": "^4.3.1",
|
||||
@@ -40,7 +40,7 @@
|
||||
"typechain": "^8.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@semaphore-protocol/contracts": "3.9.0"
|
||||
"@semaphore-protocol/contracts": "3.15.1"
|
||||
},
|
||||
"config": {
|
||||
"solidity": {
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@next/font": "13.0.3",
|
||||
"@semaphore-protocol/data": "3.9.0",
|
||||
"@semaphore-protocol/group": "3.9.0",
|
||||
"@semaphore-protocol/identity": "3.9.0",
|
||||
"@semaphore-protocol/proof": "3.9.0",
|
||||
"@semaphore-protocol/data": "3.15.1",
|
||||
"@semaphore-protocol/group": "3.15.1",
|
||||
"@semaphore-protocol/identity": "3.15.1",
|
||||
"@semaphore-protocol/proof": "3.15.1",
|
||||
"@types/react": "18.0.25",
|
||||
"@types/react-dom": "18.0.8",
|
||||
"dotenv": "^16.0.3",
|
||||
|
||||
@@ -84,7 +84,7 @@ export default function GroupsPage() {
|
||||
<p>
|
||||
Semaphore{" "}
|
||||
<a
|
||||
href="https://semaphore.appliedzkp.org/docs/guides/groups"
|
||||
href="https://semaphore.pse.dev/docs/guides/groups"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener nofollow"
|
||||
>
|
||||
|
||||
@@ -40,7 +40,7 @@ export default function IdentitiesPage() {
|
||||
<p>
|
||||
Users interact with the protocol using a Semaphore{" "}
|
||||
<a
|
||||
href="https://semaphore.appliedzkp.org/docs/guides/identities"
|
||||
href="https://semaphore.pse.dev/docs/guides/identities"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener nofollow"
|
||||
>
|
||||
|
||||
@@ -112,7 +112,7 @@ export default function ProofsPage() {
|
||||
<p>
|
||||
Semaphore members can anonymously{" "}
|
||||
<a
|
||||
href="https://semaphore.appliedzkp.org/docs/guides/proofs"
|
||||
href="https://semaphore.pse.dev/docs/guides/proofs"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener nofollow"
|
||||
>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/cli-template-monorepo-subgraph",
|
||||
"version": "3.9.0",
|
||||
"version": "3.15.1",
|
||||
"description": "Semaphore Hardhat + Next.js + SemaphoreSubgraph template.",
|
||||
"license": "Unlicense",
|
||||
"files": [
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
🔎 Issues
|
||||
</a>
|
||||
<span> | </span>
|
||||
<a href="https://semaphore.appliedzkp.org/discord">
|
||||
<a href="https://semaphore.pse.dev/discord">
|
||||
🗣️ Chat & Support
|
||||
</a>
|
||||
</h4>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/cli",
|
||||
"type": "module",
|
||||
"version": "3.9.0",
|
||||
"version": "3.15.1",
|
||||
"description": "A command line tool to set up your Semaphore project and get group data.",
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
@@ -39,11 +39,10 @@
|
||||
"@types/semver": "^7.3.13",
|
||||
"rollup-plugin-cleanup": "^3.2.1",
|
||||
"rollup-plugin-typescript2": "^0.31.2",
|
||||
"ts-node": "^10.9.1",
|
||||
"typedoc": "^0.22.11"
|
||||
"ts-node": "^10.9.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@semaphore-protocol/data": "3.9.0",
|
||||
"@semaphore-protocol/data": "3.15.1",
|
||||
"axios": "^1.3.2",
|
||||
"boxen": "^7.0.1",
|
||||
"chalk": "^5.1.2",
|
||||
|
||||
@@ -132,7 +132,10 @@ program
|
||||
|
||||
const groupIds = await getGroupIds(network)
|
||||
|
||||
if (groupIds === null) return
|
||||
if (groupIds === null) {
|
||||
console.info(`\n ${logSymbols.info}`, `info: there are no groups on the '${network}' network\n`)
|
||||
return
|
||||
}
|
||||
|
||||
const content = `${chalk.bold("Groups")} (${groupIds.length}): \n${groupIds
|
||||
.map((id: any) => ` - ${id}`)
|
||||
@@ -160,7 +163,10 @@ program
|
||||
if (!groupId) {
|
||||
const groupIds = await getGroupIds(network)
|
||||
|
||||
if (groupIds === null) return
|
||||
if (groupIds === null) {
|
||||
console.info(`\n ${logSymbols.info}`, `info: there are no groups on the '${network}' network\n`)
|
||||
return
|
||||
}
|
||||
|
||||
groupId = await getGroupId(groupIds)
|
||||
}
|
||||
@@ -193,6 +199,11 @@ program
|
||||
}
|
||||
}
|
||||
|
||||
if (!group) {
|
||||
console.info(`\n ${logSymbols.error}`, "error: the group does not exist\n")
|
||||
return
|
||||
}
|
||||
|
||||
let content = ` ${chalk.bold("Id")}: ${group.id}\n`
|
||||
content += ` ${chalk.bold("Admin")}: ${group.admin}\n`
|
||||
content += ` ${chalk.bold("Merkle tree")}:\n`
|
||||
@@ -223,7 +234,10 @@ program
|
||||
if (!groupId) {
|
||||
const groupIds = await getGroupIds(network)
|
||||
|
||||
if (groupIds === null) return
|
||||
if (groupIds === null) {
|
||||
console.info(`\n ${logSymbols.info}`, `info: there are no groups on the '${network}' network\n`)
|
||||
return
|
||||
}
|
||||
|
||||
groupId = await getGroupId(groupIds)
|
||||
}
|
||||
@@ -286,7 +300,10 @@ program
|
||||
if (!groupId) {
|
||||
const groupIds = await getGroupIds(network)
|
||||
|
||||
if (groupIds === null) return
|
||||
if (groupIds === null) {
|
||||
console.info(`\n ${logSymbols.info}`, `info: there are no groups on the '${network}' network\n`)
|
||||
return
|
||||
}
|
||||
|
||||
groupId = await getGroupId(groupIds)
|
||||
}
|
||||
|
||||
@@ -34,13 +34,13 @@
|
||||
🔎 Issues
|
||||
</a>
|
||||
<span> | </span>
|
||||
<a href="https://semaphore.appliedzkp.org/discord">
|
||||
<a href="https://semaphore.pse.dev/discord">
|
||||
🗣️ Chat & Support
|
||||
</a>
|
||||
</h4>
|
||||
</div>
|
||||
|
||||
To learn more about contracts visit [semaphore.appliedzkp.org](https://semaphore.appliedzkp.org/docs/technical-reference/contracts).
|
||||
To learn more about contracts visit [semaphore.pse.dev](https://semaphore.pse.dev/docs/technical-reference/contracts).
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/contracts",
|
||||
"version": "3.9.0",
|
||||
"version": "3.15.1",
|
||||
"description": "Semaphore contracts to manage groups and broadcast anonymous signals.",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
"@types/rimraf": "^3.0.2",
|
||||
"chai": "^4.3.5",
|
||||
"circomlib": "^2.0.2",
|
||||
"circomlibjs": "^0.0.8",
|
||||
"circomlibjs": "^0.1.7",
|
||||
"download": "^8.0.0",
|
||||
"ethers": "^5.6.8",
|
||||
"hardhat": "^2.9.7",
|
||||
@@ -38,7 +38,6 @@
|
||||
"js-logger": "^1.6.1",
|
||||
"prettier-plugin-solidity": "^1.0.0-beta.19",
|
||||
"rimraf": "^3.0.2",
|
||||
"snarkjs": "^0.4.13",
|
||||
"solhint": "^3.3.6",
|
||||
"solhint-plugin-prettier": "^0.0.5",
|
||||
"solidity-coverage": "^0.7.21",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { poseidon_gencontract as poseidonContract } from "circomlibjs"
|
||||
import { poseidonContract } from "circomlibjs"
|
||||
import { task, types } from "hardhat/config"
|
||||
|
||||
task("deploy:semaphore-voting", "Deploy a SemaphoreVoting contract")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { poseidon_gencontract as poseidonContract } from "circomlibjs"
|
||||
import { poseidonContract } from "circomlibjs"
|
||||
import { task, types } from "hardhat/config"
|
||||
|
||||
task("deploy:semaphore-whistleblowing", "Deploy a SemaphoreWhistleblowing contract")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { poseidon_gencontract as poseidonContract } from "circomlibjs"
|
||||
import { poseidonContract } from "circomlibjs"
|
||||
import { task, types } from "hardhat/config"
|
||||
import { saveDeployedContracts } from "../scripts/utils"
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/* eslint-disable jest/valid-expect */
|
||||
import { Group } from "@semaphore-protocol/group"
|
||||
import { Identity } from "@semaphore-protocol/identity"
|
||||
import { FullProof, generateProof } from "@semaphore-protocol/proof"
|
||||
import { SemaphoreProof, generateProof } from "@semaphore-protocol/proof"
|
||||
import { expect } from "chai"
|
||||
import { constants, Signer } from "ethers"
|
||||
import { ethers, run } from "hardhat"
|
||||
@@ -237,7 +237,7 @@ describe("Semaphore", () => {
|
||||
|
||||
group.addMembers(members)
|
||||
|
||||
let fullProof: FullProof
|
||||
let fullProof: SemaphoreProof
|
||||
|
||||
before(async () => {
|
||||
await semaphoreContract.addMembers(groupId, [members[1], members[2]])
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable jest/valid-expect */
|
||||
import { Group } from "@semaphore-protocol/group"
|
||||
import { Identity } from "@semaphore-protocol/identity"
|
||||
import { FullProof, generateProof } from "@semaphore-protocol/proof"
|
||||
import { SemaphoreProof, generateProof } from "@semaphore-protocol/proof"
|
||||
import { expect } from "chai"
|
||||
import { Signer } from "ethers"
|
||||
import { ethers, run } from "hardhat"
|
||||
@@ -142,7 +142,7 @@ describe("SemaphoreVoting", () => {
|
||||
|
||||
group.addMembers([identity.commitment, BigInt(1)])
|
||||
|
||||
let fullProof: FullProof
|
||||
let fullProof: SemaphoreProof
|
||||
|
||||
before(async () => {
|
||||
await semaphoreVotingContract.connect(accounts[1]).addVoter(pollIds[1], BigInt(1))
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable jest/valid-expect */
|
||||
import { Group } from "@semaphore-protocol/group"
|
||||
import { Identity } from "@semaphore-protocol/identity"
|
||||
import { FullProof, generateProof } from "@semaphore-protocol/proof"
|
||||
import { SemaphoreProof, generateProof } from "@semaphore-protocol/proof"
|
||||
import { expect } from "chai"
|
||||
import { Signer, utils } from "ethers"
|
||||
import { ethers, run } from "hardhat"
|
||||
@@ -143,7 +143,7 @@ describe("SemaphoreWhistleblowing", () => {
|
||||
|
||||
group.addMembers([identity.commitment, BigInt(1)])
|
||||
|
||||
let fullProof: FullProof
|
||||
let fullProof: SemaphoreProof
|
||||
|
||||
before(async () => {
|
||||
await semaphoreWhistleblowingContract.createEntity(entityIds[1], editor, treeDepth)
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<a href="https://npmjs.org/package/@semaphore-protocol/data">
|
||||
<img alt="Downloads" src="https://img.shields.io/npm/dm/@semaphore-protocol/data.svg?style=flat-square" />
|
||||
</a>
|
||||
<a href="https://js.semaphore.appliedzkp.org/data">
|
||||
<a href="https://js.semaphore.pse.dev/data">
|
||||
<img alt="Documentation typedoc" src="https://img.shields.io/badge/docs-typedoc-744C7C?style=flat-square">
|
||||
</a>
|
||||
<a href="https://eslint.org/">
|
||||
@@ -43,14 +43,14 @@
|
||||
🔎 Issues
|
||||
</a>
|
||||
<span> | </span>
|
||||
<a href="https://semaphore.appliedzkp.org/discord">
|
||||
<a href="https://semaphore.pse.dev/discord">
|
||||
🗣️ Chat & Support
|
||||
</a>
|
||||
</h4>
|
||||
</div>
|
||||
|
||||
| This library allows you to query the [`Semaphore.sol`](https://github.com/semaphore-protocol/semaphore/blob/main/contracts/Semaphore.sol) contract data (i.e. groups) using the [Semaphore subgraph](https://github.com/semaphore-protocol/subgraph) or Ethers. It can be used on Node.js and browsers. |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| This library allows you to query the [`Semaphore.sol`](https://github.com/semaphore-protocol/semaphore/blob/main/packages/contracts/contracts/Semaphore.sol) contract data (i.e. groups) using the [Semaphore subgraph](https://github.com/semaphore-protocol/subgraph) or Ethers. It can be used on Node.js and browsers. |
|
||||
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
|
||||
## 🛠 Install
|
||||
|
||||
@@ -118,6 +118,15 @@ const group = await semaphoreSubgraph.getGroup("42")
|
||||
const { members, verifiedProofs } = semaphoreSubgraph.getGroup("42", { members: true, verifiedProofs: true })
|
||||
```
|
||||
|
||||
\# **isGroupMember**(groupId: _string_, member: _string_): _Promise\<boolean>_
|
||||
|
||||
```typescript
|
||||
await semaphoreSubgraph.isGroupMember(
|
||||
"42",
|
||||
"16948514235341957898454876473214737047419402240398321289450170535251226167324"
|
||||
)
|
||||
```
|
||||
|
||||
\# **new Ethers**(networkOrEthereumURL: Network | string = "goerli", options: EthersOptions = {}): _SemaphoreEthers_
|
||||
|
||||
```typescript
|
||||
@@ -164,5 +173,5 @@ const members = await semaphoreEthers.getGroupMembers("42")
|
||||
\# **getGroupVerifiedProofs**(groupId: _string_): _Promise\<any[]>_
|
||||
|
||||
```typescript
|
||||
const verifiedProofs = await semaphoreEthers.getGroupVerifiedProofs()
|
||||
const verifiedProofs = await semaphoreEthers.getGroupVerifiedProofs("42")
|
||||
```
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/data",
|
||||
"version": "3.9.0",
|
||||
"version": "3.15.1",
|
||||
"description": "A library to query Semaphore contracts.",
|
||||
"license": "MIT",
|
||||
"main": "dist/index.node.js",
|
||||
"exports": {
|
||||
"import": "./dist/index.mjs",
|
||||
"require": "./dist/index.node.js"
|
||||
"require": "./dist/index.node.js",
|
||||
"types": "./dist/types/index.d.ts"
|
||||
},
|
||||
"types": "./dist/types/index.d.ts",
|
||||
"files": [
|
||||
@@ -23,8 +24,7 @@
|
||||
"scripts": {
|
||||
"build:watch": "rollup -c rollup.config.ts -w --configPlugin typescript",
|
||||
"build": "rimraf dist && rollup -c rollup.config.ts --configPlugin typescript",
|
||||
"prepublishOnly": "yarn build",
|
||||
"docs": "typedoc src/index.ts --out ../../docs/data"
|
||||
"prepublishOnly": "yarn build"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
@@ -32,8 +32,7 @@
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-json": "^6.0.0",
|
||||
"rollup-plugin-cleanup": "^3.2.1",
|
||||
"rollup-plugin-typescript2": "^0.31.2",
|
||||
"typedoc": "^0.22.11"
|
||||
"rollup-plugin-typescript2": "^0.31.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ethersproject/contracts": "^5.7.0",
|
||||
|
||||
@@ -31,7 +31,11 @@ describe("SemaphoreEthers", () => {
|
||||
const semaphore2 = new SemaphoreEthers("matic")
|
||||
const semaphore3 = new SemaphoreEthers("optimism-goerli")
|
||||
const semaphore4 = new SemaphoreEthers("arbitrum-goerli")
|
||||
const semaphore5 = new SemaphoreEthers("homestead", {
|
||||
const semaphore5 = new SemaphoreEthers("arbitrum-goerli", {
|
||||
address: "0x0000000000000000000000000000000000000000",
|
||||
startBlock: 0
|
||||
})
|
||||
const semaphore6 = new SemaphoreEthers("homestead", {
|
||||
address: "0x0000000000000000000000000000000000000000",
|
||||
startBlock: 0
|
||||
})
|
||||
@@ -42,9 +46,10 @@ describe("SemaphoreEthers", () => {
|
||||
expect(semaphore2.network).toBe("maticmum")
|
||||
expect(semaphore3.network).toBe("optimism-goerli")
|
||||
expect(semaphore4.network).toBe("arbitrum-goerli")
|
||||
expect(semaphore5.network).toBe("homestead")
|
||||
expect(semaphore5.options.startBlock).toBe(0)
|
||||
expect(semaphore5.options.address).toContain("0x000000")
|
||||
expect(semaphore6.network).toBe("homestead")
|
||||
expect(semaphore6.options.startBlock).toBe(0)
|
||||
expect(semaphore6.options.address).toContain("0x000000")
|
||||
})
|
||||
|
||||
it("Should instantiate a SemaphoreEthers object with different providers", () => {
|
||||
|
||||
@@ -43,37 +43,35 @@ export default class SemaphoreEthers {
|
||||
|
||||
switch (networkOrEthereumURL) {
|
||||
case "arbitrum":
|
||||
options.address = "0xc60E0Ee1a2770d5F619858C641f14FC4a6401520"
|
||||
options.startBlock = 77278430
|
||||
options.address ??= "0xc60E0Ee1a2770d5F619858C641f14FC4a6401520"
|
||||
options.startBlock ??= 77278430
|
||||
break
|
||||
case "arbitrum-goerli":
|
||||
options.address = "0x3889927F0B5Eb1a02C6E2C20b39a1Bd4EAd76131"
|
||||
options.startBlock = 15174410
|
||||
options.address ??= "0x3889927F0B5Eb1a02C6E2C20b39a1Bd4EAd76131"
|
||||
options.startBlock ??= 15174410
|
||||
break
|
||||
case "maticmum":
|
||||
options.address = "0x3889927F0B5Eb1a02C6E2C20b39a1Bd4EAd76131"
|
||||
options.startBlock = 33995010
|
||||
options.address ??= "0x3889927F0B5Eb1a02C6E2C20b39a1Bd4EAd76131"
|
||||
options.startBlock ??= 33995010
|
||||
break
|
||||
case "goerli":
|
||||
options.address = "0x3889927F0B5Eb1a02C6E2C20b39a1Bd4EAd76131"
|
||||
options.startBlock = 8777695
|
||||
options.address ??= "0x3889927F0B5Eb1a02C6E2C20b39a1Bd4EAd76131"
|
||||
options.startBlock ??= 8777695
|
||||
break
|
||||
case "sepolia":
|
||||
options.address = "0x3889927F0B5Eb1a02C6E2C20b39a1Bd4EAd76131"
|
||||
options.startBlock = 3231111
|
||||
options.address ??= "0x3889927F0B5Eb1a02C6E2C20b39a1Bd4EAd76131"
|
||||
options.startBlock ??= 3231111
|
||||
break
|
||||
case "optimism-goerli":
|
||||
options.address = "0x3889927F0B5Eb1a02C6E2C20b39a1Bd4EAd76131"
|
||||
options.startBlock = 7632846
|
||||
options.address ??= "0x3889927F0B5Eb1a02C6E2C20b39a1Bd4EAd76131"
|
||||
options.startBlock ??= 7632846
|
||||
break
|
||||
default:
|
||||
if (options.address === undefined) {
|
||||
throw new Error(`You should provide a Semaphore contract address for this network`)
|
||||
}
|
||||
|
||||
if (options.startBlock === undefined) {
|
||||
options.startBlock = 0
|
||||
}
|
||||
options.startBlock ??= 0
|
||||
}
|
||||
|
||||
let provider: Provider
|
||||
|
||||
12
packages/data/src/index.test.ts
Normal file
12
packages/data/src/index.test.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import getSupportedNetworks from "./getSupportedNetworks"
|
||||
|
||||
describe("Data", () => {
|
||||
describe("# getSupportedNetworks", () => {
|
||||
it("Should return a list of supported networks", () => {
|
||||
const supportedNetworks = getSupportedNetworks()
|
||||
|
||||
expect(supportedNetworks).toHaveLength(6)
|
||||
expect(supportedNetworks).toContain("sepolia")
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -202,7 +202,8 @@ describe("SemaphoreSubgraph", () => {
|
||||
|
||||
const expectedValue = await semaphore.getGroups({
|
||||
filters: {
|
||||
admin: "0x7bcd6f009471e9974a77086a69289d16eadba286"
|
||||
admin: "0x7bcd6f009471e9974a77086a69289d16eadba286",
|
||||
identityCommitment: "123"
|
||||
}
|
||||
})
|
||||
|
||||
@@ -338,4 +339,31 @@ describe("SemaphoreSubgraph", () => {
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe("# isGroupMember", () => {
|
||||
it("Should throw an error if the member parameter type is wrong", async () => {
|
||||
const fun = () => semaphore.isGroupMember("1", 1 as any)
|
||||
|
||||
await expect(fun).rejects.toThrow("Parameter 'member' is not a string")
|
||||
})
|
||||
|
||||
it("Should return true if a group member exist", async () => {
|
||||
requestMocked.mockImplementationOnce(() =>
|
||||
Promise.resolve({
|
||||
groups: [
|
||||
{
|
||||
id: "1"
|
||||
}
|
||||
]
|
||||
})
|
||||
)
|
||||
|
||||
const expectedValue = await semaphore.isGroupMember(
|
||||
"1",
|
||||
"19759682999141591121829027463339362582441675980174830329241909768001406603165"
|
||||
)
|
||||
|
||||
expect(expectedValue).toBeTruthy()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -68,13 +68,17 @@ export default class SemaphoreSubgraph {
|
||||
let filtersQuery = ""
|
||||
|
||||
if (options.filters) {
|
||||
const { admin, timestamp, timestampGte, timestampLte } = options.filters
|
||||
const { admin, identityCommitment, timestamp, timestampGte, timestampLte } = options.filters
|
||||
const filterFragments = []
|
||||
|
||||
if (admin) {
|
||||
filterFragments.push(`admin: "${admin}"`)
|
||||
}
|
||||
|
||||
if (identityCommitment) {
|
||||
filterFragments.push(`members_: { identityCommitment: "${identityCommitment}" }`)
|
||||
}
|
||||
|
||||
/* istanbul ignore next */
|
||||
if (timestamp) {
|
||||
filterFragments.push(`timestamp: "${jsDateToGraphqlDate(timestamp)}"`)
|
||||
@@ -195,4 +199,30 @@ export default class SemaphoreSubgraph {
|
||||
|
||||
return groups[0]
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if a member is part of group, and false otherwise.
|
||||
* @param groupId Group id
|
||||
* @param member Group member.
|
||||
* @returns True if the member is part of the group, false otherwise.
|
||||
*/
|
||||
async isGroupMember(groupId: string, member: string): Promise<boolean> {
|
||||
checkParameter(groupId, "groupId", "string")
|
||||
checkParameter(member, "member", "string")
|
||||
|
||||
const config: AxiosRequestConfig = {
|
||||
method: "post",
|
||||
data: JSON.stringify({
|
||||
query: `{
|
||||
groups(where: { id: "${groupId}", members_: { identityCommitment: "${member}" } }) {
|
||||
id
|
||||
}
|
||||
}`
|
||||
})
|
||||
}
|
||||
|
||||
const { groups } = await request(this._url, config)
|
||||
|
||||
return groups.length !== 0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ export type GroupOptions = {
|
||||
verifiedProofs?: boolean
|
||||
filters?: {
|
||||
admin?: string
|
||||
identityCommitment?: string
|
||||
timestamp?: Date
|
||||
timestampGte?: Date
|
||||
timestampLte?: Date
|
||||
|
||||
3
packages/data/typedoc.json
Normal file
3
packages/data/typedoc.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"entryPoints": ["src/index.ts"]
|
||||
}
|
||||
@@ -18,7 +18,7 @@
|
||||
<a href="https://npmjs.org/package/@semaphore-protocol/group">
|
||||
<img alt="Downloads" src="https://img.shields.io/npm/dm/@semaphore-protocol/group.svg?style=flat-square" />
|
||||
</a>
|
||||
<a href="https://js.semaphore.appliedzkp.org/group">
|
||||
<a href="https://js.semaphore.pse.dev/group">
|
||||
<img alt="Documentation typedoc" src="https://img.shields.io/badge/docs-typedoc-744C7C?style=flat-square">
|
||||
</a>
|
||||
<a href="https://eslint.org/">
|
||||
@@ -43,7 +43,7 @@
|
||||
🔎 Issues
|
||||
</a>
|
||||
<span> | </span>
|
||||
<a href="https://semaphore.appliedzkp.org/discord">
|
||||
<a href="https://semaphore.pse.dev/discord">
|
||||
🗣️ Chat & Support
|
||||
</a>
|
||||
</h4>
|
||||
@@ -74,6 +74,7 @@ yarn add @semaphore-protocol/group
|
||||
|
||||
```typescript
|
||||
import { Group } from "@semaphore-protocol/group"
|
||||
import { Identity } from "@semaphore-protocol/identity"
|
||||
|
||||
// Group with max 1048576 members (20^²).
|
||||
const group1 = new Group(1)
|
||||
@@ -83,6 +84,13 @@ const group2 = new Group(1, 16)
|
||||
|
||||
// Group with max 16777216 members (24^²).
|
||||
const group3 = new Group(1, 24)
|
||||
|
||||
// Group with a list of predefined members.
|
||||
const identity1 = new Identity()
|
||||
const identity2 = new Identity()
|
||||
const identity3 = new Identity()
|
||||
|
||||
const group3 = new Group(1, 16, [identity1.commitment, identity2.commitment, identity3.commitment])
|
||||
```
|
||||
|
||||
\# **addMember**(identityCommitment: _Member_)
|
||||
@@ -96,21 +104,6 @@ const commitment = identity.generateCommitment()
|
||||
group.addMember(commitment)
|
||||
```
|
||||
|
||||
\# **addMembers**(identityCommitments: _Member\[]_)
|
||||
|
||||
```typescript
|
||||
let identityCommitments: bigint[]
|
||||
|
||||
for (let i = 0; i < 10; i++) {
|
||||
const identity = new Identity()
|
||||
const commitment = identity.generateCommitment()
|
||||
|
||||
identityCommitments.push(commitment)
|
||||
}
|
||||
|
||||
group.addMember(identityCommitments)
|
||||
```
|
||||
|
||||
\# **removeMember**(index: _number_)
|
||||
|
||||
```typescript
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/group",
|
||||
"version": "3.9.0",
|
||||
"version": "3.15.1",
|
||||
"description": "A library to create and manage Semaphore groups.",
|
||||
"license": "MIT",
|
||||
"main": "dist/index.node.js",
|
||||
"exports": {
|
||||
"import": "./dist/index.mjs",
|
||||
"require": "./dist/index.node.js"
|
||||
"require": "./dist/index.node.js",
|
||||
"types": "./dist/types/index.d.ts"
|
||||
},
|
||||
"types": "dist/types/index.d.ts",
|
||||
"files": [
|
||||
@@ -23,8 +24,7 @@
|
||||
"scripts": {
|
||||
"build:watch": "rollup -c rollup.config.ts -w --configPlugin typescript",
|
||||
"build": "rimraf dist && rollup -c rollup.config.ts --configPlugin typescript",
|
||||
"prepublishOnly": "yarn build",
|
||||
"docs": "typedoc src/index.ts --out ../../docs/group"
|
||||
"prepublishOnly": "yarn build"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
@@ -34,13 +34,12 @@
|
||||
"@rollup/plugin-node-resolve": "^15.0.1",
|
||||
"poseidon-lite": "^0.2.0",
|
||||
"rollup-plugin-cleanup": "^3.2.1",
|
||||
"rollup-plugin-typescript2": "^0.31.2",
|
||||
"typedoc": "^0.22.11"
|
||||
"rollup-plugin-typescript2": "^0.31.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ethersproject/bignumber": "^5.7.0",
|
||||
"@ethersproject/bytes": "^5.7.0",
|
||||
"@ethersproject/keccak256": "^5.7.0",
|
||||
"@zk-kit/incremental-merkle-tree": "1.0.0"
|
||||
"@zk-kit/incremental-merkle-tree": "1.1.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ describe("Group", () => {
|
||||
expect(fun).toThrow("The tree depth must be between 16 and 32")
|
||||
})
|
||||
|
||||
it("Should create a group with different parameters", () => {
|
||||
it("Should create a group with a different tree depth", () => {
|
||||
const group = new Group(1, 32)
|
||||
|
||||
expect(group.root.toString()).toContain("460373")
|
||||
@@ -27,6 +27,21 @@ describe("Group", () => {
|
||||
expect(group.zeroValue).toBe(hash(1))
|
||||
expect(group.members).toHaveLength(0)
|
||||
})
|
||||
|
||||
it("Should create a group with a list of members", () => {
|
||||
const group = new Group(2, 20, [1, 2, 3])
|
||||
|
||||
const group2 = new Group(2, 20)
|
||||
|
||||
group2.addMember(1)
|
||||
group2.addMember(2)
|
||||
group2.addMember(3)
|
||||
|
||||
expect(group.root.toString()).toContain(group2.root.toString())
|
||||
expect(group.depth).toBe(20)
|
||||
expect(group.zeroValue).toBe(hash(2))
|
||||
expect(group.members).toHaveLength(3)
|
||||
})
|
||||
})
|
||||
|
||||
describe("# addMember", () => {
|
||||
|
||||
@@ -12,14 +12,15 @@ export default class Group {
|
||||
* Initializes the group with the group id and the tree depth.
|
||||
* @param id Group identifier.
|
||||
* @param treeDepth Tree depth.
|
||||
* @param members List of group members.
|
||||
*/
|
||||
constructor(id: BigNumberish, treeDepth = 20) {
|
||||
constructor(id: BigNumberish, treeDepth = 20, members: BigNumberish[] = []) {
|
||||
if (treeDepth < 16 || treeDepth > 32) {
|
||||
throw new Error("The tree depth must be between 16 and 32")
|
||||
}
|
||||
|
||||
this._id = id
|
||||
this.merkleTree = new IncrementalMerkleTree(poseidon2, treeDepth, hash(id), 2)
|
||||
this.merkleTree = new IncrementalMerkleTree(poseidon2, treeDepth, hash(id), 2, members.map(BigInt))
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,6 +83,7 @@ export default class Group {
|
||||
/**
|
||||
* Adds new members to the group.
|
||||
* @param members New members.
|
||||
* @deprecated Use the new class parameter to add a list of members.
|
||||
*/
|
||||
addMembers(members: BigNumberish[]) {
|
||||
for (const member of members) {
|
||||
|
||||
3
packages/group/typedoc.json
Normal file
3
packages/group/typedoc.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"entryPoints": ["src/index.ts"]
|
||||
}
|
||||
@@ -40,7 +40,7 @@
|
||||
🔎 Issues
|
||||
</a>
|
||||
<span> | </span>
|
||||
<a href="https://semaphore.appliedzkp.org/discord">
|
||||
<a href="https://semaphore.pse.dev/discord">
|
||||
🗣️ Chat & Support
|
||||
</a>
|
||||
</h4>
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/hardhat",
|
||||
"version": "3.9.0",
|
||||
"version": "3.15.1",
|
||||
"description": "A Semaphore Hardhat plugin to deploy verifiers and Semaphore contract.",
|
||||
"license": "MIT",
|
||||
"main": "dist/index.node.js",
|
||||
"exports": {
|
||||
"import": "./dist/index.mjs",
|
||||
"require": "./dist/index.node.js"
|
||||
"require": "./dist/index.node.js",
|
||||
"types": "./dist/types/index.d.ts"
|
||||
},
|
||||
"types": "dist/types/index.d.ts",
|
||||
"files": [
|
||||
@@ -38,8 +39,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@nomiclabs/hardhat-ethers": "^2.1.1",
|
||||
"@semaphore-protocol/contracts": "3.9.0",
|
||||
"circomlibjs": "^0.0.8",
|
||||
"@semaphore-protocol/contracts": "3.15.1",
|
||||
"circomlibjs": "^0.1.7",
|
||||
"ethers": "^5.7.1",
|
||||
"hardhat-dependency-compiler": "^1.1.3"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { poseidon_gencontract as poseidonContract } from "circomlibjs"
|
||||
import { poseidonContract } from "circomlibjs"
|
||||
import { task, types } from "hardhat/config"
|
||||
|
||||
task("deploy:semaphore", "Deploy a Semaphore contract")
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<a href="https://npmjs.org/package/@semaphore-protocol/heyauthn">
|
||||
<img alt="Downloads" src="https://img.shields.io/npm/dm/@semaphore-protocol/heyauthn.svg?style=flat-square" />
|
||||
</a>
|
||||
<a href="https://js.semaphore.appliedzkp.org/heyauthn">
|
||||
<a href="https://js.semaphore.pse.dev/heyauthn">
|
||||
<img alt="Documentation typedoc" src="https://img.shields.io/badge/docs-typedoc-744C7C?style=flat-square">
|
||||
</a>
|
||||
<a href="https://eslint.org/">
|
||||
@@ -43,7 +43,7 @@
|
||||
🔎 Issues
|
||||
</a>
|
||||
<span> | </span>
|
||||
<a href="https://semaphore.appliedzkp.org/discord">
|
||||
<a href="https://semaphore.pse.dev/discord">
|
||||
🗣️ Chat & Support
|
||||
</a>
|
||||
</h4>
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/heyauthn",
|
||||
"version": "3.9.0",
|
||||
"version": "3.15.1",
|
||||
"description": "A library to allow developers to create and manage Semaphore identities using WebAuthn",
|
||||
"license": "MIT",
|
||||
"main": "dist/index.node.js",
|
||||
"exports": {
|
||||
"import": "./dist/index.mjs",
|
||||
"require": "./dist/index.node.js"
|
||||
"require": "./dist/index.node.js",
|
||||
"types": "./dist/types/index.d.ts"
|
||||
},
|
||||
"types": "dist/types/index.d.ts",
|
||||
"files": [
|
||||
@@ -23,19 +24,17 @@
|
||||
"scripts": {
|
||||
"build:watch": "rollup -c rollup.config.ts -w --configPlugin typescript",
|
||||
"build": "rimraf dist && rollup -c rollup.config.ts --configPlugin typescript",
|
||||
"prepublishOnly": "yarn build",
|
||||
"docs": "typedoc src/index.ts --out ../../docs/heyauthn"
|
||||
"prepublishOnly": "yarn build"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"devDependencies": {
|
||||
"rollup-plugin-cleanup": "^3.2.1",
|
||||
"rollup-plugin-typescript2": "^0.31.2",
|
||||
"typedoc": "^0.22.11"
|
||||
"rollup-plugin-typescript2": "^0.31.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@semaphore-protocol/identity": "3.9.0",
|
||||
"@semaphore-protocol/identity": "3.15.1",
|
||||
"@simplewebauthn/browser": "7.2.0",
|
||||
"@simplewebauthn/server": "7.2.0"
|
||||
}
|
||||
|
||||
3
packages/heyauthn/typedoc.json
Normal file
3
packages/heyauthn/typedoc.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"entryPoints": ["src/index.ts"]
|
||||
}
|
||||
@@ -18,7 +18,7 @@
|
||||
<a href="https://npmjs.org/package/@semaphore-protocol/identity">
|
||||
<img alt="Downloads" src="https://img.shields.io/npm/dm/@semaphore-protocol/identity.svg?style=flat-square" />
|
||||
</a>
|
||||
<a href="https://js.semaphore.appliedzkp.org/identity">
|
||||
<a href="https://js.semaphore.pse.dev/identity">
|
||||
<img alt="Documentation typedoc" src="https://img.shields.io/badge/docs-typedoc-744C7C?style=flat-square">
|
||||
</a>
|
||||
<a href="https://eslint.org/">
|
||||
@@ -43,7 +43,7 @@
|
||||
🔎 Issues
|
||||
</a>
|
||||
<span> | </span>
|
||||
<a href="https://semaphore.appliedzkp.org/discord">
|
||||
<a href="https://semaphore.pse.dev/discord">
|
||||
🗣️ Chat & Support
|
||||
</a>
|
||||
</h4>
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/identity",
|
||||
"version": "3.9.0",
|
||||
"version": "3.15.1",
|
||||
"description": "A library to create Semaphore identities.",
|
||||
"license": "MIT",
|
||||
"main": "dist/index.node.js",
|
||||
"exports": {
|
||||
"import": "./dist/index.mjs",
|
||||
"require": "./dist/index.node.js"
|
||||
"require": "./dist/index.node.js",
|
||||
"types": "./dist/types/index.d.ts"
|
||||
},
|
||||
"types": "dist/types/index.d.ts",
|
||||
"files": [
|
||||
@@ -23,8 +24,7 @@
|
||||
"scripts": {
|
||||
"build:watch": "rollup -c rollup.config.ts -w --configPlugin typescript",
|
||||
"build": "rimraf dist && rollup -c rollup.config.ts --configPlugin typescript",
|
||||
"prepublishOnly": "yarn build",
|
||||
"docs": "typedoc src/index.ts --out ../../docs/identity"
|
||||
"prepublishOnly": "yarn build"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
@@ -34,8 +34,7 @@
|
||||
"@rollup/plugin-node-resolve": "^15.0.1",
|
||||
"poseidon-lite": "^0.2.0",
|
||||
"rollup-plugin-cleanup": "^3.2.1",
|
||||
"rollup-plugin-typescript2": "^0.31.2",
|
||||
"typedoc": "^0.22.11"
|
||||
"rollup-plugin-typescript2": "^0.31.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ethersproject/bignumber": "^5.5.0",
|
||||
|
||||
3
packages/identity/typedoc.json
Normal file
3
packages/identity/typedoc.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"entryPoints": ["src/index.ts"]
|
||||
}
|
||||
@@ -18,7 +18,7 @@
|
||||
<a href="https://npmjs.org/package/@semaphore-protocol/proof">
|
||||
<img alt="Downloads" src="https://img.shields.io/npm/dm/@semaphore-protocol/proof.svg?style=flat-square" />
|
||||
</a>
|
||||
<a href="https://js.semaphore.appliedzkp.org/proof">
|
||||
<a href="https://js.semaphore.pse.dev/proof">
|
||||
<img alt="Documentation typedoc" src="https://img.shields.io/badge/docs-typedoc-744C7C?style=flat-square">
|
||||
</a>
|
||||
<a href="https://eslint.org/">
|
||||
@@ -43,7 +43,7 @@
|
||||
🔎 Issues
|
||||
</a>
|
||||
<span> | </span>
|
||||
<a href="https://semaphore.appliedzkp.org/discord">
|
||||
<a href="https://semaphore.pse.dev/discord">
|
||||
🗣️ Chat & Support
|
||||
</a>
|
||||
</h4>
|
||||
@@ -76,7 +76,7 @@ group: _Group_ | _MerkleProof_,
|
||||
externalNullifier: _BytesLike | Hexable | number | bigint_,
|
||||
signal: _BytesLike | Hexable | number | bigint_,
|
||||
snarkArtifacts?: _SnarkArtifacts_
|
||||
): Promise\<_SemaphoreFullProof_>
|
||||
): Promise\<_SemaphoreProof_>
|
||||
|
||||
```typescript
|
||||
import { Identity } from "@semaphore-protocol/identity"
|
||||
@@ -100,7 +100,7 @@ const fullProof = await generateProof(identity, group, externalNullifier, signal
|
||||
// const fullProof = await generateProof(identity, group, externalNullifier, signal)
|
||||
```
|
||||
|
||||
\# **verifyProof**(fullProof: _FullProof_, treeDepth: _number_): Promise\<_boolean_>
|
||||
\# **verifyProof**(semaphoreProof: _SemaphoreProof_, treeDepth: _number_): Promise\<_boolean_>
|
||||
|
||||
```typescript
|
||||
import { verifyProof } from "@semaphore-protocol/proof"
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/proof",
|
||||
"version": "3.9.0",
|
||||
"version": "3.15.1",
|
||||
"description": "A library to generate and verify Semaphore proofs.",
|
||||
"license": "MIT",
|
||||
"main": "dist/index.node.js",
|
||||
"exports": {
|
||||
"import": "./dist/index.mjs",
|
||||
"require": "./dist/index.node.js"
|
||||
"import": "./dist/index.node.mjs",
|
||||
"require": "./dist/index.node.js",
|
||||
"types": "./dist/types/index.d.ts"
|
||||
},
|
||||
"types": "dist/types/index.d.ts",
|
||||
"files": [
|
||||
@@ -23,8 +24,7 @@
|
||||
"scripts": {
|
||||
"build:watch": "rollup -c rollup.config.ts -w --configPlugin typescript",
|
||||
"build": "rimraf dist && rollup -c rollup.config.ts --configPlugin typescript",
|
||||
"prepublishOnly": "yarn build",
|
||||
"docs": "typedoc src/index.ts --out ../../docs/proof"
|
||||
"prepublishOnly": "yarn build"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
@@ -33,22 +33,22 @@
|
||||
"@rollup/plugin-commonjs": "^24.1.0",
|
||||
"@rollup/plugin-json": "^5.0.1",
|
||||
"@rollup/plugin-node-resolve": "^15.0.2",
|
||||
"ffjavascript": "^0.2.54",
|
||||
"poseidon-lite": "^0.2.0",
|
||||
"rimraf": "^5.0.5",
|
||||
"rollup": "^4.0.2",
|
||||
"rollup-plugin-cleanup": "^3.2.1",
|
||||
"rollup-plugin-typescript2": "^0.31.2",
|
||||
"typedoc": "^0.22.11"
|
||||
"rollup-plugin-typescript2": "^0.31.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@semaphore-protocol/group": "3.9.0",
|
||||
"@semaphore-protocol/identity": "3.9.0"
|
||||
"@semaphore-protocol/group": "3.15.1",
|
||||
"@semaphore-protocol/identity": "3.15.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ethersproject/bignumber": "^5.5.0",
|
||||
"@ethersproject/bytes": "^5.7.0",
|
||||
"@ethersproject/keccak256": "^5.7.0",
|
||||
"@ethersproject/strings": "^5.5.0",
|
||||
"@zk-kit/incremental-merkle-tree": "0.4.3",
|
||||
"snarkjs": "0.4.13"
|
||||
"@zk-kit/groth16": "0.3.0",
|
||||
"@zk-kit/incremental-merkle-tree": "0.4.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import typescript from "rollup-plugin-typescript2"
|
||||
import commonjs from "@rollup/plugin-commonjs"
|
||||
import * as fs from "fs"
|
||||
import cleanup from "rollup-plugin-cleanup"
|
||||
import json from "@rollup/plugin-json"
|
||||
import { nodeResolve } from "@rollup/plugin-node-resolve"
|
||||
import * as fs from "fs"
|
||||
import cleanup from "rollup-plugin-cleanup"
|
||||
import typescript from "rollup-plugin-typescript2"
|
||||
|
||||
const pkg = JSON.parse(fs.readFileSync("./package.json", "utf-8"))
|
||||
const banner = `/**
|
||||
@@ -18,8 +18,17 @@ const banner = `/**
|
||||
export default {
|
||||
input: "src/index.ts",
|
||||
output: [
|
||||
{ file: pkg.exports.require, format: "cjs", banner, exports: "auto" },
|
||||
{ file: pkg.exports.import, format: "es", banner }
|
||||
{
|
||||
file: pkg.exports.require,
|
||||
format: "cjs",
|
||||
banner,
|
||||
exports: "auto"
|
||||
},
|
||||
{
|
||||
file: pkg.exports.import,
|
||||
format: "es",
|
||||
banner
|
||||
}
|
||||
],
|
||||
external: Object.keys(pkg.dependencies),
|
||||
plugins: [
|
||||
@@ -27,8 +36,10 @@ export default {
|
||||
tsconfig: "./build.tsconfig.json",
|
||||
useTsconfigDeclarationDir: true
|
||||
}),
|
||||
commonjs(),
|
||||
nodeResolve(),
|
||||
commonjs({
|
||||
esmExternals: true
|
||||
}),
|
||||
cleanup({ comments: "jsdoc" }),
|
||||
json()
|
||||
]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { BytesLike, Hexable } from "@ethersproject/bytes"
|
||||
import { poseidon2 } from "poseidon-lite/poseidon2"
|
||||
import { poseidon2 } from "poseidon-lite"
|
||||
import hash from "./hash"
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,11 +2,12 @@ import { BigNumber } from "@ethersproject/bignumber"
|
||||
import { BytesLike, Hexable } from "@ethersproject/bytes"
|
||||
import { Group } from "@semaphore-protocol/group"
|
||||
import type { Identity } from "@semaphore-protocol/identity"
|
||||
import { prove } from "@zk-kit/groth16"
|
||||
import { MerkleProof } from "@zk-kit/incremental-merkle-tree"
|
||||
import { groth16 } from "snarkjs"
|
||||
import type { NumericString } from "snarkjs"
|
||||
import hash from "./hash"
|
||||
import packProof from "./packProof"
|
||||
import { FullProof, SnarkArtifacts } from "./types"
|
||||
import { SemaphoreProof, SnarkArtifacts } from "./types"
|
||||
|
||||
/**
|
||||
* Generates a Semaphore proof.
|
||||
@@ -23,7 +24,7 @@ export default async function generateProof(
|
||||
externalNullifier: BytesLike | Hexable | number | bigint,
|
||||
signal: BytesLike | Hexable | number | bigint,
|
||||
snarkArtifacts?: SnarkArtifacts
|
||||
): Promise<FullProof> {
|
||||
): Promise<SemaphoreProof> {
|
||||
let merkleProof: MerkleProof
|
||||
|
||||
if ("depth" in groupOrMerkleProof) {
|
||||
@@ -45,7 +46,7 @@ export default async function generateProof(
|
||||
}
|
||||
}
|
||||
|
||||
const { proof, publicSignals } = await groth16.fullProve(
|
||||
const { proof, publicSignals } = await prove(
|
||||
{
|
||||
identityTrapdoor: trapdoor,
|
||||
identityNullifier: nullifier,
|
||||
@@ -61,8 +62,8 @@ export default async function generateProof(
|
||||
return {
|
||||
merkleTreeRoot: publicSignals[0],
|
||||
nullifierHash: publicSignals[1],
|
||||
signal: BigNumber.from(signal).toString(),
|
||||
externalNullifier: BigNumber.from(externalNullifier).toString(),
|
||||
signal: BigNumber.from(signal).toString() as NumericString,
|
||||
externalNullifier: BigNumber.from(externalNullifier).toString() as NumericString,
|
||||
proof: packProof(proof)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
import { BigNumber } from "@ethersproject/bignumber"
|
||||
import { BytesLike, Hexable, zeroPad } from "@ethersproject/bytes"
|
||||
import { keccak256 } from "@ethersproject/keccak256"
|
||||
import { NumericString } from "snarkjs"
|
||||
|
||||
/**
|
||||
* Creates a keccak256 hash of a message compatible with the SNARK scalar modulus.
|
||||
* @param message The message to be hashed.
|
||||
* @returns The message digest.
|
||||
*/
|
||||
export default function hash(message: BytesLike | Hexable | number | bigint): bigint {
|
||||
export default function hash(message: BytesLike | Hexable | number | bigint): NumericString {
|
||||
message = BigNumber.from(message).toTwos(256).toHexString()
|
||||
message = zeroPad(message, 32)
|
||||
|
||||
return BigInt(keccak256(message)) >> BigInt(8)
|
||||
return (BigInt(keccak256(message)) >> BigInt(8)).toString() as NumericString
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import calculateNullifierHash from "./calculateNullifierHash"
|
||||
import generateProof from "./generateProof"
|
||||
import hash from "./hash"
|
||||
import packProof from "./packProof"
|
||||
import { FullProof } from "./types"
|
||||
import { SemaphoreProof } from "./types"
|
||||
import unpackProof from "./unpackProof"
|
||||
import verifyProof from "./verifyProof"
|
||||
|
||||
@@ -21,7 +21,7 @@ describe("Proof", () => {
|
||||
|
||||
const identity = new Identity()
|
||||
|
||||
let fullProof: FullProof
|
||||
let fullProof: SemaphoreProof
|
||||
let curve: any
|
||||
|
||||
beforeAll(async () => {
|
||||
@@ -34,9 +34,7 @@ describe("Proof", () => {
|
||||
|
||||
describe("# generateProof", () => {
|
||||
it("Should not generate Semaphore proofs if the identity is not part of the group", async () => {
|
||||
const group = new Group(treeDepth)
|
||||
|
||||
group.addMembers([BigInt(1), BigInt(2)])
|
||||
const group = new Group(treeDepth, 20, [BigInt(1), BigInt(2)])
|
||||
|
||||
const fun = () =>
|
||||
generateProof(identity, group, externalNullifier, signal, {
|
||||
@@ -48,9 +46,7 @@ describe("Proof", () => {
|
||||
})
|
||||
|
||||
it("Should not generate a Semaphore proof with default snark artifacts with Node.js", async () => {
|
||||
const group = new Group(treeDepth)
|
||||
|
||||
group.addMembers([BigInt(1), BigInt(2), identity.commitment])
|
||||
const group = new Group(treeDepth, 20, [BigInt(1), BigInt(2), identity.commitment])
|
||||
|
||||
const fun = () => generateProof(identity, group, externalNullifier, signal)
|
||||
|
||||
@@ -58,9 +54,7 @@ describe("Proof", () => {
|
||||
})
|
||||
|
||||
it("Should generate a Semaphore proof passing a group as parameter", async () => {
|
||||
const group = new Group(treeDepth)
|
||||
|
||||
group.addMembers([BigInt(1), BigInt(2), identity.commitment])
|
||||
const group = new Group(treeDepth, 20, [BigInt(1), BigInt(2), identity.commitment])
|
||||
|
||||
fullProof = await generateProof(identity, group, externalNullifier, signal, {
|
||||
wasmFilePath,
|
||||
@@ -72,9 +66,7 @@ describe("Proof", () => {
|
||||
}, 20000)
|
||||
|
||||
it("Should generate a Semaphore proof passing a Merkle proof as parameter", async () => {
|
||||
const group = new Group(treeDepth)
|
||||
|
||||
group.addMembers([BigInt(1), BigInt(2), identity.commitment])
|
||||
const group = new Group(treeDepth, 20, [BigInt(1), BigInt(2), identity.commitment])
|
||||
|
||||
fullProof = await generateProof(identity, group.generateMerkleProof(2), externalNullifier, signal, {
|
||||
wasmFilePath,
|
||||
@@ -104,47 +96,35 @@ describe("Proof", () => {
|
||||
it("Should hash the signal value correctly", async () => {
|
||||
const signalHash = hash(signal)
|
||||
|
||||
expect(signalHash.toString()).toBe(
|
||||
"8665846418922331996225934941481656421248110469944536651334918563951783029"
|
||||
)
|
||||
expect(signalHash).toBe("8665846418922331996225934941481656421248110469944536651334918563951783029")
|
||||
})
|
||||
|
||||
it("Should hash the external nullifier value correctly", async () => {
|
||||
const externalNullifierHash = hash(externalNullifier)
|
||||
|
||||
expect(externalNullifierHash.toString()).toBe(
|
||||
expect(externalNullifierHash).toBe(
|
||||
"244178201824278269437519042830883072613014992408751798420801126401127326826"
|
||||
)
|
||||
})
|
||||
|
||||
it("Should hash a number", async () => {
|
||||
expect(hash(2).toString()).toBe(
|
||||
"113682330006535319932160121224458771213356533826860247409332700812532759386"
|
||||
)
|
||||
expect(hash(2)).toBe("113682330006535319932160121224458771213356533826860247409332700812532759386")
|
||||
})
|
||||
|
||||
it("Should hash a big number", async () => {
|
||||
expect(hash(BigInt(2)).toString()).toBe(
|
||||
"113682330006535319932160121224458771213356533826860247409332700812532759386"
|
||||
)
|
||||
expect(hash(BigInt(2))).toBe("113682330006535319932160121224458771213356533826860247409332700812532759386")
|
||||
})
|
||||
|
||||
it("Should hash an hex number", async () => {
|
||||
expect(hash("0x2").toString()).toBe(
|
||||
"113682330006535319932160121224458771213356533826860247409332700812532759386"
|
||||
)
|
||||
expect(hash("0x2")).toBe("113682330006535319932160121224458771213356533826860247409332700812532759386")
|
||||
})
|
||||
|
||||
it("Should hash an string number", async () => {
|
||||
expect(hash("2").toString()).toBe(
|
||||
"113682330006535319932160121224458771213356533826860247409332700812532759386"
|
||||
)
|
||||
expect(hash("2")).toBe("113682330006535319932160121224458771213356533826860247409332700812532759386")
|
||||
})
|
||||
|
||||
it("Should hash an array", async () => {
|
||||
expect(hash([2]).toString()).toBe(
|
||||
"113682330006535319932160121224458771213356533826860247409332700812532759386"
|
||||
)
|
||||
expect(hash([2])).toBe("113682330006535319932160121224458771213356533826860247409332700812532759386")
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import calculateNullifierHash from "./calculateNullifierHash"
|
||||
import generateProof from "./generateProof"
|
||||
import verifyProof from "./verifyProof"
|
||||
import calculateNullifierHash from "./calculateNullifierHash"
|
||||
|
||||
export { generateProof, verifyProof, calculateNullifierHash }
|
||||
export { MerkleProof } from "@zk-kit/incremental-merkle-tree"
|
||||
export * from "./types"
|
||||
export { generateProof, verifyProof, calculateNullifierHash }
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
import { SnarkJSProof, Proof } from "./types"
|
||||
import { Groth16Proof } from "snarkjs"
|
||||
import { PackedProof } from "./types"
|
||||
|
||||
/**
|
||||
* Packs a proof into a format compatible with Semaphore.
|
||||
* @param originalProof The proof generated with SnarkJS.
|
||||
* @param proof The Groth16 proof generated with SnarkJS.
|
||||
* @returns The proof compatible with Semaphore.
|
||||
*/
|
||||
export default function packProof(originalProof: SnarkJSProof): Proof {
|
||||
export default function packProof(proof: Groth16Proof): PackedProof {
|
||||
return [
|
||||
originalProof.pi_a[0],
|
||||
originalProof.pi_a[1],
|
||||
originalProof.pi_b[0][1],
|
||||
originalProof.pi_b[0][0],
|
||||
originalProof.pi_b[1][1],
|
||||
originalProof.pi_b[1][0],
|
||||
originalProof.pi_c[0],
|
||||
originalProof.pi_c[1]
|
||||
proof.pi_a[0],
|
||||
proof.pi_a[1],
|
||||
proof.pi_b[0][1],
|
||||
proof.pi_b[0][0],
|
||||
proof.pi_b[1][1],
|
||||
proof.pi_b[1][0],
|
||||
proof.pi_c[0],
|
||||
proof.pi_c[1]
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,33 +1,25 @@
|
||||
export type BigNumberish = string | bigint
|
||||
import type { NumericString } from "snarkjs"
|
||||
|
||||
export type SnarkArtifacts = {
|
||||
wasmFilePath: string
|
||||
zkeyFilePath: string
|
||||
}
|
||||
|
||||
export type SnarkJSProof = {
|
||||
pi_a: BigNumberish[]
|
||||
pi_b: BigNumberish[][]
|
||||
pi_c: BigNumberish[]
|
||||
protocol: string
|
||||
curve: string
|
||||
export type SemaphoreProof = {
|
||||
merkleTreeRoot: NumericString
|
||||
signal: NumericString
|
||||
nullifierHash: NumericString
|
||||
externalNullifier: NumericString
|
||||
proof: PackedProof
|
||||
}
|
||||
|
||||
export type FullProof = {
|
||||
merkleTreeRoot: BigNumberish
|
||||
signal: BigNumberish
|
||||
nullifierHash: BigNumberish
|
||||
externalNullifier: BigNumberish
|
||||
proof: Proof
|
||||
}
|
||||
|
||||
export type Proof = [
|
||||
BigNumberish,
|
||||
BigNumberish,
|
||||
BigNumberish,
|
||||
BigNumberish,
|
||||
BigNumberish,
|
||||
BigNumberish,
|
||||
BigNumberish,
|
||||
BigNumberish
|
||||
export type PackedProof = [
|
||||
NumericString,
|
||||
NumericString,
|
||||
NumericString,
|
||||
NumericString,
|
||||
NumericString,
|
||||
NumericString,
|
||||
NumericString,
|
||||
NumericString
|
||||
]
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { SnarkJSProof, Proof } from "./types"
|
||||
import { Groth16Proof } from "snarkjs"
|
||||
import { PackedProof } from "./types"
|
||||
|
||||
/**
|
||||
* Unpacks a proof into its original form.
|
||||
* @param proof The proof compatible with Semaphore.
|
||||
* @returns The proof compatible with SnarkJS.
|
||||
*/
|
||||
export default function unpackProof(proof: Proof): SnarkJSProof {
|
||||
export default function unpackProof(proof: PackedProof): Groth16Proof {
|
||||
return {
|
||||
pi_a: [proof[0], proof[1]],
|
||||
pi_b: [
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { groth16 } from "snarkjs"
|
||||
import { verify } from "@zk-kit/groth16"
|
||||
import hash from "./hash"
|
||||
import { FullProof } from "./types"
|
||||
import { SemaphoreProof } from "./types"
|
||||
import unpackProof from "./unpackProof"
|
||||
import verificationKeys from "./verificationKeys.json"
|
||||
|
||||
@@ -11,7 +11,7 @@ import verificationKeys from "./verificationKeys.json"
|
||||
* @returns True if the proof is valid, false otherwise.
|
||||
*/
|
||||
export default function verifyProof(
|
||||
{ merkleTreeRoot, nullifierHash, externalNullifier, signal, proof }: FullProof,
|
||||
{ merkleTreeRoot, nullifierHash, externalNullifier, signal, proof }: SemaphoreProof,
|
||||
treeDepth: number
|
||||
): Promise<boolean> {
|
||||
if (treeDepth < 16 || treeDepth > 32) {
|
||||
@@ -24,9 +24,8 @@ export default function verifyProof(
|
||||
IC: verificationKeys.IC[treeDepth - 16]
|
||||
}
|
||||
|
||||
return groth16.verify(
|
||||
verificationKey,
|
||||
[merkleTreeRoot, nullifierHash, hash(signal), hash(externalNullifier)],
|
||||
unpackProof(proof)
|
||||
)
|
||||
return verify(verificationKey, {
|
||||
publicSignals: [merkleTreeRoot, nullifierHash, hash(signal), hash(externalNullifier)],
|
||||
proof: unpackProof(proof)
|
||||
})
|
||||
}
|
||||
|
||||
3
packages/proof/typedoc.json
Normal file
3
packages/proof/typedoc.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"entryPoints": ["src/index.ts"]
|
||||
}
|
||||
@@ -4,9 +4,9 @@
|
||||
"tagline": "Semaphore explorer for on-chain groups.",
|
||||
"icon": "",
|
||||
"links": {
|
||||
"website": "https://community.semaphore.appliedzkp.org/semaphore-explorer",
|
||||
"website": "https://community.semaphore.pse.dev/semaphore-explorer",
|
||||
"github": "https://github.com/semaphore-protocol/explorer",
|
||||
"discord": "https://semaphore.appliedzkp.org/discord"
|
||||
"discord": "https://semaphore.pse.dev/discord"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -16,7 +16,7 @@
|
||||
"links": {
|
||||
"website": "https://discord.com/api/oauth2/authorize?client_id=1082429985496772628&permissions=1024&scope=bot",
|
||||
"github": "https://github.com/semaphore-protocol/discord-bot",
|
||||
"discord": "https://semaphore.appliedzkp.org/discord"
|
||||
"discord": "https://semaphore.pse.dev/discord"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -31,7 +31,7 @@
|
||||
},
|
||||
{
|
||||
"name": "Plurality",
|
||||
"tagline": " An Identity Lego Building Block for dapp creators that lets them identify their users without using any third-party KYC provider or other middlemen, whilst preserving the privacy of users.",
|
||||
"tagline": "An Identity Lego Building Block for dapp creators that lets them identify their users without using any third-party KYC provider or other middlemen, whilst preserving the privacy of users.",
|
||||
"icon": "",
|
||||
"links": {
|
||||
"github": "https://github.com/Web3-Plurality"
|
||||
@@ -39,7 +39,7 @@
|
||||
},
|
||||
{
|
||||
"name": "ZK Proof of Humanity",
|
||||
"tagline": "A project to allows humans, registered in Proof of Humanity, to prove their humanity without doxing.",
|
||||
"tagline": "A project that allows humans, registered in Proof of Humanity, to prove their humanity without doxing.",
|
||||
"icon": "",
|
||||
"links": {
|
||||
"website": "https://zk-proof-of-humanity.vercel.app",
|
||||
@@ -63,5 +63,14 @@
|
||||
"website": "https://bq2.netlify.app/",
|
||||
"github": "https://github.com/0xdeenz/bq2"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "StealthComms",
|
||||
"tagline": "A project that allows users to prove their membership in a group and send messages/signals without revealing their original identity.",
|
||||
"icon": "",
|
||||
"links": {
|
||||
"website": "https://stealthcomms.surge.sh/",
|
||||
"github": "https://github.com/atomniketh/zk-app"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
6
typedoc.json
Normal file
6
typedoc.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"entryPoints": ["packages/*"],
|
||||
"name": "Semaphore SDK",
|
||||
"entryPointStrategy": "packages",
|
||||
"exclude": ["**/cli-template*", "**/circuits", "**/contracts", "**/hardhat", "**/cli"]
|
||||
}
|
||||
895
types/circomlibjs/index.d.ts
vendored
895
types/circomlibjs/index.d.ts
vendored
@@ -1,895 +0,0 @@
|
||||
/** Declaration file generated by dts-gen */
|
||||
|
||||
declare module "circomlibjs" {
|
||||
export class evmasm {
|
||||
constructor(...args: any[])
|
||||
|
||||
add(...args: any[]): void
|
||||
|
||||
addmod(...args: any[]): void
|
||||
|
||||
address(...args: any[]): void
|
||||
|
||||
and(...args: any[]): void
|
||||
|
||||
balance(...args: any[]): void
|
||||
|
||||
blockhash(...args: any[]): void
|
||||
|
||||
byte(...args: any[]): void
|
||||
|
||||
call(...args: any[]): void
|
||||
|
||||
callcode(...args: any[]): void
|
||||
|
||||
calldatacopy(...args: any[]): void
|
||||
|
||||
calldataload(...args: any[]): void
|
||||
|
||||
calldatasize(...args: any[]): void
|
||||
|
||||
caller(...args: any[]): void
|
||||
|
||||
callvalue(...args: any[]): void
|
||||
|
||||
codecopy(...args: any[]): void
|
||||
|
||||
codesize(...args: any[]): void
|
||||
|
||||
coinbase(...args: any[]): void
|
||||
|
||||
create(...args: any[]): void
|
||||
|
||||
createTxData(...args: any[]): void
|
||||
|
||||
delegatecall(...args: any[]): void
|
||||
|
||||
difficulty(...args: any[]): void
|
||||
|
||||
div(...args: any[]): void
|
||||
|
||||
dup(...args: any[]): void
|
||||
|
||||
eq(...args: any[]): void
|
||||
|
||||
exp(...args: any[]): void
|
||||
|
||||
extcodecopy(...args: any[]): void
|
||||
|
||||
extcodesize(...args: any[]): void
|
||||
|
||||
gas(...args: any[]): void
|
||||
|
||||
gaslimit(...args: any[]): void
|
||||
|
||||
gasprice(...args: any[]): void
|
||||
|
||||
gt(...args: any[]): void
|
||||
|
||||
invalid(...args: any[]): void
|
||||
|
||||
iszero(...args: any[]): void
|
||||
|
||||
jmp(...args: any[]): void
|
||||
|
||||
jmpi(...args: any[]): void
|
||||
|
||||
keccak(...args: any[]): void
|
||||
|
||||
label(...args: any[]): void
|
||||
|
||||
log0(...args: any[]): void
|
||||
|
||||
log1(...args: any[]): void
|
||||
|
||||
log2(...args: any[]): void
|
||||
|
||||
log3(...args: any[]): void
|
||||
|
||||
log4(...args: any[]): void
|
||||
|
||||
lt(...args: any[]): void
|
||||
|
||||
mload(...args: any[]): void
|
||||
|
||||
mod(...args: any[]): void
|
||||
|
||||
msize(...args: any[]): void
|
||||
|
||||
mstore(...args: any[]): void
|
||||
|
||||
mstore8(...args: any[]): void
|
||||
|
||||
mul(...args: any[]): void
|
||||
|
||||
mulmod(...args: any[]): void
|
||||
|
||||
not(...args: any[]): void
|
||||
|
||||
number(...args: any[]): void
|
||||
|
||||
or(...args: any[]): void
|
||||
|
||||
origin(...args: any[]): void
|
||||
|
||||
pc(...args: any[]): void
|
||||
|
||||
pop(...args: any[]): void
|
||||
|
||||
push(...args: any[]): void
|
||||
|
||||
return(...args: any[]): void
|
||||
|
||||
returndatacopy(...args: any[]): void
|
||||
|
||||
returndatasize(...args: any[]): void
|
||||
|
||||
revert(...args: any[]): void
|
||||
|
||||
sdiv(...args: any[]): void
|
||||
|
||||
selfdestruct(...args: any[]): void
|
||||
|
||||
sgt(...args: any[]): void
|
||||
|
||||
sha3(...args: any[]): void
|
||||
|
||||
shor(...args: any[]): void
|
||||
|
||||
signextend(...args: any[]): void
|
||||
|
||||
sload(...args: any[]): void
|
||||
|
||||
slt(...args: any[]): void
|
||||
|
||||
smod(...args: any[]): void
|
||||
|
||||
sstore(...args: any[]): void
|
||||
|
||||
staticcall(...args: any[]): void
|
||||
|
||||
stop(...args: any[]): void
|
||||
|
||||
sub(...args: any[]): void
|
||||
|
||||
swap(...args: any[]): void
|
||||
|
||||
timestamp(...args: any[]): void
|
||||
}
|
||||
|
||||
export class smt_memdb {
|
||||
constructor(...args: any[])
|
||||
|
||||
get(...args: any[]): void
|
||||
|
||||
getRoot(...args: any[]): void
|
||||
|
||||
multiDel(...args: any[]): void
|
||||
|
||||
multiGet(...args: any[]): void
|
||||
|
||||
multiIns(...args: any[]): void
|
||||
|
||||
setRoot(...args: any[]): void
|
||||
}
|
||||
|
||||
export function poseidon(inputs: any): any
|
||||
|
||||
export function poseidon_slow(inputs: any): any
|
||||
|
||||
export namespace babyjub {
|
||||
const A: any
|
||||
|
||||
const Base8: any[]
|
||||
|
||||
const D: any
|
||||
|
||||
const Generator: any[]
|
||||
|
||||
const order: any
|
||||
|
||||
const p: any
|
||||
|
||||
const subOrder: any
|
||||
|
||||
function addPoint(a: any, b: any): any
|
||||
|
||||
function inCurve(P: any): any
|
||||
|
||||
function inSubgroup(P: any): any
|
||||
|
||||
function mulPointEscalar(base: any, e: any): any
|
||||
|
||||
function packPoint(P: any): any
|
||||
|
||||
function unpackPoint(_buff: any): any
|
||||
|
||||
namespace F {
|
||||
const R: any
|
||||
|
||||
const Ri: any
|
||||
|
||||
const bitLength: number
|
||||
|
||||
const half: any
|
||||
|
||||
const m: number
|
||||
|
||||
const mask: any
|
||||
|
||||
const n32: number
|
||||
|
||||
const n64: number
|
||||
|
||||
const n8: number
|
||||
|
||||
const negone: any
|
||||
|
||||
const nqr: any
|
||||
|
||||
const nqr_to_t: any
|
||||
|
||||
const one: any
|
||||
|
||||
const p: any
|
||||
|
||||
const s: number
|
||||
|
||||
const sqrt_q: any
|
||||
|
||||
const sqrt_s: number
|
||||
|
||||
const sqrt_t: any
|
||||
|
||||
const sqrt_tm1d2: any
|
||||
|
||||
const sqrt_z: any
|
||||
|
||||
const t: any
|
||||
|
||||
const two: any
|
||||
|
||||
const type: string
|
||||
|
||||
const zero: any
|
||||
|
||||
function add(...args: any[]): void
|
||||
|
||||
function band(...args: any[]): void
|
||||
|
||||
function bnot(...args: any[]): void
|
||||
|
||||
function bor(...args: any[]): void
|
||||
|
||||
function bxor(...args: any[]): void
|
||||
|
||||
function div(...args: any[]): void
|
||||
|
||||
function e(...args: any[]): void
|
||||
|
||||
function eq(...args: any[]): void
|
||||
|
||||
function exp(...args: any[]): void
|
||||
|
||||
function fromRng(...args: any[]): void
|
||||
|
||||
function fromRprBE(...args: any[]): void
|
||||
|
||||
function fromRprBEM(...args: any[]): void
|
||||
|
||||
function fromRprLE(...args: any[]): void
|
||||
|
||||
function fromRprLEM(...args: any[]): void
|
||||
|
||||
function geq(...args: any[]): void
|
||||
|
||||
function gt(...args: any[]): void
|
||||
|
||||
function idiv(...args: any[]): void
|
||||
|
||||
function inv(...args: any[]): void
|
||||
|
||||
function isZero(...args: any[]): void
|
||||
|
||||
function land(...args: any[]): void
|
||||
|
||||
function leq(...args: any[]): void
|
||||
|
||||
function lnot(...args: any[]): void
|
||||
|
||||
function lor(...args: any[]): void
|
||||
|
||||
function lt(...args: any[]): void
|
||||
|
||||
function mod(...args: any[]): void
|
||||
|
||||
function mul(...args: any[]): void
|
||||
|
||||
function mulScalar(...args: any[]): void
|
||||
|
||||
function neg(...args: any[]): void
|
||||
|
||||
function neq(...args: any[]): void
|
||||
|
||||
function normalize(...args: any[]): void
|
||||
|
||||
function pow(...args: any[]): void
|
||||
|
||||
function random(...args: any[]): void
|
||||
|
||||
function shl(...args: any[]): void
|
||||
|
||||
function shr(...args: any[]): void
|
||||
|
||||
function sqrt(a: any): any
|
||||
|
||||
function sqrt_old(...args: any[]): void
|
||||
|
||||
function square(...args: any[]): void
|
||||
|
||||
function sub(...args: any[]): void
|
||||
|
||||
function toRprBE(...args: any[]): void
|
||||
|
||||
function toRprBEM(...args: any[]): void
|
||||
|
||||
function toRprLE(...args: any[]): void
|
||||
|
||||
function toRprLEM(...args: any[]): void
|
||||
|
||||
function toString(...args: any[]): void
|
||||
}
|
||||
}
|
||||
|
||||
export namespace eddsa {
|
||||
function packSignature(sig: any): any
|
||||
|
||||
function pruneBuffer(_buff: any): any
|
||||
|
||||
function prv2pub(prv: any): any
|
||||
|
||||
function sign(prv: any, msg: any): any
|
||||
|
||||
function signMiMC(prv: any, msg: any): any
|
||||
|
||||
function signMiMCSponge(prv: any, msg: any): any
|
||||
|
||||
function signPoseidon(prv: any, msg: any): any
|
||||
|
||||
function unpackSignature(sigBuff: any): any
|
||||
|
||||
function verify(msg: any, sig: any, A: any): any
|
||||
|
||||
function verifyMiMC(msg: any, sig: any, A: any): any
|
||||
|
||||
function verifyMiMCSponge(msg: any, sig: any, A: any): any
|
||||
|
||||
function verifyPoseidon(msg: any, sig: any, A: any): any
|
||||
}
|
||||
|
||||
export namespace mimc7 {
|
||||
function getConstants(seed: any, nRounds: any): any
|
||||
|
||||
function getIV(seed: any): any
|
||||
|
||||
function hash(_x_in: any, _k: any): any
|
||||
|
||||
function multiHash(arr: any, key: any): any
|
||||
|
||||
namespace F {
|
||||
const R: any
|
||||
|
||||
const Ri: any
|
||||
|
||||
const bitLength: number
|
||||
|
||||
const half: any
|
||||
|
||||
const m: number
|
||||
|
||||
const mask: any
|
||||
|
||||
const n32: number
|
||||
|
||||
const n64: number
|
||||
|
||||
const n8: number
|
||||
|
||||
const negone: any
|
||||
|
||||
const nqr: any
|
||||
|
||||
const nqr_to_t: any
|
||||
|
||||
const one: any
|
||||
|
||||
const p: any
|
||||
|
||||
const s: number
|
||||
|
||||
const sqrt_q: any
|
||||
|
||||
const sqrt_s: number
|
||||
|
||||
const sqrt_t: any
|
||||
|
||||
const sqrt_tm1d2: any
|
||||
|
||||
const sqrt_z: any
|
||||
|
||||
const t: any
|
||||
|
||||
const two: any
|
||||
|
||||
const type: string
|
||||
|
||||
const zero: any
|
||||
|
||||
function add(...args: any[]): void
|
||||
|
||||
function band(...args: any[]): void
|
||||
|
||||
function bnot(...args: any[]): void
|
||||
|
||||
function bor(...args: any[]): void
|
||||
|
||||
function bxor(...args: any[]): void
|
||||
|
||||
function div(...args: any[]): void
|
||||
|
||||
function e(...args: any[]): void
|
||||
|
||||
function eq(...args: any[]): void
|
||||
|
||||
function exp(...args: any[]): void
|
||||
|
||||
function fromRng(...args: any[]): void
|
||||
|
||||
function fromRprBE(...args: any[]): void
|
||||
|
||||
function fromRprBEM(...args: any[]): void
|
||||
|
||||
function fromRprLE(...args: any[]): void
|
||||
|
||||
function fromRprLEM(...args: any[]): void
|
||||
|
||||
function geq(...args: any[]): void
|
||||
|
||||
function gt(...args: any[]): void
|
||||
|
||||
function idiv(...args: any[]): void
|
||||
|
||||
function inv(...args: any[]): void
|
||||
|
||||
function isZero(...args: any[]): void
|
||||
|
||||
function land(...args: any[]): void
|
||||
|
||||
function leq(...args: any[]): void
|
||||
|
||||
function lnot(...args: any[]): void
|
||||
|
||||
function lor(...args: any[]): void
|
||||
|
||||
function lt(...args: any[]): void
|
||||
|
||||
function mod(...args: any[]): void
|
||||
|
||||
function mul(...args: any[]): void
|
||||
|
||||
function mulScalar(...args: any[]): void
|
||||
|
||||
function neg(...args: any[]): void
|
||||
|
||||
function neq(...args: any[]): void
|
||||
|
||||
function normalize(...args: any[]): void
|
||||
|
||||
function pow(...args: any[]): void
|
||||
|
||||
function random(...args: any[]): void
|
||||
|
||||
function shl(...args: any[]): void
|
||||
|
||||
function shr(...args: any[]): void
|
||||
|
||||
function sqrt(a: any): any
|
||||
|
||||
function sqrt_old(...args: any[]): void
|
||||
|
||||
function square(...args: any[]): void
|
||||
|
||||
function sub(...args: any[]): void
|
||||
|
||||
function toRprBE(...args: any[]): void
|
||||
|
||||
function toRprBEM(...args: any[]): void
|
||||
|
||||
function toRprLE(...args: any[]): void
|
||||
|
||||
function toRprLEM(...args: any[]): void
|
||||
|
||||
function toString(...args: any[]): void
|
||||
}
|
||||
}
|
||||
|
||||
export namespace mimc_gencontract {
|
||||
const abi: {
|
||||
constant: boolean
|
||||
inputs: {
|
||||
name: string
|
||||
type: string
|
||||
}[]
|
||||
name: string
|
||||
outputs: {
|
||||
name: string
|
||||
type: string
|
||||
}[]
|
||||
payable: boolean
|
||||
stateMutability: string
|
||||
type: string
|
||||
}[]
|
||||
|
||||
function createCode(seed: any, n: any): any
|
||||
}
|
||||
|
||||
export namespace mimcsponge {
|
||||
function getConstants(seed: any, nRounds: any): any
|
||||
|
||||
function getIV(seed: any): any
|
||||
|
||||
function hash(_xL_in: any, _xR_in: any, _k: any): any
|
||||
|
||||
function multiHash(arr: any, key: any, numOutputs: any): any
|
||||
}
|
||||
|
||||
export namespace mimcsponge_gencontract {
|
||||
const abi: {
|
||||
constant: boolean
|
||||
inputs: {
|
||||
name: string
|
||||
type: string
|
||||
}[]
|
||||
name: string
|
||||
outputs: {
|
||||
name: string
|
||||
type: string
|
||||
}[]
|
||||
payable: boolean
|
||||
stateMutability: string
|
||||
type: string
|
||||
}[]
|
||||
|
||||
function createCode(seed: any, n: any): any
|
||||
}
|
||||
|
||||
export namespace pedersenHash {
|
||||
function getBasePoint(baseHashType: any, pointIdx: any): any
|
||||
|
||||
function hash(msg: any, options: any): any
|
||||
}
|
||||
|
||||
export namespace poseidon_gencontract {
|
||||
function createCode(nInputs: any): any
|
||||
|
||||
function generateABI(nInputs: any): any
|
||||
}
|
||||
|
||||
export namespace smt {
|
||||
class SMT {
|
||||
constructor(...args: any[])
|
||||
|
||||
delete(...args: any[]): void
|
||||
|
||||
find(...args: any[]): void
|
||||
|
||||
insert(...args: any[]): void
|
||||
|
||||
update(...args: any[]): void
|
||||
}
|
||||
|
||||
class SMTMemDB {
|
||||
constructor(...args: any[])
|
||||
|
||||
get(...args: any[]): void
|
||||
|
||||
getRoot(...args: any[]): void
|
||||
|
||||
multiDel(...args: any[]): void
|
||||
|
||||
multiGet(...args: any[]): void
|
||||
|
||||
multiIns(...args: any[]): void
|
||||
|
||||
setRoot(...args: any[]): void
|
||||
}
|
||||
|
||||
function loadFromFile(fileName: any): void
|
||||
|
||||
function newMemEmptyTrie(): any
|
||||
}
|
||||
|
||||
export namespace smt_hashes_mimc {
|
||||
function hash0(left: any, right: any): any
|
||||
|
||||
function hash1(key: any, value: any): any
|
||||
|
||||
namespace F {
|
||||
const R: any
|
||||
|
||||
const Ri: any
|
||||
|
||||
const bitLength: number
|
||||
|
||||
const half: any
|
||||
|
||||
const m: number
|
||||
|
||||
const mask: any
|
||||
|
||||
const n32: number
|
||||
|
||||
const n64: number
|
||||
|
||||
const n8: number
|
||||
|
||||
const negone: any
|
||||
|
||||
const nqr: any
|
||||
|
||||
const nqr_to_t: any
|
||||
|
||||
const one: any
|
||||
|
||||
const p: any
|
||||
|
||||
const s: number
|
||||
|
||||
const sqrt_q: any
|
||||
|
||||
const sqrt_s: number
|
||||
|
||||
const sqrt_t: any
|
||||
|
||||
const sqrt_tm1d2: any
|
||||
|
||||
const sqrt_z: any
|
||||
|
||||
const t: any
|
||||
|
||||
const two: any
|
||||
|
||||
const type: string
|
||||
|
||||
const zero: any
|
||||
|
||||
function add(...args: any[]): void
|
||||
|
||||
function band(...args: any[]): void
|
||||
|
||||
function bnot(...args: any[]): void
|
||||
|
||||
function bor(...args: any[]): void
|
||||
|
||||
function bxor(...args: any[]): void
|
||||
|
||||
function div(...args: any[]): void
|
||||
|
||||
function e(...args: any[]): void
|
||||
|
||||
function eq(...args: any[]): void
|
||||
|
||||
function exp(...args: any[]): void
|
||||
|
||||
function fromRng(...args: any[]): void
|
||||
|
||||
function fromRprBE(...args: any[]): void
|
||||
|
||||
function fromRprBEM(...args: any[]): void
|
||||
|
||||
function fromRprLE(...args: any[]): void
|
||||
|
||||
function fromRprLEM(...args: any[]): void
|
||||
|
||||
function geq(...args: any[]): void
|
||||
|
||||
function gt(...args: any[]): void
|
||||
|
||||
function idiv(...args: any[]): void
|
||||
|
||||
function inv(...args: any[]): void
|
||||
|
||||
function isZero(...args: any[]): void
|
||||
|
||||
function land(...args: any[]): void
|
||||
|
||||
function leq(...args: any[]): void
|
||||
|
||||
function lnot(...args: any[]): void
|
||||
|
||||
function lor(...args: any[]): void
|
||||
|
||||
function lt(...args: any[]): void
|
||||
|
||||
function mod(...args: any[]): void
|
||||
|
||||
function mul(...args: any[]): void
|
||||
|
||||
function mulScalar(...args: any[]): void
|
||||
|
||||
function neg(...args: any[]): void
|
||||
|
||||
function neq(...args: any[]): void
|
||||
|
||||
function normalize(...args: any[]): void
|
||||
|
||||
function pow(...args: any[]): void
|
||||
|
||||
function random(...args: any[]): void
|
||||
|
||||
function shl(...args: any[]): void
|
||||
|
||||
function shr(...args: any[]): void
|
||||
|
||||
function sqrt(a: any): any
|
||||
|
||||
function sqrt_old(...args: any[]): void
|
||||
|
||||
function square(...args: any[]): void
|
||||
|
||||
function sub(...args: any[]): void
|
||||
|
||||
function toRprBE(...args: any[]): void
|
||||
|
||||
function toRprBEM(...args: any[]): void
|
||||
|
||||
function toRprLE(...args: any[]): void
|
||||
|
||||
function toRprLEM(...args: any[]): void
|
||||
|
||||
function toString(...args: any[]): void
|
||||
}
|
||||
}
|
||||
|
||||
export namespace smt_hashes_poseidon {
|
||||
function hash0(left: any, right: any): any
|
||||
|
||||
function hash1(key: any, value: any): any
|
||||
|
||||
namespace F {
|
||||
const R: any
|
||||
|
||||
const Ri: any
|
||||
|
||||
const bitLength: number
|
||||
|
||||
const half: any
|
||||
|
||||
const m: number
|
||||
|
||||
const mask: any
|
||||
|
||||
const n32: number
|
||||
|
||||
const n64: number
|
||||
|
||||
const n8: number
|
||||
|
||||
const negone: any
|
||||
|
||||
const nqr: any
|
||||
|
||||
const nqr_to_t: any
|
||||
|
||||
const one: any
|
||||
|
||||
const p: any
|
||||
|
||||
const s: number
|
||||
|
||||
const sqrt_q: any
|
||||
|
||||
const sqrt_s: number
|
||||
|
||||
const sqrt_t: any
|
||||
|
||||
const sqrt_tm1d2: any
|
||||
|
||||
const sqrt_z: any
|
||||
|
||||
const t: any
|
||||
|
||||
const two: any
|
||||
|
||||
const type: string
|
||||
|
||||
const zero: any
|
||||
|
||||
function add(...args: any[]): void
|
||||
|
||||
function band(...args: any[]): void
|
||||
|
||||
function bnot(...args: any[]): void
|
||||
|
||||
function bor(...args: any[]): void
|
||||
|
||||
function bxor(...args: any[]): void
|
||||
|
||||
function div(...args: any[]): void
|
||||
|
||||
function e(...args: any[]): void
|
||||
|
||||
function eq(...args: any[]): void
|
||||
|
||||
function exp(...args: any[]): void
|
||||
|
||||
function fromRng(...args: any[]): void
|
||||
|
||||
function fromRprBE(...args: any[]): void
|
||||
|
||||
function fromRprBEM(...args: any[]): void
|
||||
|
||||
function fromRprLE(...args: any[]): void
|
||||
|
||||
function fromRprLEM(...args: any[]): void
|
||||
|
||||
function geq(...args: any[]): void
|
||||
|
||||
function gt(...args: any[]): void
|
||||
|
||||
function idiv(...args: any[]): void
|
||||
|
||||
function inv(...args: any[]): void
|
||||
|
||||
function isZero(...args: any[]): void
|
||||
|
||||
function land(...args: any[]): void
|
||||
|
||||
function leq(...args: any[]): void
|
||||
|
||||
function lnot(...args: any[]): void
|
||||
|
||||
function lor(...args: any[]): void
|
||||
|
||||
function lt(...args: any[]): void
|
||||
|
||||
function mod(...args: any[]): void
|
||||
|
||||
function mul(...args: any[]): void
|
||||
|
||||
function mulScalar(...args: any[]): void
|
||||
|
||||
function neg(...args: any[]): void
|
||||
|
||||
function neq(...args: any[]): void
|
||||
|
||||
function normalize(...args: any[]): void
|
||||
|
||||
function pow(...args: any[]): void
|
||||
|
||||
function random(...args: any[]): void
|
||||
|
||||
function shl(...args: any[]): void
|
||||
|
||||
function shr(...args: any[]): void
|
||||
|
||||
function sqrt(a: any): any
|
||||
|
||||
function sqrt_old(...args: any[]): void
|
||||
|
||||
function square(...args: any[]): void
|
||||
|
||||
function sub(...args: any[]): void
|
||||
|
||||
function toRprBE(...args: any[]): void
|
||||
|
||||
function toRprBEM(...args: any[]): void
|
||||
|
||||
function toRprLE(...args: any[]): void
|
||||
|
||||
function toRprLEM(...args: any[]): void
|
||||
|
||||
function toString(...args: any[]): void
|
||||
}
|
||||
}
|
||||
}
|
||||
57
types/snarkjs/index.d.ts
vendored
57
types/snarkjs/index.d.ts
vendored
@@ -1,57 +0,0 @@
|
||||
/** Declaration file generated by dts-gen */
|
||||
|
||||
declare module "snarkjs" {
|
||||
export = snarkjs
|
||||
|
||||
declare const snarkjs: {
|
||||
groth16: {
|
||||
exportSolidityCallData: any
|
||||
fullProve: any
|
||||
prove: any
|
||||
verify: any
|
||||
}
|
||||
plonk: {
|
||||
exportSolidityCallData: any
|
||||
fullProve: any
|
||||
prove: any
|
||||
setup: any
|
||||
verify: any
|
||||
}
|
||||
powersOfTau: {
|
||||
beacon: any
|
||||
challengeContribute: any
|
||||
contribute: any
|
||||
convert: any
|
||||
exportChallenge: any
|
||||
exportJson: any
|
||||
importResponse: any
|
||||
newAccumulator: any
|
||||
preparePhase2: any
|
||||
truncate: any
|
||||
verify: any
|
||||
}
|
||||
r1cs: {
|
||||
exportJson: any
|
||||
info: any
|
||||
print: any
|
||||
}
|
||||
wtns: {
|
||||
calculate: any
|
||||
debug: any
|
||||
exportJson: any
|
||||
}
|
||||
zKey: {
|
||||
beacon: any
|
||||
bellmanContribute: any
|
||||
contribute: any
|
||||
exportBellman: any
|
||||
exportJson: any
|
||||
exportSolidityVerifier: any
|
||||
exportVerificationKey: any
|
||||
importBellman: any
|
||||
newZKey: any
|
||||
verifyFromInit: any
|
||||
verifyFromR1cs: any
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
41a594b655244878cf24a7d982a9f8c3bc0988c2
|
||||
6080ca0da13bd94e110c7e2e1f173c111d19a4aa
|
||||
Reference in New Issue
Block a user