Compare commits

..

13 Commits

Author SHA1 Message Date
cedoor
a288ed7162 chore: v3.15.1
Former-commit-id: 9e84c93198
2023-11-22 11:03:42 +00:00
Cedoor
4f73284c06 Merge pull request #452 from dcposch/main
fix: typescript type exports
Former-commit-id: d008d6233a
2023-11-22 14:01:24 +03:00
DC
bd7d3e352f fix: typescript type exports
Former-commit-id: a4109e7ea4
2023-11-16 01:03:42 +03:00
Cedoor
0a181c1a9c Merge pull request #385 from semaphore-protocol/fix/type-name
Replace the `FullProof` type with the `SemaphoreProof` type in the packages contracts tests

Former-commit-id: 94259e1865
2023-10-18 13:11:30 +01:00
vplasencia
37ad6e4aa7 fix(contracts): update variable types
Former-commit-id: aed7ab10ff
2023-10-18 13:58:43 +02:00
cedoor
2ec36d4097 chore(proof): update zk-kit groth16 dependency
Former-commit-id: f5637a87b3
2023-10-12 15:54:43 -07:00
cedoor
88c3facbb7 chore: v3.15.0
Former-commit-id: c56577f2d8
2023-10-12 15:53:02 -07:00
cedoor
2fc40bf710 refactor(proof): replace groth16 functions with groth16 pkg
Former-commit-id: dd08ba1198
2023-10-12 15:52:23 -07:00
cedoor
78dcb705c5 chore: v3.14.0
Former-commit-id: 091eb436ae
2023-10-11 19:16:55 -07:00
cedoor
3c75453e69 perf(proof): use cached curve rather than a new one
Former-commit-id: 60dc748fe7
2023-10-11 19:16:23 -07:00
cedoor
e48099b0f1 chore: v3.13.0
Former-commit-id: 36958e019c
2023-10-11 18:55:50 -07:00
cedoor
64e313a541 refactor(proof): move snarkjs code inside proof pkg
Former-commit-id: 40e4769a78
2023-10-11 18:55:22 -07:00
cedoor
662c3b5af4 docs(proof): update readme file
Former-commit-id: c1466d17ae
2023-10-11 13:56:29 -07:00
25 changed files with 78 additions and 151 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@semaphore-protocol/cli-template-contracts-hardhat",
"version": "3.12.3",
"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.12.3",
"@semaphore-protocol/hardhat": "3.12.3",
"@semaphore-protocol/identity": "3.12.3",
"@semaphore-protocol/proof": "3.12.3",
"@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.12.3"
"@semaphore-protocol/contracts": "3.15.1"
},
"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.12.3",
"@semaphore-protocol/hardhat": "3.12.3",
"@semaphore-protocol/identity": "3.12.3",
"@semaphore-protocol/proof": "3.12.3",
"@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.12.3"
"@semaphore-protocol/contracts": "3.15.1"
},
"config": {
"solidity": {

View File

@@ -10,10 +10,10 @@
},
"dependencies": {
"@next/font": "13.0.3",
"@semaphore-protocol/data": "3.12.3",
"@semaphore-protocol/group": "3.12.3",
"@semaphore-protocol/identity": "3.12.3",
"@semaphore-protocol/proof": "3.12.3",
"@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",

View File

@@ -1,6 +1,6 @@
{
"name": "@semaphore-protocol/cli-template-monorepo-ethers",
"version": "3.12.3",
"version": "3.15.1",
"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.12.3",
"@semaphore-protocol/hardhat": "3.12.3",
"@semaphore-protocol/identity": "3.12.3",
"@semaphore-protocol/proof": "3.12.3",
"@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.12.3"
"@semaphore-protocol/contracts": "3.15.1"
},
"config": {
"solidity": {

View File

@@ -10,10 +10,10 @@
},
"dependencies": {
"@next/font": "13.0.3",
"@semaphore-protocol/data": "3.12.3",
"@semaphore-protocol/group": "3.12.3",
"@semaphore-protocol/identity": "3.12.3",
"@semaphore-protocol/proof": "3.12.3",
"@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",

View File

@@ -1,6 +1,6 @@
{
"name": "@semaphore-protocol/cli-template-monorepo-subgraph",
"version": "3.12.3",
"version": "3.15.1",
"description": "Semaphore Hardhat + Next.js + SemaphoreSubgraph template.",
"license": "Unlicense",
"files": [

View File

@@ -1,7 +1,7 @@
{
"name": "@semaphore-protocol/cli",
"type": "module",
"version": "3.12.3",
"version": "3.15.1",
"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.3",
"@semaphore-protocol/data": "3.15.1",
"axios": "^1.3.2",
"boxen": "^7.0.1",
"chalk": "^5.1.2",

View File

@@ -1,6 +1,6 @@
{
"name": "@semaphore-protocol/contracts",
"version": "3.12.3",
"version": "3.15.1",
"description": "Semaphore contracts to manage groups and broadcast anonymous signals.",
"license": "MIT",
"files": [

View File

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

View File

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

View File

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

View File

@@ -1,12 +1,13 @@
{
"name": "@semaphore-protocol/data",
"version": "3.12.3",
"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": [

View File

@@ -1,12 +1,13 @@
{
"name": "@semaphore-protocol/group",
"version": "3.12.3",
"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": [

View File

@@ -1,12 +1,13 @@
{
"name": "@semaphore-protocol/hardhat",
"version": "3.12.3",
"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,7 +39,7 @@
},
"dependencies": {
"@nomiclabs/hardhat-ethers": "^2.1.1",
"@semaphore-protocol/contracts": "3.12.3",
"@semaphore-protocol/contracts": "3.15.1",
"circomlibjs": "^0.1.7",
"ethers": "^5.7.1",
"hardhat-dependency-compiler": "^1.1.3"

View File

@@ -1,12 +1,13 @@
{
"name": "@semaphore-protocol/heyauthn",
"version": "3.12.3",
"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": [
@@ -33,7 +34,7 @@
"rollup-plugin-typescript2": "^0.31.2"
},
"dependencies": {
"@semaphore-protocol/identity": "3.12.3",
"@semaphore-protocol/identity": "3.15.1",
"@simplewebauthn/browser": "7.2.0",
"@simplewebauthn/server": "7.2.0"
}

View File

@@ -1,12 +1,13 @@
{
"name": "@semaphore-protocol/identity",
"version": "3.12.3",
"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": [

View File

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

View File

@@ -1,16 +1,13 @@
{
"name": "@semaphore-protocol/proof",
"version": "3.12.3",
"version": "3.15.1",
"description": "A library to generate and verify Semaphore proofs.",
"license": "MIT",
"main": "dist/index.node.js",
"exports": {
"node": {
"import": "./dist/index.node.mjs",
"require": "./dist/index.node.js"
},
"browser": "./dist/index.browser.mjs",
"default": "./dist/index.browser.mjs"
"import": "./dist/index.node.mjs",
"require": "./dist/index.node.js",
"types": "./dist/types/index.d.ts"
},
"types": "dist/types/index.d.ts",
"files": [
@@ -26,9 +23,7 @@
},
"scripts": {
"build:watch": "rollup -c rollup.config.ts -w --configPlugin typescript",
"build": "rimraf dist && yarn build:browser && yarn build:node",
"build:browser": "rollup -c rollup.browser.config.ts --configPlugin typescript",
"build:node": "rollup -c rollup.node.config.ts --configPlugin typescript",
"build": "rimraf dist && rollup -c rollup.config.ts --configPlugin typescript",
"prepublishOnly": "yarn build"
},
"publishConfig": {
@@ -38,25 +33,22 @@
"@rollup/plugin-commonjs": "^24.1.0",
"@rollup/plugin-json": "^5.0.1",
"@rollup/plugin-node-resolve": "^15.0.2",
"@rollup/plugin-replace": "^5.0.3",
"@rollup/plugin-virtual": "^3.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",
"snarkjs": "0.7.1"
"rollup-plugin-typescript2": "^0.31.2"
},
"peerDependencies": {
"@semaphore-protocol/group": "3.12.3",
"@semaphore-protocol/identity": "3.12.3"
"@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/groth16": "0.3.0",
"@zk-kit/incremental-merkle-tree": "0.4.3"
}
}

View File

@@ -1,72 +0,0 @@
import commonjs from "@rollup/plugin-commonjs"
import json from "@rollup/plugin-json"
import { nodeResolve } from "@rollup/plugin-node-resolve"
import replace from "@rollup/plugin-replace"
import virtual from "@rollup/plugin-virtual"
import * as fs from "fs"
import cleanup from "rollup-plugin-cleanup"
import typescript from "rollup-plugin-typescript2"
// Needed by fastfile.
import { O_CREAT, O_EXCL, O_RDONLY, O_RDWR, O_TRUNC } from "constants"
const constants = `
export const O_TRUNC = ${O_TRUNC};
export const O_CREAT = ${O_CREAT};
export const O_RDWR = ${O_RDWR};
export const O_EXCL = ${O_EXCL};
export const O_RDONLY = ${O_RDONLY}
`
const empty = "export default {}"
const pkg = JSON.parse(fs.readFileSync("./package.json", "utf-8"))
const banner = `/**
* @module ${pkg.name}
* @version ${pkg.version}
* @file ${pkg.description}
* @copyright Ethereum Foundation 2022
* @license ${pkg.license}
* @see [Github]{@link ${pkg.homepage}}
*/`
export default {
input: "src/index.ts",
output: [
{
file: pkg.exports.browser,
format: "es",
banner
}
],
external: Object.keys(pkg.dependencies),
plugins: [
typescript({
tsconfig: "./build.tsconfig.json",
useTsconfigDeclarationDir: true
}),
virtual({
fs: empty,
os: empty,
crypto: empty,
readline: empty,
ejs: empty,
events: empty,
stream: empty,
util: empty,
constants
}),
nodeResolve({
browser: true,
preferBuiltins: false,
exportConditions: ["browser", "default", "module", "require"]
}),
commonjs(),
replace({
preventAssignment: false,
"process.browser": true
}),
cleanup({ comments: "jsdoc" }),
json()
]
}

View File

@@ -19,13 +19,13 @@ export default {
input: "src/index.ts",
output: [
{
file: pkg.exports.node.require,
file: pkg.exports.require,
format: "cjs",
banner,
exports: "auto"
},
{
file: pkg.exports.node.import,
file: pkg.exports.import,
format: "es",
banner
}
@@ -37,7 +37,9 @@ export default {
useTsconfigDeclarationDir: true
}),
nodeResolve(),
commonjs(),
commonjs({
esmExternals: true
}),
cleanup({ comments: "jsdoc" }),
json()
]

View File

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

View File

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

View File

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

View File

@@ -1 +1 @@
865dad819e1817c3838abeeeee464ca69ce9eacb
6080ca0da13bd94e110c7e2e1f173c111d19a4aa