Compare commits

...

25 Commits

Author SHA1 Message Date
cedoor
7bcc44c645 chore: v3.9.0
Former-commit-id: 900da9cef5
2023-04-28 12:27:48 +01:00
Cedoor
0ac390eaf0 Merge pull request #315 from semaphore-protocol/feat/subgraph
Sepolia subgraph & supported networks

Former-commit-id: f50a16054b
2023-04-28 11:33:57 +01:00
cedoor
5db4c61c28 feat(data): provide function to get supported networks
re #314


Former-commit-id: 5e033556fb
2023-04-27 16:04:20 +01:00
cedoor
37dc17d880 feat(data): add sepolia subgraph support
Former-commit-id: 92a6a7a354
2023-04-27 16:03:54 +01:00
cedoor
a04057f861 chore: v3.8.0
Former-commit-id: 736bddbd83
2023-04-26 15:34:48 +01:00
Cedoor
29e8f5852f Merge pull request #312 from semaphore-protocol/feat/nullifier-hash
New function to calculate nullifier hash

Former-commit-id: 946ac8333c
2023-04-26 15:20:20 +01:00
Cedoor
26c76f453e Merge pull request #313 from 0xdeenz/main
chore: add Block Qualified to list of projects
Former-commit-id: 37951ff29e
2023-04-26 12:43:24 +01:00
cedoor
9a1a1e7853 docs: update package docs links
Former-commit-id: 8ff372ef35
2023-04-26 12:37:09 +01:00
cedoor
f583caa243 ci(github): add semaphore js cname
Former-commit-id: 9a24d36c0b
2023-04-26 12:25:20 +01:00
0xdeenz
b399b923ab chore: add Block Qualified to list of projects
Former-commit-id: dc7e0a1d0b
2023-04-25 20:04:37 +02:00
Cedoor
65e5d29dcd docs(proof): update README.md
Former-commit-id: 3f1432c8b9
2023-04-22 17:28:06 +01:00
cedoor
ba9782139e feat(proof): add function to calculate nullifier hash
Former-commit-id: 6cc2b6af1c
2023-04-22 17:23:52 +01:00
Cedoor
edef368976 Merge pull request #311 from semaphore-protocol/ref/cli
Update get-proofs description

Former-commit-id: 10024bced9
2023-04-22 10:42:14 +01:00
vplasencia
77fddc9b16 docs(cli): update the description of get-proofs command in the readme file
Former-commit-id: d151998013
2023-04-22 09:26:21 +02:00
vplasencia
69b2b8fd7b refactor(cli): update get-proofs description
Former-commit-id: eb63447166
2023-04-22 09:19:54 +02:00
cedoor
aba7d51f86 chore: v3.7.0
Former-commit-id: 22f33a8f26
2023-04-20 11:28:32 +01:00
Cedoor
32d1b47964 Merge pull request #310 from semaphore-protocol/docs/cli
Update the Readme file to add the new CLI commands

Former-commit-id: faf7ff9c18
2023-04-20 11:20:02 +01:00
vplasencia
cb3ff0fcb8 docs(cli): update the readme file to add the new commands
Former-commit-id: e7ceb37503
2023-04-20 10:15:51 +02:00
Cedoor
4d4338d3bc Merge pull request #309 from semaphore-protocol/chore/community-projects
Semaphore projects

Former-commit-id: f0574c4c40
2023-04-19 12:21:20 +01:00
cedoor
536410457e chore: add some projects
Former-commit-id: 3ee4cebd35
2023-04-19 12:08:58 +01:00
Cedoor
7469086a2a docs: add section for semaphore projects
Former-commit-id: 37bbdb4dc0
2023-04-19 12:06:29 +01:00
cedoor
3496aa6478 chore: update issue template to add projects
Former-commit-id: 10909c63c4
2023-04-19 11:28:16 +01:00
cedoor
60d5110905 chore: create json for community projects
Former-commit-id: b98bdb3a1d
2023-04-19 11:27:49 +01:00
Cedoor
0da64796ea Merge pull request #306 from vimwitch/bump-poseidon-lite
chore: bump poseidon-lite minor version
Former-commit-id: 617bb364ae
2023-04-19 10:43:56 +02:00
Chance
41ab36d24c chore: bump poseidon-lite minor version
Former-commit-id: 9f9ec7054b
2023-04-19 00:47:13 -05:00
38 changed files with 364 additions and 77 deletions

View File

@@ -13,6 +13,7 @@ A brief description of your project. In what way have you used Semaphore?
**Other info**
- Name
- Tagline
- Icon
**Links**

View File

@@ -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
View File

@@ -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

View File

@@ -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": {

View File

@@ -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": {

View File

@@ -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",

View File

@@ -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": [

View File

@@ -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": {

View File

@@ -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",

View File

@@ -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": [

View File

@@ -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.
```

View File

@@ -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",

View File

@@ -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)

View File

@@ -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": [

View File

@@ -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"

View File

@@ -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",

View File

@@ -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
}

View 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)
}

View File

@@ -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`)
}
}

View File

@@ -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 }

View File

@@ -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")
})

View File

@@ -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)
}
/**

View File

@@ -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"

View File

@@ -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>

View File

@@ -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"

View File

@@ -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"

View File

@@ -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>

View File

@@ -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"
}

View File

@@ -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>

View File

@@ -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"

View File

@@ -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)
```

View File

@@ -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",

View File

@@ -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()
]

View 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])
}

View File

@@ -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)

View File

@@ -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
View 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"
}
}
]

View File

@@ -1 +1 @@
ecde6dc734269b2c8251c1873e357e9969d003bc
41a594b655244878cf24a7d982a9f8c3bc0988c2