mirror of
https://github.com/semaphore-protocol/semaphore.git
synced 2026-01-14 09:07:58 -05:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
88c3facbb7 | ||
|
|
2fc40bf710 | ||
|
|
78dcb705c5 | ||
|
|
3c75453e69 | ||
|
|
e48099b0f1 | ||
|
|
64e313a541 | ||
|
|
662c3b5af4 | ||
|
|
f0ffd47fae | ||
|
|
c636317c2e | ||
|
|
41a2f2f7cb | ||
|
|
c591cc48e9 | ||
|
|
b2a33eaf58 | ||
|
|
8b419a024b |
@@ -50,13 +50,13 @@
|
||||
"@commitlint/cli": "^16.0.2",
|
||||
"@commitlint/config-conventional": "^16.0.0",
|
||||
"@rollup/plugin-typescript": "^8.3.0",
|
||||
"@types/circomlibjs": "^0.1.1",
|
||||
"@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.2",
|
||||
"@types/snarkjs": "^0.7.5",
|
||||
"@typescript-eslint/eslint-plugin": "^5.9.1",
|
||||
"@typescript-eslint/parser": "^5.9.1",
|
||||
"babel-jest": "^27.4.6",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/cli-template-contracts-hardhat",
|
||||
"version": "3.12.0",
|
||||
"version": "3.15.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.12.0",
|
||||
"@semaphore-protocol/hardhat": "3.12.0",
|
||||
"@semaphore-protocol/identity": "3.12.0",
|
||||
"@semaphore-protocol/proof": "3.12.0",
|
||||
"@semaphore-protocol/group": "3.15.0",
|
||||
"@semaphore-protocol/hardhat": "3.15.0",
|
||||
"@semaphore-protocol/identity": "3.15.0",
|
||||
"@semaphore-protocol/proof": "3.15.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.12.0"
|
||||
"@semaphore-protocol/contracts": "3.15.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.12.0",
|
||||
"@semaphore-protocol/hardhat": "3.12.0",
|
||||
"@semaphore-protocol/identity": "3.12.0",
|
||||
"@semaphore-protocol/proof": "3.12.0",
|
||||
"@semaphore-protocol/group": "3.15.0",
|
||||
"@semaphore-protocol/hardhat": "3.15.0",
|
||||
"@semaphore-protocol/identity": "3.15.0",
|
||||
"@semaphore-protocol/proof": "3.15.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.12.0"
|
||||
"@semaphore-protocol/contracts": "3.15.0"
|
||||
},
|
||||
"config": {
|
||||
"solidity": {
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@next/font": "13.0.3",
|
||||
"@semaphore-protocol/data": "3.12.0",
|
||||
"@semaphore-protocol/group": "3.12.0",
|
||||
"@semaphore-protocol/identity": "3.12.0",
|
||||
"@semaphore-protocol/proof": "3.12.0",
|
||||
"@semaphore-protocol/data": "3.15.0",
|
||||
"@semaphore-protocol/group": "3.15.0",
|
||||
"@semaphore-protocol/identity": "3.15.0",
|
||||
"@semaphore-protocol/proof": "3.15.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.12.0",
|
||||
"version": "3.15.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.12.0",
|
||||
"@semaphore-protocol/hardhat": "3.12.0",
|
||||
"@semaphore-protocol/identity": "3.12.0",
|
||||
"@semaphore-protocol/proof": "3.12.0",
|
||||
"@semaphore-protocol/group": "3.15.0",
|
||||
"@semaphore-protocol/hardhat": "3.15.0",
|
||||
"@semaphore-protocol/identity": "3.15.0",
|
||||
"@semaphore-protocol/proof": "3.15.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.12.0"
|
||||
"@semaphore-protocol/contracts": "3.15.0"
|
||||
},
|
||||
"config": {
|
||||
"solidity": {
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@next/font": "13.0.3",
|
||||
"@semaphore-protocol/data": "3.12.0",
|
||||
"@semaphore-protocol/group": "3.12.0",
|
||||
"@semaphore-protocol/identity": "3.12.0",
|
||||
"@semaphore-protocol/proof": "3.12.0",
|
||||
"@semaphore-protocol/data": "3.15.0",
|
||||
"@semaphore-protocol/group": "3.15.0",
|
||||
"@semaphore-protocol/identity": "3.15.0",
|
||||
"@semaphore-protocol/proof": "3.15.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.12.0",
|
||||
"version": "3.15.0",
|
||||
"description": "Semaphore Hardhat + Next.js + SemaphoreSubgraph template.",
|
||||
"license": "Unlicense",
|
||||
"files": [
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/cli",
|
||||
"type": "module",
|
||||
"version": "3.12.0",
|
||||
"version": "3.15.0",
|
||||
"description": "A command line tool to set up your Semaphore project and get group data.",
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
@@ -42,7 +42,7 @@
|
||||
"ts-node": "^10.9.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@semaphore-protocol/data": "3.12.0",
|
||||
"@semaphore-protocol/data": "3.15.0",
|
||||
"axios": "^1.3.2",
|
||||
"boxen": "^7.0.1",
|
||||
"chalk": "^5.1.2",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/contracts",
|
||||
"version": "3.12.0",
|
||||
"version": "3.15.0",
|
||||
"description": "Semaphore contracts to manage groups and broadcast anonymous signals.",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/data",
|
||||
"version": "3.12.0",
|
||||
"version": "3.15.0",
|
||||
"description": "A library to query Semaphore contracts.",
|
||||
"license": "MIT",
|
||||
"main": "dist/index.node.js",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/group",
|
||||
"version": "3.12.0",
|
||||
"version": "3.15.0",
|
||||
"description": "A library to create and manage Semaphore groups.",
|
||||
"license": "MIT",
|
||||
"main": "dist/index.node.js",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/hardhat",
|
||||
"version": "3.12.0",
|
||||
"version": "3.15.0",
|
||||
"description": "A Semaphore Hardhat plugin to deploy verifiers and Semaphore contract.",
|
||||
"license": "MIT",
|
||||
"main": "dist/index.node.js",
|
||||
@@ -38,8 +38,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@nomiclabs/hardhat-ethers": "^2.1.1",
|
||||
"@semaphore-protocol/contracts": "3.12.0",
|
||||
"circomlibjs": "^0.0.8",
|
||||
"@semaphore-protocol/contracts": "3.15.0",
|
||||
"circomlibjs": "^0.1.7",
|
||||
"ethers": "^5.7.1",
|
||||
"hardhat-dependency-compiler": "^1.1.3"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/heyauthn",
|
||||
"version": "3.12.0",
|
||||
"version": "3.15.0",
|
||||
"description": "A library to allow developers to create and manage Semaphore identities using WebAuthn",
|
||||
"license": "MIT",
|
||||
"main": "dist/index.node.js",
|
||||
@@ -33,7 +33,7 @@
|
||||
"rollup-plugin-typescript2": "^0.31.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@semaphore-protocol/identity": "3.12.0",
|
||||
"@semaphore-protocol/identity": "3.15.0",
|
||||
"@simplewebauthn/browser": "7.2.0",
|
||||
"@simplewebauthn/server": "7.2.0"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/identity",
|
||||
"version": "3.12.0",
|
||||
"version": "3.15.0",
|
||||
"description": "A library to create Semaphore identities.",
|
||||
"license": "MIT",
|
||||
"main": "dist/index.node.js",
|
||||
|
||||
@@ -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,11 +1,11 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/proof",
|
||||
"version": "3.12.0",
|
||||
"version": "3.15.0",
|
||||
"description": "A library to generate and verify Semaphore proofs.",
|
||||
"license": "MIT",
|
||||
"main": "dist/index.node.js",
|
||||
"exports": {
|
||||
"import": "./dist/index.mjs",
|
||||
"import": "./dist/index.node.mjs",
|
||||
"require": "./dist/index.node.js"
|
||||
},
|
||||
"types": "dist/types/index.d.ts",
|
||||
@@ -32,21 +32,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"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@semaphore-protocol/group": "3.12.0",
|
||||
"@semaphore-protocol/identity": "3.12.0"
|
||||
"@semaphore-protocol/group": "3.15.0",
|
||||
"@semaphore-protocol/identity": "3.15.0"
|
||||
},
|
||||
"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.7.1"
|
||||
"@zk-kit/groth16": "0.1.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,8 +2,9 @@ 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, NumericString } from "snarkjs"
|
||||
import type { NumericString } from "snarkjs"
|
||||
import hash from "./hash"
|
||||
import packProof from "./packProof"
|
||||
import { SemaphoreProof, SnarkArtifacts } from "./types"
|
||||
@@ -45,7 +46,7 @@ export default async function generateProof(
|
||||
}
|
||||
}
|
||||
|
||||
const { proof, publicSignals } = await groth16.fullProve(
|
||||
const { proof, publicSignals } = await prove(
|
||||
{
|
||||
identityTrapdoor: trapdoor,
|
||||
identityNullifier: nullifier,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export type NumericString = `${number}`
|
||||
import type { NumericString } from "snarkjs"
|
||||
|
||||
export type SnarkArtifacts = {
|
||||
wasmFilePath: string
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { groth16 } from "snarkjs"
|
||||
import { verify } from "@zk-kit/groth16"
|
||||
import hash from "./hash"
|
||||
import { SemaphoreProof } from "./types"
|
||||
import unpackProof from "./unpackProof"
|
||||
@@ -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)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
331ec0fe07522653438bfad1b26f4a66beda0220
|
||||
56f1eae9f45dc17131882a1e18bd4d2997714e07
|
||||
Reference in New Issue
Block a user