mirror of
https://github.com/semaphore-protocol/semaphore.git
synced 2026-01-11 07:38:14 -05:00
Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7bcc44c645 | ||
|
|
0ac390eaf0 | ||
|
|
5db4c61c28 | ||
|
|
37dc17d880 | ||
|
|
a04057f861 | ||
|
|
29e8f5852f | ||
|
|
26c76f453e | ||
|
|
9a1a1e7853 | ||
|
|
f583caa243 | ||
|
|
b399b923ab | ||
|
|
65e5d29dcd | ||
|
|
ba9782139e | ||
|
|
edef368976 | ||
|
|
77fddc9b16 | ||
|
|
69b2b8fd7b | ||
|
|
aba7d51f86 | ||
|
|
32d1b47964 | ||
|
|
cb3ff0fcb8 | ||
|
|
4d4338d3bc | ||
|
|
536410457e | ||
|
|
7469086a2a | ||
|
|
3496aa6478 | ||
|
|
60d5110905 | ||
|
|
0da64796ea | ||
|
|
41ab36d24c |
1
.github/ISSUE_TEMPLATE/----project.md
vendored
1
.github/ISSUE_TEMPLATE/----project.md
vendored
@@ -13,6 +13,7 @@ A brief description of your project. In what way have you used Semaphore?
|
||||
**Other info**
|
||||
|
||||
- Name
|
||||
- Tagline
|
||||
- Icon
|
||||
|
||||
**Links**
|
||||
|
||||
1
.github/workflows/docs.yml
vendored
1
.github/workflows/docs.yml
vendored
@@ -41,5 +41,6 @@ jobs:
|
||||
with:
|
||||
build_dir: docs
|
||||
jekyll: false
|
||||
fqdn: js.semaphore.appliedzkp.org
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
135
README.md
135
README.md
@@ -63,8 +63,6 @@
|
||||
|
||||
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).
|
||||
|
||||
---
|
||||
|
||||
## 📦 Packages
|
||||
|
||||
<table>
|
||||
@@ -96,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://semaphore-protocol.github.io/semaphore/identity">
|
||||
<a href="https://js.semaphore.appliedzkp.org/identity">
|
||||
(docs)
|
||||
</a>
|
||||
</td>
|
||||
@@ -118,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://semaphore-protocol.github.io/semaphore/group">
|
||||
<a href="https://js.semaphore.appliedzkp.org/group">
|
||||
(docs)
|
||||
</a>
|
||||
</td>
|
||||
@@ -140,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://semaphore-protocol.github.io/semaphore/proof">
|
||||
<a href="https://js.semaphore.appliedzkp.org/proof">
|
||||
(docs)
|
||||
</a>
|
||||
</td>
|
||||
@@ -162,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://semaphore-protocol.github.io/semaphore/data">
|
||||
<a href="https://js.semaphore.appliedzkp.org/data">
|
||||
(docs)
|
||||
</a>
|
||||
</td>
|
||||
@@ -222,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://semaphore-protocol.github.io/semaphore/heyauthn">
|
||||
<a href="https://js.semaphore.appliedzkp.org/heyauthn">
|
||||
(docs)
|
||||
</a>
|
||||
</td>
|
||||
@@ -240,7 +238,130 @@ The core of the Semaphore protocol is in the [circuit logic](/packages/circuits/
|
||||
</td>
|
||||
</tr>
|
||||
<tbody>
|
||||
</table>
|
||||
|
||||
## 💡 Projects
|
||||
|
||||
The following are some of the internal and external projects that use Semaphore. If you want to include your project, open an [issue](https://github.com/semaphore-protocol/semaphore/issues/new?assignees=&labels=documentation++%F0%9F%93%96&template=----project.md&title=) or create a PR by adding the project information to the `projects.json` file.
|
||||
|
||||
<table>
|
||||
<th>Project</th>
|
||||
<th>Description</th>
|
||||
<th>Links</th>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="https://explorer.semaphore.appliedzkp.org">
|
||||
Semaphore Explorer
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
Semaphore explorer for on-chain groups.
|
||||
</td>
|
||||
<td>
|
||||
<a href="https://github.com/semaphore-protocol/explorer">
|
||||
Github
|
||||
</a>|
|
||||
<a href="https://semaphore.appliedzkp.org/discord">
|
||||
Discord
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="https://discord.com/api/oauth2/authorize?client_id=1082429985496772628&permissions=1024&scope=bot">
|
||||
Semaphore Discord Bot
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
A Discord bot for Semaphore.
|
||||
</td>
|
||||
<td>
|
||||
<a href="https://github.com/semaphore-protocol/discord-bot">
|
||||
Github
|
||||
</a>|
|
||||
<a href="https://semaphore.appliedzkp.org/discord">
|
||||
Discord
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="https://developer.unirep.io">
|
||||
Unirep
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
Private and nonrepudiable reputation system based on ZKP.
|
||||
</td>
|
||||
<td>
|
||||
<a href="https://github.com/Unirep">
|
||||
Github
|
||||
</a>|
|
||||
<a href="https://discord.gg/VzMMDJmYc5">
|
||||
Discord
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="https://zk-proof-of-humanity.vercel.app">
|
||||
ZK Proof of Humanity
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
A project to allows humans, registered in Proof of Humanity, to prove their humanity without doxing.
|
||||
</td>
|
||||
<td>
|
||||
<a href="https://github.com/elmol/zk-proof-of-humanity">
|
||||
Github
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Plurality
|
||||
</td>
|
||||
<td>
|
||||
An Identity Lego Building Block for dapp creators that lets them identify their users without</br> using any third-party KYC provider or other middlemen, whilst preserving the privacy of users.
|
||||
</td>
|
||||
<td>
|
||||
<a href="https://github.com/Web3-Plurality">
|
||||
Github
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="https://zerotherapy.vercel.app">
|
||||
ZeroTherapy
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
AMA privacy application built with Semaphore.
|
||||
</td>
|
||||
<td>
|
||||
<a href="https://github.com/Pushpit07/ZeroTherapy">
|
||||
Github
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="https://bq2.netlify.app/">
|
||||
Block Qualified
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
On-chain and privacy preserving education platform built on Semaphore.
|
||||
</td>
|
||||
<td>
|
||||
<a href="https://github.com/0xdeenz/bq2">
|
||||
Github
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tbody>
|
||||
</table>
|
||||
|
||||
## 🛠 Install
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/cli-template-contracts-hardhat",
|
||||
"version": "3.6.0",
|
||||
"version": "3.9.0",
|
||||
"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.6.0",
|
||||
"@semaphore-protocol/hardhat": "3.6.0",
|
||||
"@semaphore-protocol/identity": "3.6.0",
|
||||
"@semaphore-protocol/proof": "3.6.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",
|
||||
"@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.6.0"
|
||||
"@semaphore-protocol/contracts": "3.9.0"
|
||||
},
|
||||
"config": {
|
||||
"solidity": {
|
||||
|
||||
@@ -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.6.0",
|
||||
"@semaphore-protocol/hardhat": "3.6.0",
|
||||
"@semaphore-protocol/identity": "3.6.0",
|
||||
"@semaphore-protocol/proof": "3.6.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",
|
||||
"@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.6.0"
|
||||
"@semaphore-protocol/contracts": "3.9.0"
|
||||
},
|
||||
"config": {
|
||||
"solidity": {
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@next/font": "13.0.3",
|
||||
"@semaphore-protocol/data": "3.6.0",
|
||||
"@semaphore-protocol/group": "3.6.0",
|
||||
"@semaphore-protocol/identity": "3.6.0",
|
||||
"@semaphore-protocol/proof": "3.6.0",
|
||||
"@semaphore-protocol/data": "3.9.0",
|
||||
"@semaphore-protocol/group": "3.9.0",
|
||||
"@semaphore-protocol/identity": "3.9.0",
|
||||
"@semaphore-protocol/proof": "3.9.0",
|
||||
"@types/react": "18.0.25",
|
||||
"@types/react-dom": "18.0.8",
|
||||
"dotenv": "^16.0.3",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/cli-template-monorepo-ethers",
|
||||
"version": "3.6.0",
|
||||
"version": "3.9.0",
|
||||
"description": "Semaphore Hardhat + Next.js + SemaphoreEthers template.",
|
||||
"license": "Unlicense",
|
||||
"files": [
|
||||
|
||||
@@ -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.6.0",
|
||||
"@semaphore-protocol/hardhat": "3.6.0",
|
||||
"@semaphore-protocol/identity": "3.6.0",
|
||||
"@semaphore-protocol/proof": "3.6.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",
|
||||
"@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.6.0"
|
||||
"@semaphore-protocol/contracts": "3.9.0"
|
||||
},
|
||||
"config": {
|
||||
"solidity": {
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@next/font": "13.0.3",
|
||||
"@semaphore-protocol/data": "3.6.0",
|
||||
"@semaphore-protocol/group": "3.6.0",
|
||||
"@semaphore-protocol/identity": "3.6.0",
|
||||
"@semaphore-protocol/proof": "3.6.0",
|
||||
"@semaphore-protocol/data": "3.9.0",
|
||||
"@semaphore-protocol/group": "3.9.0",
|
||||
"@semaphore-protocol/identity": "3.9.0",
|
||||
"@semaphore-protocol/proof": "3.9.0",
|
||||
"@types/react": "18.0.25",
|
||||
"@types/react-dom": "18.0.8",
|
||||
"dotenv": "^16.0.3",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/cli-template-monorepo-subgraph",
|
||||
"version": "3.6.0",
|
||||
"version": "3.9.0",
|
||||
"description": "Semaphore Hardhat + Next.js + SemaphoreSubgraph template.",
|
||||
"license": "Unlicense",
|
||||
"files": [
|
||||
|
||||
@@ -75,8 +75,10 @@ Options:
|
||||
-h, --help Display this help.
|
||||
|
||||
Commands:
|
||||
create <project-directory> Create a Semaphore project with a supported template.
|
||||
get-groups [options] Get the list of groups from a supported network (Goerli or Arbitrum).
|
||||
get-group [options] <group-id> Get the data of a group from a supported network (Goerli or Arbitrum).
|
||||
help [command] Display help for a specific command.
|
||||
create [options] [project-directory] Create a Semaphore project with a supported template.
|
||||
get-groups [options] Get the list of groups from a supported network (e.g. goerli or arbitrum).
|
||||
get-group [options] [group-id] Get the data of a group from a supported network (e.g. goerli or arbitrum).
|
||||
get-members [options] [group-id] Get the members of a group from a supported network (e.g. goerli or arbitrum).
|
||||
get-proofs [options] [group-id] Get the proofs of a group from a supported network (e.g. goerli or arbitrum).
|
||||
help [command] Display help for a specific command.
|
||||
```
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/cli",
|
||||
"type": "module",
|
||||
"version": "3.6.0",
|
||||
"version": "3.9.0",
|
||||
"description": "A command line tool to set up your Semaphore project and get group data.",
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
@@ -43,7 +43,7 @@
|
||||
"typedoc": "^0.22.11"
|
||||
},
|
||||
"dependencies": {
|
||||
"@semaphore-protocol/data": "3.6.0",
|
||||
"@semaphore-protocol/data": "3.9.0",
|
||||
"axios": "^1.3.2",
|
||||
"boxen": "^7.0.1",
|
||||
"chalk": "^5.1.2",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { GroupResponse, SemaphoreEthers, SemaphoreSubgraph } from "@semaphore-protocol/data"
|
||||
import { GroupResponse, SemaphoreEthers, SemaphoreSubgraph, getSupportedNetworks } from "@semaphore-protocol/data"
|
||||
import chalk from "chalk"
|
||||
import { program } from "commander"
|
||||
import figlet from "figlet"
|
||||
@@ -16,7 +16,7 @@ import Spinner from "./spinner.js"
|
||||
const packagePath = `${dirname(fileURLToPath(import.meta.url))}/..`
|
||||
const { description, version } = JSON.parse(readFileSync(`${packagePath}/package.json`, "utf8"))
|
||||
|
||||
const supportedNetworks = ["sepolia", "goerli", "mumbai", "optimism-goerli", "arbitrum", "arbitrum-goerli"]
|
||||
const supportedNetworks = getSupportedNetworks()
|
||||
|
||||
const supportedTemplates = [
|
||||
{
|
||||
@@ -269,7 +269,7 @@ program
|
||||
|
||||
program
|
||||
.command("get-proofs")
|
||||
.description("Get the proofs from a supported network (e.g. goerli or arbitrum).")
|
||||
.description("Get the proofs of a group from a supported network (e.g. goerli or arbitrum).")
|
||||
.argument("[group-id]", "Identifier of the group.")
|
||||
.option("-n, --network <network-name>", "Supported Ethereum network.")
|
||||
.allowExcessArguments(false)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/contracts",
|
||||
"version": "3.6.0",
|
||||
"version": "3.9.0",
|
||||
"description": "Semaphore contracts to manage groups and broadcast anonymous signals.",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
<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">
|
||||
<img alt="Documentation typedoc" src="https://img.shields.io/badge/docs-typedoc-744C7C?style=flat-square">
|
||||
</a>
|
||||
<a href="https://eslint.org/">
|
||||
<img alt="Linter eslint" src="https://img.shields.io/badge/linter-eslint-8080f2?style=flat-square&logo=eslint" />
|
||||
</a>
|
||||
@@ -67,7 +70,13 @@ yarn add @semaphore-protocol/data
|
||||
|
||||
## 📜 Usage
|
||||
|
||||
\# **new SemaphoreSubgraph**(networkOrSubgraphURL: _Network_ | _string_ = "goerli"): _SemaphoreSubgraph_
|
||||
\# **getSupportedNetworks**(): _string[]_
|
||||
|
||||
```typescript
|
||||
const supportedNetworks = getSupportedNetworks()
|
||||
```
|
||||
|
||||
\# **new SemaphoreSubgraph**(networkOrSubgraphURL: SupportedNetwork | ValueOf\<SupportedNetwork> | string = "sepolia"): _SemaphoreSubgraph_
|
||||
|
||||
```typescript
|
||||
import { SemaphoreSubgraph } from "@semaphore-protocol/data"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/data",
|
||||
"version": "3.6.0",
|
||||
"version": "3.9.0",
|
||||
"description": "A library to query Semaphore contracts.",
|
||||
"license": "MIT",
|
||||
"main": "dist/index.node.js",
|
||||
|
||||
@@ -12,10 +12,10 @@ import {
|
||||
import checkParameter from "./checkParameter"
|
||||
import getEvents from "./getEvents"
|
||||
import SemaphoreABI from "./semaphoreABI.json"
|
||||
import { EthersOptions, GroupResponse, Network } from "./types"
|
||||
import { EthersOptions, GroupResponse, EthersNetwork } from "./types"
|
||||
|
||||
export default class SemaphoreEthers {
|
||||
private _network: Network | string
|
||||
private _network: EthersNetwork | string
|
||||
private _options: EthersOptions
|
||||
private _contract: Contract
|
||||
|
||||
@@ -24,7 +24,7 @@ export default class SemaphoreEthers {
|
||||
* @param networkOrEthereumURL Ethereum network or custom URL.
|
||||
* @param options Ethers options.
|
||||
*/
|
||||
constructor(networkOrEthereumURL: Network | string = "sepolia", options: EthersOptions = {}) {
|
||||
constructor(networkOrEthereumURL: EthersNetwork | string = "sepolia", options: EthersOptions = {}) {
|
||||
checkParameter(networkOrEthereumURL, "networkOrSubgraphURL", "string")
|
||||
|
||||
if (options.provider) {
|
||||
@@ -114,7 +114,7 @@ export default class SemaphoreEthers {
|
||||
* Returns the Ethereum network or custom URL.
|
||||
* @returns Ethereum network or custom URL.
|
||||
*/
|
||||
get network(): Network | string {
|
||||
get network(): EthersNetwork | string {
|
||||
return this._network
|
||||
}
|
||||
|
||||
|
||||
9
packages/data/src/getSupportedNetworks.ts
Normal file
9
packages/data/src/getSupportedNetworks.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { SupportedNetwork } from "./types"
|
||||
|
||||
/**
|
||||
* Returns the list of Semaphore supported networks.
|
||||
* @returns Semaphore supported networks.
|
||||
*/
|
||||
export default function getSupportedNetworks(): string[] {
|
||||
return Object.values(SupportedNetwork)
|
||||
}
|
||||
@@ -1,19 +1,20 @@
|
||||
import { Network } from "./types"
|
||||
import { SupportedNetwork } from "./types"
|
||||
|
||||
/**
|
||||
* Returns the subgraph URL related to the network passed as a parameter.
|
||||
* @param network Semaphore supported network.
|
||||
* @param supportedNetwork Semaphore supported network.
|
||||
* @returns Subgraph URL.
|
||||
*/
|
||||
export default function getURL(network: Network): string {
|
||||
switch (network) {
|
||||
export default function getURL(supportedNetwork: SupportedNetwork | string): string {
|
||||
switch (supportedNetwork) {
|
||||
case "sepolia":
|
||||
case "goerli":
|
||||
case "mumbai":
|
||||
case "optimism-goerli":
|
||||
case "arbitrum-goerli":
|
||||
case "arbitrum":
|
||||
return `https://api.studio.thegraph.com/query/14377/semaphore-${network}/v3.6.1`
|
||||
return `https://api.studio.thegraph.com/query/14377/semaphore-${supportedNetwork}/v3.6.1`
|
||||
default:
|
||||
throw new TypeError(`Network '${network}' is not supported`)
|
||||
throw new TypeError(`Network '${supportedNetwork}' is not supported`)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import SemaphoreSubgraph from "./subgraph"
|
||||
import SemaphoreEthers from "./ethers"
|
||||
import getSupportedNetworks from "./getSupportedNetworks"
|
||||
import SemaphoreSubgraph from "./subgraph"
|
||||
|
||||
export { SemaphoreSubgraph, SemaphoreEthers }
|
||||
export * from "./types"
|
||||
export { SemaphoreSubgraph, SemaphoreEthers, getSupportedNetworks }
|
||||
|
||||
@@ -16,7 +16,7 @@ describe("SemaphoreSubgraph", () => {
|
||||
semaphore = new SemaphoreSubgraph()
|
||||
const semaphore1 = new SemaphoreSubgraph("arbitrum")
|
||||
|
||||
expect(semaphore.url).toContain("goerli")
|
||||
expect(semaphore.url).toContain("sepolia")
|
||||
expect(semaphore1.url).toContain("arbitrum")
|
||||
})
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { AxiosRequestConfig } from "axios"
|
||||
import checkParameter from "./checkParameter"
|
||||
import getURL from "./getURL"
|
||||
import request from "./request"
|
||||
import { GroupResponse, GroupOptions, Network } from "./types"
|
||||
import { GroupOptions, GroupResponse, SupportedNetwork } from "./types"
|
||||
import { jsDateToGraphqlDate } from "./utils"
|
||||
|
||||
export default class SemaphoreSubgraph {
|
||||
@@ -12,15 +12,15 @@ export default class SemaphoreSubgraph {
|
||||
* Initializes the subgraph object with one of the supported networks or a custom URL.
|
||||
* @param networkOrSubgraphURL Supported Semaphore network or custom Subgraph URL.
|
||||
*/
|
||||
constructor(networkOrSubgraphURL: Network | string = "goerli") {
|
||||
constructor(networkOrSubgraphURL: SupportedNetwork | string = SupportedNetwork.SEPOLIA) {
|
||||
checkParameter(networkOrSubgraphURL, "networkOrSubgraphURL", "string")
|
||||
|
||||
if (networkOrSubgraphURL.startsWith("http")) {
|
||||
if (typeof networkOrSubgraphURL === "string" && networkOrSubgraphURL.startsWith("http")) {
|
||||
this._url = networkOrSubgraphURL
|
||||
return
|
||||
}
|
||||
|
||||
this._url = getURL(networkOrSubgraphURL as Network)
|
||||
this._url = getURL(networkOrSubgraphURL)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,13 @@
|
||||
export type Network =
|
||||
export enum SupportedNetwork {
|
||||
SEPOLIA = "sepolia",
|
||||
GOERLI = "goerli",
|
||||
MUMBAI = "mumbai",
|
||||
OPTIMISM_GOERLI = "optimism-goerli",
|
||||
ARBITRUM_GOERLI = "arbitrum-goerli",
|
||||
ARBITRUM = "arbitrum"
|
||||
}
|
||||
|
||||
export type EthersNetwork =
|
||||
| "homestead"
|
||||
| "matic"
|
||||
| "goerli"
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
<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">
|
||||
<img alt="Documentation typedoc" src="https://img.shields.io/badge/docs-typedoc-744C7C?style=flat-square">
|
||||
</a>
|
||||
<a href="https://eslint.org/">
|
||||
<img alt="Linter eslint" src="https://img.shields.io/badge/linter-eslint-8080f2?style=flat-square&logo=eslint" />
|
||||
</a>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/group",
|
||||
"version": "3.6.0",
|
||||
"version": "3.9.0",
|
||||
"description": "A library to create and manage Semaphore groups.",
|
||||
"license": "MIT",
|
||||
"main": "dist/index.node.js",
|
||||
@@ -32,7 +32,7 @@
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-commonjs": "^24.0.1",
|
||||
"@rollup/plugin-node-resolve": "^15.0.1",
|
||||
"poseidon-lite": "^0.1.0",
|
||||
"poseidon-lite": "^0.2.0",
|
||||
"rollup-plugin-cleanup": "^3.2.1",
|
||||
"rollup-plugin-typescript2": "^0.31.2",
|
||||
"typedoc": "^0.22.11"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/hardhat",
|
||||
"version": "3.6.0",
|
||||
"version": "3.9.0",
|
||||
"description": "A Semaphore Hardhat plugin to deploy verifiers and Semaphore contract.",
|
||||
"license": "MIT",
|
||||
"main": "dist/index.node.js",
|
||||
@@ -38,7 +38,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@nomiclabs/hardhat-ethers": "^2.1.1",
|
||||
"@semaphore-protocol/contracts": "3.6.0",
|
||||
"@semaphore-protocol/contracts": "3.9.0",
|
||||
"circomlibjs": "^0.0.8",
|
||||
"ethers": "^5.7.1",
|
||||
"hardhat-dependency-compiler": "^1.1.3"
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
<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">
|
||||
<img alt="Documentation typedoc" src="https://img.shields.io/badge/docs-typedoc-744C7C?style=flat-square">
|
||||
</a>
|
||||
<a href="https://eslint.org/">
|
||||
<img alt="Linter eslint" src="https://img.shields.io/badge/linter-eslint-8080f2?style=flat-square&logo=eslint" />
|
||||
</a>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/heyauthn",
|
||||
"version": "3.6.0",
|
||||
"version": "3.9.0",
|
||||
"description": "A library to allow developers to create and manage Semaphore identities using WebAuthn",
|
||||
"license": "MIT",
|
||||
"main": "dist/index.node.js",
|
||||
@@ -35,7 +35,7 @@
|
||||
"typedoc": "^0.22.11"
|
||||
},
|
||||
"dependencies": {
|
||||
"@semaphore-protocol/identity": "3.6.0",
|
||||
"@semaphore-protocol/identity": "3.9.0",
|
||||
"@simplewebauthn/browser": "7.2.0",
|
||||
"@simplewebauthn/server": "7.2.0"
|
||||
}
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
<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">
|
||||
<img alt="Documentation typedoc" src="https://img.shields.io/badge/docs-typedoc-744C7C?style=flat-square">
|
||||
</a>
|
||||
<a href="https://eslint.org/">
|
||||
<img alt="Linter eslint" src="https://img.shields.io/badge/linter-eslint-8080f2?style=flat-square&logo=eslint" />
|
||||
</a>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/identity",
|
||||
"version": "3.6.0",
|
||||
"version": "3.9.0",
|
||||
"description": "A library to create Semaphore identities.",
|
||||
"license": "MIT",
|
||||
"main": "dist/index.node.js",
|
||||
@@ -32,7 +32,7 @@
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-commonjs": "^24.0.1",
|
||||
"@rollup/plugin-node-resolve": "^15.0.1",
|
||||
"poseidon-lite": "^0.1.0",
|
||||
"poseidon-lite": "^0.2.0",
|
||||
"rollup-plugin-cleanup": "^3.2.1",
|
||||
"rollup-plugin-typescript2": "^0.31.2",
|
||||
"typedoc": "^0.22.11"
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
<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">
|
||||
<img alt="Documentation typedoc" src="https://img.shields.io/badge/docs-typedoc-744C7C?style=flat-square">
|
||||
</a>
|
||||
<a href="https://eslint.org/">
|
||||
<img alt="Linter eslint" src="https://img.shields.io/badge/linter-eslint-8080f2?style=flat-square&logo=eslint" />
|
||||
</a>
|
||||
@@ -67,7 +70,13 @@ yarn add @semaphore-protocol/identity @semaphore-protocol/group @semaphore-proto
|
||||
|
||||
## 📜 Usage
|
||||
|
||||
\# **generateProof**(identity: _Identity_, group: _Group_ | _MerkleProof_, externalNullifier: _BigNumberish_, signal: _string_, snarkArtifacts?: _SnarkArtifacts_): Promise\<_SemaphoreFullProof_>
|
||||
\# **generateProof**(
|
||||
identity: _Identity_,
|
||||
group: _Group_ | _MerkleProof_,
|
||||
externalNullifier: _BytesLike | Hexable | number | bigint_,
|
||||
signal: _BytesLike | Hexable | number | bigint_,
|
||||
snarkArtifacts?: _SnarkArtifacts_
|
||||
): Promise\<_SemaphoreFullProof_>
|
||||
|
||||
```typescript
|
||||
import { Identity } from "@semaphore-protocol/identity"
|
||||
@@ -98,3 +107,18 @@ import { verifyProof } from "@semaphore-protocol/proof"
|
||||
|
||||
await verifyProof(fullProof, 20)
|
||||
```
|
||||
|
||||
\# **calculateNullifierHash**(
|
||||
identityNullifier: _bigint | number | string_,
|
||||
externalNullifier: \__BytesLike | Hexable | number | bigint_
|
||||
): bigint
|
||||
|
||||
```typescript
|
||||
import { Identity } from "@semaphore-protocol/identity"
|
||||
import { calculateNullifierHash } from "@semaphore-protocol/proof"
|
||||
|
||||
const identity = new Identity()
|
||||
const externalNullifier = utils.formatBytes32String("Topic")
|
||||
|
||||
const nullifierHash = calculateNullifierHash(identity.nullifier, externalNullifier)
|
||||
```
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/proof",
|
||||
"version": "3.6.0",
|
||||
"version": "3.9.0",
|
||||
"description": "A library to generate and verify Semaphore proofs.",
|
||||
"license": "MIT",
|
||||
"main": "dist/index.node.js",
|
||||
@@ -30,15 +30,18 @@
|
||||
"access": "public"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@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",
|
||||
"rollup-plugin-cleanup": "^3.2.1",
|
||||
"rollup-plugin-typescript2": "^0.31.2",
|
||||
"typedoc": "^0.22.11"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@semaphore-protocol/group": "3.6.0",
|
||||
"@semaphore-protocol/identity": "3.6.0"
|
||||
"@semaphore-protocol/group": "3.9.0",
|
||||
"@semaphore-protocol/identity": "3.9.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ethersproject/bignumber": "^5.5.0",
|
||||
|
||||
@@ -1,7 +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"
|
||||
|
||||
const pkg = JSON.parse(fs.readFileSync("./package.json", "utf-8"))
|
||||
const banner = `/**
|
||||
@@ -25,6 +27,8 @@ export default {
|
||||
tsconfig: "./build.tsconfig.json",
|
||||
useTsconfigDeclarationDir: true
|
||||
}),
|
||||
commonjs(),
|
||||
nodeResolve(),
|
||||
cleanup({ comments: "jsdoc" }),
|
||||
json()
|
||||
]
|
||||
|
||||
16
packages/proof/src/calculateNullifierHash.ts
Normal file
16
packages/proof/src/calculateNullifierHash.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { BytesLike, Hexable } from "@ethersproject/bytes"
|
||||
import { poseidon2 } from "poseidon-lite/poseidon2"
|
||||
import hash from "./hash"
|
||||
|
||||
/**
|
||||
* Given the identity nullifier and the external nullifier, it calculates nullifier hash.
|
||||
* @param identityNullifier The identity nullifier.
|
||||
* @param externalNullifier The external nullifier.
|
||||
* @returns The nullifier hash.
|
||||
*/
|
||||
export default function calculateNullifierHash(
|
||||
identityNullifier: number | bigint | string,
|
||||
externalNullifier: BytesLike | Hexable | number | bigint
|
||||
): bigint {
|
||||
return poseidon2([hash(externalNullifier), identityNullifier])
|
||||
}
|
||||
@@ -2,6 +2,7 @@ import { formatBytes32String } from "@ethersproject/strings"
|
||||
import { Group } from "@semaphore-protocol/group"
|
||||
import { Identity } from "@semaphore-protocol/identity"
|
||||
import { getCurveFromName } from "ffjavascript"
|
||||
import calculateNullifierHash from "./calculateNullifierHash"
|
||||
import generateProof from "./generateProof"
|
||||
import hash from "./hash"
|
||||
import packProof from "./packProof"
|
||||
@@ -147,6 +148,14 @@ describe("Proof", () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe("# calculateNullifierHash", () => {
|
||||
it("Should calculate the nullifier hash correctly", async () => {
|
||||
const nullifierHash = calculateNullifierHash(identity.nullifier, externalNullifier)
|
||||
|
||||
expect(fullProof.nullifierHash).toBe(nullifierHash.toString())
|
||||
})
|
||||
})
|
||||
|
||||
describe("# packProof/unpackProof", () => {
|
||||
it("Should return a packed proof", async () => {
|
||||
const originalProof = unpackProof(fullProof.proof)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import generateProof from "./generateProof"
|
||||
import verifyProof from "./verifyProof"
|
||||
import calculateNullifierHash from "./calculateNullifierHash"
|
||||
|
||||
export { generateProof, verifyProof }
|
||||
export { generateProof, verifyProof, calculateNullifierHash }
|
||||
export * from "./types"
|
||||
|
||||
67
projects.json
Normal file
67
projects.json
Normal file
@@ -0,0 +1,67 @@
|
||||
[
|
||||
{
|
||||
"name": "Semaphore Explorer",
|
||||
"tagline": "Semaphore explorer for on-chain groups.",
|
||||
"icon": "",
|
||||
"links": {
|
||||
"website": "https://community.semaphore.appliedzkp.org/semaphore-explorer",
|
||||
"github": "https://github.com/semaphore-protocol/explorer",
|
||||
"discord": "https://semaphore.appliedzkp.org/discord"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Semaphore Discord Bot",
|
||||
"tagline": "A Discord Bot for Semaphore",
|
||||
"icon": "",
|
||||
"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"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Unirep",
|
||||
"tagline": "Private and nonrepudiable reputation system based on ZKP.",
|
||||
"icon": "",
|
||||
"links": {
|
||||
"website": "https://developer.unirep.io",
|
||||
"github": "https://github.com/Unirep",
|
||||
"discord": "https://discord.gg/VzMMDJmYc5"
|
||||
}
|
||||
},
|
||||
{
|
||||
"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.",
|
||||
"icon": "",
|
||||
"links": {
|
||||
"github": "https://github.com/Web3-Plurality"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ZK Proof of Humanity",
|
||||
"tagline": "A project to allows humans, registered in Proof of Humanity, to prove their humanity without doxing.",
|
||||
"icon": "",
|
||||
"links": {
|
||||
"website": "https://zk-proof-of-humanity.vercel.app",
|
||||
"github": "https://github.com/elmol/zk-proof-of-humanity"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ZeroTherapy",
|
||||
"tagline": "AMA privacy application built with Semaphore.",
|
||||
"icon": "",
|
||||
"links": {
|
||||
"website": "https://zerotherapy.vercel.app",
|
||||
"github": "https://github.com/Pushpit07/ZeroTherapy"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Block Qualified",
|
||||
"tagline": "On-chain and privacy preserving education platform built on Semaphore.",
|
||||
"icon": "",
|
||||
"links": {
|
||||
"website": "https://bq2.netlify.app/",
|
||||
"github": "https://github.com/0xdeenz/bq2"
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -1 +1 @@
|
||||
ecde6dc734269b2c8251c1873e357e9969d003bc
|
||||
41a594b655244878cf24a7d982a9f8c3bc0988c2
|
||||
Reference in New Issue
Block a user