mirror of
https://github.com/CryptKeeperZK/crypt-keeper-extension.git
synced 2026-01-08 21:47:56 -05:00
chore: move common types to @cryptkeeper/types (#539)
* chore: move common types to `@cryptkeeper/types` * fix: run build for check workflow * chore: add prettier ignore * fix: e2e * chore: add missing deps for demo * chore: use ignore path for prettier --------- Co-authored-by: 0xmad <0xmad@users.noreply.github.com>
This commit is contained in:
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@@ -26,7 +26,7 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node-version: [18]
|
||||
env: ["build:chrome", "build:firefox"]
|
||||
env: ["build"]
|
||||
os: [ubuntu-22.04, windows-2022, macos-12]
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
2
.github/workflows/check.yml
vendored
2
.github/workflows/check.yml
vendored
@@ -55,4 +55,6 @@ jobs:
|
||||
|
||||
- run: pnpm install --frozen-lockfile --prefer-offline
|
||||
|
||||
- run: pnpm run build
|
||||
|
||||
- run: pnpm run ${{ matrix.command }}
|
||||
|
||||
19
package.json
19
package.json
@@ -8,10 +8,10 @@
|
||||
"build": "pnpm -r run build",
|
||||
"dev": "pnpm -r run dev",
|
||||
"build:e2e": "pnpm -r run build:e2e",
|
||||
"build:chrome": "pnpm -r run build:chrome",
|
||||
"dev:chrome": "pnpm -r run dev:chrome",
|
||||
"build:firefox": "pnpm -r run build:firefox",
|
||||
"dev:firefox": "pnpm -r run dev:firefox",
|
||||
"build:chrome": "cross-env TARGET=chrome pnpm -r run build",
|
||||
"dev:chrome": "cross-env TARGET=chrome pnpm -r run dev",
|
||||
"build:firefox": "cross-env TARGET=firefox pnpm -r run build",
|
||||
"dev:firefox": "cross-env TARGET=firefox pnpm -r run dev",
|
||||
"merkle": "pnpm -r run merkle",
|
||||
"test": "pnpm -r run test",
|
||||
"test:coverage": "pnpm -r run test:coverage",
|
||||
@@ -48,12 +48,23 @@
|
||||
"@commitlint/cli": "^17.6.5",
|
||||
"@commitlint/config-conventional": "^17.6.5",
|
||||
"@swc/core": "^1.3.66",
|
||||
"assert": "^2.0.0",
|
||||
"buffer": "^5.5.0||^6.0.0",
|
||||
"commitizen": "^4.3.0",
|
||||
"constants-browserify": "^1.0.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"crypto-browserify": "^3.12.0",
|
||||
"cz-conventional-changelog": "^3.3.0",
|
||||
"dotenv": "^16.3.1",
|
||||
"env-cmd": "^10.1.0",
|
||||
"events": "^3.1.0",
|
||||
"husky": "^8.0.3",
|
||||
"is-ci": "^3.0.1",
|
||||
"os-browserify": "^0.3.0",
|
||||
"path-browserify": "^1.0.0",
|
||||
"process": "^0.11.10",
|
||||
"stream-browserify": "^3.0.0",
|
||||
"string_decoder": "^1.3.0",
|
||||
"ts-node": "^10.9.1"
|
||||
},
|
||||
"config": {
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
"nanoid": "<rootDir>/src/config/mock/nanoidMock.js",
|
||||
"@src/(.*)$": "<rootDir>/src/$1"
|
||||
},
|
||||
"modulePathIgnorePatterns": ["<rootDir>/dist/"],
|
||||
"coveragePathIgnorePatterns": [
|
||||
"/node_modules/",
|
||||
"/test/",
|
||||
|
||||
@@ -8,10 +8,6 @@
|
||||
"build": "env-cmd --silent -f ../../.env cross-env NODE_ENV=production webpack --config webpack.prod.js --mode=production",
|
||||
"dev": "env-cmd --silent -f ../../.env cross-env NODE_ENV=development webpack --config webpack.dev.js --mode=development",
|
||||
"build:e2e": "env-cmd --silent -f ../../.env.test cross-env NODE_ENV=production webpack --config webpack.prod.js --mode=production",
|
||||
"build:chrome": "cross-env TARGET=chrome pnpm run build",
|
||||
"dev:chrome": "cross-env TARGET=chrome pnpm run dev",
|
||||
"build:firefox": "cross-env TARGET=firefox pnpm run build",
|
||||
"dev:firefox": "cross-env TARGET=firefox pnpm run dev",
|
||||
"merkle": "ts-node src/server/index.ts",
|
||||
"test": "jest",
|
||||
"test:coverage": "pnpm run test --coverage",
|
||||
@@ -19,8 +15,8 @@
|
||||
"jest:clearCache": "jest --clearCache",
|
||||
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
|
||||
"lint:fix": "pnpm run lint --fix",
|
||||
"prettier": "prettier -c .",
|
||||
"prettier:fix": "prettier -w .",
|
||||
"prettier": "prettier -c . --ignore-path ../../.prettierignore",
|
||||
"prettier:fix": "prettier -w . --ignore-path ../../.prettierignore",
|
||||
"types": "tsc -p tsconfig.json --noEmit",
|
||||
"githook:precommit": "lint-staged && pnpm run types",
|
||||
"githook:prepush": "pnpm run test:coverage"
|
||||
@@ -99,6 +95,7 @@
|
||||
"webpack-merge": "^5.9.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@cryptkeeper/types": "workspace:^",
|
||||
"@emotion/styled": "^11.11.0",
|
||||
"@fortawesome/fontawesome-common-types": "^6.4.0",
|
||||
"@fortawesome/fontawesome-svg-core": "^6.4.0",
|
||||
@@ -109,8 +106,8 @@
|
||||
"@metamask/providers": "^11.0.0",
|
||||
"@mui/material": "^5.13.5",
|
||||
"@reduxjs/toolkit": "^1.9.5",
|
||||
"@semaphore-protocol/group": "^3.9.0",
|
||||
"@semaphore-protocol/identity": "^3.9.0",
|
||||
"@semaphore-protocol/group": "^3.10.1",
|
||||
"@semaphore-protocol/identity": "^3.10.1",
|
||||
"@semaphore-protocol/proof": "^3.10.1",
|
||||
"@types/react-select": "^5.0.1",
|
||||
"@web3-react/core": "^8.2.0",
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
export interface InjectedMessageData<M = unknown, P = unknown> {
|
||||
target: string;
|
||||
nonce: string;
|
||||
message: M;
|
||||
payload: [string, P];
|
||||
}
|
||||
|
||||
export interface InjectedProviderRequest {
|
||||
method: string;
|
||||
payload?: unknown;
|
||||
error?: boolean;
|
||||
meta?: Record<string, unknown>;
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
import { RequestResolutionStatus } from "../request";
|
||||
|
||||
export type RequestResolutionAction<data = unknown> = {
|
||||
id: string;
|
||||
status: RequestResolutionStatus;
|
||||
data?: data;
|
||||
};
|
||||
|
||||
export type MessageAction = {
|
||||
method: string;
|
||||
payload?: unknown;
|
||||
error?: boolean;
|
||||
meta?: unknown;
|
||||
};
|
||||
|
||||
export type ReduxAction = {
|
||||
type: string;
|
||||
payload?: unknown;
|
||||
error?: boolean;
|
||||
meta?: unknown;
|
||||
};
|
||||
|
||||
export type * from "./identities";
|
||||
@@ -1,4 +1,4 @@
|
||||
import { IdentityData } from "../identity";
|
||||
import type { IdentityData } from "@cryptkeeper/types";
|
||||
|
||||
export enum OperationType {
|
||||
CREATE_IDENTITY = "CREATE_IDENTITY",
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
export * from "./proof";
|
||||
export * from "./identity";
|
||||
export * from "@cryptkeeper/types";
|
||||
export * from "./history";
|
||||
export * from "./request";
|
||||
export * from "./contentScript";
|
||||
export * from "./forms";
|
||||
export * from "./duck";
|
||||
export * from "./utility";
|
||||
export * from "./backup";
|
||||
export * from "./approval";
|
||||
export * from "./misc";
|
||||
export * from "./wallet";
|
||||
export * from "./hooks";
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
export * from "./Merkle";
|
||||
export * from "./RLNProof";
|
||||
export * from "./SemaphoreProof";
|
||||
export * from "./ZkProof";
|
||||
4
packages/app/tsconfig.build.json
Normal file
4
packages/app/tsconfig.build.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"exclude": ["src/**/*.test.tsx", "src/**/*.test.ts"]
|
||||
}
|
||||
@@ -76,6 +76,9 @@ module.exports = {
|
||||
test: /\.tsx?$/,
|
||||
use: {
|
||||
loader: "ts-loader",
|
||||
options: {
|
||||
configFile: "tsconfig.build.json",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -3,16 +3,19 @@
|
||||
"private": true,
|
||||
"version": "0.1.0",
|
||||
"scripts": {
|
||||
"start": "parcel serve --no-cache index.html"
|
||||
"start": "parcel serve --no-cache index.html",
|
||||
"build": "parcel build index.html",
|
||||
"build:e2e": "pnpm run build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@semaphore-protocol/identity": "^3.9.0",
|
||||
"@cryptkeeper/types": "workspace:^",
|
||||
"@semaphore-protocol/identity": "^3.10.1",
|
||||
"bigint-conversion": "^2.4.1",
|
||||
"ethers": "^6.6.0",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-toastify": "^9.1.3",
|
||||
"rlnjs": "^3.1.0"
|
||||
"rlnjs": "^2.0.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^18.2.13",
|
||||
|
||||
@@ -1,16 +1,5 @@
|
||||
// TODO: temp until providers package isn't ready
|
||||
import type { FullProof } from "@semaphore-protocol/proof";
|
||||
import type { RLNFullProof } from "rlnjs";
|
||||
|
||||
export interface ConnectedIdentity {
|
||||
commitment: string;
|
||||
web2Provider?: string;
|
||||
host?: string;
|
||||
}
|
||||
|
||||
export interface SemaphoreProof {
|
||||
fullProof: FullProof;
|
||||
}
|
||||
import type { RLNFullProof, SemaphoreProof, ConnectedIdentity } from "@cryptkeeper/types";
|
||||
|
||||
export interface CryptKeeperInjectedProvider {
|
||||
accounts: () => Promise<string[]>;
|
||||
@@ -33,9 +22,3 @@ export interface CryptKeeperInjectedProvider {
|
||||
): Promise<RLNFullProof>;
|
||||
on: (event: string, handler: (...args: unknown[]) => void) => void;
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
cryptkeeper: CryptKeeperInjectedProvider;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
/* eslint-disable no-console */
|
||||
import { useState, useEffect, useCallback } from "react";
|
||||
import { RLN, RLNFullProof } from "rlnjs";
|
||||
import { bigintToHex } from "bigint-conversion";
|
||||
import type { ConnectedIdentity, SemaphoreProof, RLNFullProof } from "@cryptkeeper/types";
|
||||
import { Identity } from "@semaphore-protocol/identity";
|
||||
import { bigintToHex } from "bigint-conversion";
|
||||
import { encodeBytes32String } from "ethers";
|
||||
import { useState, useEffect, useCallback } from "react";
|
||||
import { toast } from "react-toastify";
|
||||
import { RLN } from "rlnjs";
|
||||
|
||||
import "react-toastify/dist/ReactToastify.css";
|
||||
import type { CryptKeeperInjectedProvider, ConnectedIdentity, SemaphoreProof } from "./types";
|
||||
import type { CryptKeeperInjectedProvider } from "./types";
|
||||
|
||||
const SERVER_URL = "http://localhost:8090";
|
||||
|
||||
@@ -42,7 +43,7 @@ interface IUseCryptKeeperData {
|
||||
genRLNProof: (proofType: MerkleProofType) => void;
|
||||
}
|
||||
|
||||
const initializeClient = (): Promise<CryptKeeperInjectedProvider | undefined> => window.cryptkeeper?.connect();
|
||||
const initializeClient = (): Promise<CryptKeeperInjectedProvider | undefined> => (window.cryptkeeper as any)?.connect();
|
||||
|
||||
export const useCryptKeeper = (): IUseCryptKeeperData => {
|
||||
const [client, setClient] = useState<CryptKeeperInjectedProvider>();
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
"e2e:debug": "pnpm run e2e -- --debug",
|
||||
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
|
||||
"lint:fix": "pnpm run lint --fix",
|
||||
"prettier": "prettier -c .",
|
||||
"prettier:fix": "prettier -w .",
|
||||
"prettier": "prettier -c . --ignore-path ../../.prettierignore",
|
||||
"prettier:fix": "prettier -w . --ignore-path ../../.prettierignore",
|
||||
"types": "tsc -p tsconfig.json --noEmit",
|
||||
"githook:precommit": "lint-staged && pnpm run types"
|
||||
},
|
||||
|
||||
3
packages/eslint-config-base/.lintstagedrc.json
Normal file
3
packages/eslint-config-base/.lintstagedrc.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"**/*.{js,json}": ["pretty-quick --pattern '**/*.*(js|json)' --staged"]
|
||||
}
|
||||
@@ -10,6 +10,11 @@
|
||||
"url": "https://github.com/privacy-scaling-explorations/crypt-keeper-extension"
|
||||
},
|
||||
"homepage": "https://github.com/privacy-scaling-explorations/crypt-keeper-extension",
|
||||
"scripts": {
|
||||
"prettier": "prettier -c . --ignore-path ../../.prettierignore",
|
||||
"prettier:fix": "prettier -w . --ignore-path ../../.prettierignore",
|
||||
"githook:precommit": "lint-staged"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/eslint-parser": "^7.22.5",
|
||||
"@typescript-eslint/eslint-plugin": "^5.60.0",
|
||||
@@ -22,5 +27,9 @@
|
||||
"eslint-plugin-json": "^3.1.0",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"eslint-plugin-unused-imports": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"lint-staged": "^13.2.2",
|
||||
"pretty-quick": "^3.1.3"
|
||||
}
|
||||
}
|
||||
|
||||
3
packages/eslint-config-react/.lintstagedrc.json
Normal file
3
packages/eslint-config-react/.lintstagedrc.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"**/*.{js,json}": ["pretty-quick --pattern '**/*.*(js|json)' --staged"]
|
||||
}
|
||||
@@ -10,6 +10,11 @@
|
||||
"url": "https://github.com/privacy-scaling-explorations/crypt-keeper-extension"
|
||||
},
|
||||
"homepage": "https://github.com/privacy-scaling-explorations/crypt-keeper-extension",
|
||||
"scripts": {
|
||||
"prettier": "prettier -c . --ignore-path ../../.prettierignore",
|
||||
"prettier:fix": "prettier -w . --ignore-path ../../.prettierignore",
|
||||
"githook:precommit": "lint-staged"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/eslint-parser": "^7.22.5",
|
||||
"@cryptkeeper/eslint-config-base": "workspace:^",
|
||||
@@ -19,5 +24,9 @@
|
||||
"eslint-plugin-jsx-a11y": "^6.7.1",
|
||||
"eslint-plugin-react": "^7.32.2",
|
||||
"eslint-plugin-react-hooks": "^4.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"lint-staged": "^13.2.2",
|
||||
"pretty-quick": "^3.1.3"
|
||||
}
|
||||
}
|
||||
|
||||
3
packages/types/.eslintignore
Normal file
3
packages/types/.eslintignore
Normal file
@@ -0,0 +1,3 @@
|
||||
node_modules/
|
||||
dist/
|
||||
|
||||
9
packages/types/.eslintrc.js
Normal file
9
packages/types/.eslintrc.js
Normal file
@@ -0,0 +1,9 @@
|
||||
module.exports = {
|
||||
extends: ["@cryptkeeper/eslint-config-base"],
|
||||
ignorePatterns: [".eslintrc.js"],
|
||||
settings: {
|
||||
react: {
|
||||
version: "18",
|
||||
},
|
||||
},
|
||||
};
|
||||
3
packages/types/.lintstagedrc.json
Normal file
3
packages/types/.lintstagedrc.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"**/*.{ts,js,json}": ["pretty-quick --pattern '**/*.*(js|tx|jsx|tsx|json)' --staged", "pnpm run lint:fix"]
|
||||
}
|
||||
49
packages/types/package.json
Normal file
49
packages/types/package.json
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"name": "@cryptkeeper/types",
|
||||
"version": "0.1.0",
|
||||
"description": "CryptKeeper Extension types",
|
||||
"main": "./dist/src/index.js",
|
||||
"types": "./dist/src/index.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com"
|
||||
},
|
||||
"keywords": [
|
||||
"react",
|
||||
"typescript",
|
||||
"chrome",
|
||||
"firefox",
|
||||
"extension",
|
||||
"types"
|
||||
],
|
||||
"author": "Privacy and Scaling explorations team",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/privacy-scaling-explorations/crypt-keeper-extension"
|
||||
},
|
||||
"homepage": "https://github.com/privacy-scaling-explorations/crypt-keeper-extension",
|
||||
"scripts": {
|
||||
"build": "tsc -p tsconfig.json",
|
||||
"build:e2e": "pnpm run build",
|
||||
"dev": "pnpm run build",
|
||||
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
|
||||
"lint:fix": "pnpm run lint --fix",
|
||||
"prettier": "prettier -c . --ignore-path ../../.prettierignore",
|
||||
"prettier:fix": "prettier -w . --ignore-path ../../.prettierignore",
|
||||
"types": "tsc -p tsconfig.json --noEmit",
|
||||
"githook:precommit": "lint-staged && pnpm run types"
|
||||
},
|
||||
"dependencies": {
|
||||
"@semaphore-protocol/proof": "^3.10.1",
|
||||
"@zk-kit/incremental-merkle-tree": "^1.1.0",
|
||||
"rlnjs": "^2.0.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@cryptkeeper/eslint-config-base": "workspace:^",
|
||||
"eslint": "^8.43.0",
|
||||
"lint-staged": "^13.2.2",
|
||||
"prettier": "^2.8.8",
|
||||
"pretty-quick": "^3.1.3",
|
||||
"typescript": "^5.1.3"
|
||||
}
|
||||
}
|
||||
13
packages/types/src/contentScript/index.ts
Normal file
13
packages/types/src/contentScript/index.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
export interface InjectedMessageData<P = unknown, M = unknown> {
|
||||
target: string;
|
||||
nonce: string;
|
||||
message: M;
|
||||
payload: [string, P];
|
||||
}
|
||||
|
||||
export interface InjectedProviderRequest<P = unknown, M = unknown> {
|
||||
method: string;
|
||||
payload?: P;
|
||||
error?: boolean;
|
||||
meta?: Record<string, M>;
|
||||
}
|
||||
23
packages/types/src/duck/index.ts
Normal file
23
packages/types/src/duck/index.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { RequestResolutionStatus } from "../request";
|
||||
|
||||
export interface RequestResolutionAction<D = unknown> {
|
||||
id: string;
|
||||
status: RequestResolutionStatus;
|
||||
data?: D;
|
||||
}
|
||||
|
||||
export interface MessageAction<P = unknown, M = unknown> {
|
||||
method: string;
|
||||
payload?: P;
|
||||
error?: boolean;
|
||||
meta?: M;
|
||||
}
|
||||
|
||||
export interface ReduxAction<P = unknown, M = unknown> {
|
||||
type: string;
|
||||
payload?: P;
|
||||
error?: boolean;
|
||||
meta?: M;
|
||||
}
|
||||
|
||||
export type * from "./identities";
|
||||
@@ -2,13 +2,13 @@ export type IdentityStrategy = "interrep" | "random";
|
||||
|
||||
export type IdentityWeb2Provider = "twitter" | "github" | "reddit";
|
||||
|
||||
export type CreateIdentityOptions = {
|
||||
export interface CreateIdentityOptions {
|
||||
message: string;
|
||||
account: string;
|
||||
nonce?: number;
|
||||
web2Provider?: IdentityWeb2Provider;
|
||||
name?: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface ICreateIdentityRequestArgs {
|
||||
host: string;
|
||||
@@ -18,14 +18,14 @@ export interface IConnectIdentityRequestArgs {
|
||||
host: string;
|
||||
}
|
||||
|
||||
export type NewIdentityRequest = {
|
||||
export interface NewIdentityRequest {
|
||||
strategy: IdentityStrategy;
|
||||
options: CreateIdentityOptions;
|
||||
walletType: EWallet;
|
||||
groups: GroupData[];
|
||||
host?: string;
|
||||
messageSignature?: string;
|
||||
};
|
||||
}
|
||||
|
||||
export enum EWallet {
|
||||
ETH_WALLET,
|
||||
@@ -85,7 +85,7 @@ export interface ICreateIdentityArgs {
|
||||
host?: string;
|
||||
}
|
||||
|
||||
export type StrategiesMap = {
|
||||
export interface StrategiesMap {
|
||||
random: (config: ICreateIdentityArgs) => void;
|
||||
interrep: (config: ICreateIdentityArgs) => void;
|
||||
};
|
||||
}
|
||||
6
packages/types/src/index.ts
Normal file
6
packages/types/src/index.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export * from "./proof";
|
||||
export * from "./identity";
|
||||
export * from "./request";
|
||||
export * from "./contentScript";
|
||||
export * from "./duck";
|
||||
export * from "./approval";
|
||||
4
packages/types/src/proof/index.ts
Normal file
4
packages/types/src/proof/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export * from "./merkle";
|
||||
export * from "./rlnProof";
|
||||
export * from "./semaphoreProof";
|
||||
export * from "./zkProof";
|
||||
@@ -1,7 +1,7 @@
|
||||
export type { MerkleProof } from "@zk-kit/incremental-merkle-tree";
|
||||
|
||||
export type MerkleProofArtifacts = {
|
||||
export interface MerkleProofArtifacts {
|
||||
leaves: string[];
|
||||
depth: number;
|
||||
leavesPerNode: number;
|
||||
};
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { SemaphoreProofRequest } from "./SemaphoreProof";
|
||||
import { SemaphoreProofRequest } from "./semaphoreProof";
|
||||
|
||||
export type { RLNFullProof, VerificationKey } from "rlnjs";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { FullProof } from "@semaphore-protocol/proof";
|
||||
import { MerkleProof } from "@zk-kit/incremental-merkle-tree";
|
||||
|
||||
import { MerkleProofArtifacts } from "./Merkle";
|
||||
import { MerkleProofArtifacts } from "./merkle";
|
||||
|
||||
export interface SemaphoreProof {
|
||||
fullProof: FullProof;
|
||||
@@ -1,10 +1,10 @@
|
||||
import { MerkleProofArtifacts, MerkleProof } from "./Merkle";
|
||||
import { MerkleProofArtifacts, MerkleProof } from "./merkle";
|
||||
|
||||
export type ZkInputs = {
|
||||
export interface ZkInputs {
|
||||
merkleStorageAddress?: string;
|
||||
merkleProofArtifacts?: MerkleProofArtifacts;
|
||||
merkleProof?: MerkleProof;
|
||||
};
|
||||
}
|
||||
|
||||
export interface ZKProofPayload {
|
||||
externalNullifier: string;
|
||||
@@ -3,12 +3,12 @@ export enum RequestResolutionStatus {
|
||||
REJECT = "reject",
|
||||
}
|
||||
|
||||
export type RequestHandler = {
|
||||
export interface RequestHandler<P = unknown, M = unknown> {
|
||||
method: string;
|
||||
payload?: unknown;
|
||||
error?: boolean;
|
||||
meta?: unknown;
|
||||
};
|
||||
payload?: P;
|
||||
error?: Error;
|
||||
meta?: M;
|
||||
}
|
||||
|
||||
export enum PendingRequestType {
|
||||
SEMAPHORE_PROOF,
|
||||
12
packages/types/tsconfig.json
Normal file
12
packages/types/tsconfig.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"rootDir": ".",
|
||||
"outDir": "./dist",
|
||||
"typeRoots": ["./node_modules/@types"],
|
||||
"lib": ["es2020"]
|
||||
},
|
||||
"include": ["src"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
||||
150
pnpm-lock.yaml
generated
150
pnpm-lock.yaml
generated
@@ -17,9 +17,24 @@ importers:
|
||||
'@swc/core':
|
||||
specifier: ^1.3.66
|
||||
version: 1.3.66
|
||||
assert:
|
||||
specifier: ^2.0.0
|
||||
version: 2.0.0
|
||||
buffer:
|
||||
specifier: ^5.5.0||^6.0.0
|
||||
version: 5.7.1
|
||||
commitizen:
|
||||
specifier: ^4.3.0
|
||||
version: 4.3.0(@swc/core@1.3.66)
|
||||
constants-browserify:
|
||||
specifier: ^1.0.0
|
||||
version: 1.0.0
|
||||
cross-env:
|
||||
specifier: ^7.0.3
|
||||
version: 7.0.3
|
||||
crypto-browserify:
|
||||
specifier: ^3.12.0
|
||||
version: 3.12.0
|
||||
cz-conventional-changelog:
|
||||
specifier: ^3.3.0
|
||||
version: 3.3.0(@swc/core@1.3.66)
|
||||
@@ -29,18 +44,39 @@ importers:
|
||||
env-cmd:
|
||||
specifier: ^10.1.0
|
||||
version: 10.1.0
|
||||
events:
|
||||
specifier: ^3.1.0
|
||||
version: 3.3.0
|
||||
husky:
|
||||
specifier: ^8.0.3
|
||||
version: 8.0.3
|
||||
is-ci:
|
||||
specifier: ^3.0.1
|
||||
version: 3.0.1
|
||||
os-browserify:
|
||||
specifier: ^0.3.0
|
||||
version: 0.3.0
|
||||
path-browserify:
|
||||
specifier: ^1.0.0
|
||||
version: 1.0.1
|
||||
process:
|
||||
specifier: ^0.11.10
|
||||
version: 0.11.10
|
||||
stream-browserify:
|
||||
specifier: ^3.0.0
|
||||
version: 3.0.0
|
||||
string_decoder:
|
||||
specifier: ^1.3.0
|
||||
version: 1.3.0
|
||||
ts-node:
|
||||
specifier: ^10.9.1
|
||||
version: 10.9.1(@swc/core@1.3.66)(@types/node@20.3.1)(typescript@5.1.3)
|
||||
|
||||
packages/app:
|
||||
dependencies:
|
||||
'@cryptkeeper/types':
|
||||
specifier: workspace:^
|
||||
version: link:../types
|
||||
'@emotion/styled':
|
||||
specifier: ^11.11.0
|
||||
version: 11.11.0(@emotion/react@11.11.1)(@types/react@18.2.13)(react@18.2.0)
|
||||
@@ -72,14 +108,14 @@ importers:
|
||||
specifier: ^1.9.5
|
||||
version: 1.9.5(react-redux@8.1.1)(react@18.2.0)
|
||||
'@semaphore-protocol/group':
|
||||
specifier: ^3.9.0
|
||||
version: 3.9.0
|
||||
specifier: ^3.10.1
|
||||
version: 3.10.1
|
||||
'@semaphore-protocol/identity':
|
||||
specifier: ^3.9.0
|
||||
version: 3.9.0
|
||||
specifier: ^3.10.1
|
||||
version: 3.10.1
|
||||
'@semaphore-protocol/proof':
|
||||
specifier: ^3.10.1
|
||||
version: 3.10.1(@semaphore-protocol/group@3.9.0)(@semaphore-protocol/identity@3.9.0)
|
||||
version: 3.10.1(@semaphore-protocol/group@3.10.1)(@semaphore-protocol/identity@3.10.1)
|
||||
'@types/react-select':
|
||||
specifier: ^5.0.1
|
||||
version: 5.0.1(@types/react@18.2.13)(react-dom@18.2.0)(react@18.2.0)
|
||||
@@ -348,8 +384,11 @@ importers:
|
||||
|
||||
packages/demo:
|
||||
dependencies:
|
||||
'@cryptkeeper/types':
|
||||
specifier: workspace:^
|
||||
version: link:../types
|
||||
'@semaphore-protocol/identity':
|
||||
specifier: ^3.9.0
|
||||
specifier: ^3.10.1
|
||||
version: 3.10.1
|
||||
bigint-conversion:
|
||||
specifier: ^2.4.1
|
||||
@@ -367,8 +406,8 @@ importers:
|
||||
specifier: ^9.1.3
|
||||
version: 9.1.3(react-dom@18.2.0)(react@18.2.0)
|
||||
rlnjs:
|
||||
specifier: ^3.1.0
|
||||
version: 3.1.0
|
||||
specifier: ^2.0.8
|
||||
version: 2.0.8
|
||||
devDependencies:
|
||||
'@types/react':
|
||||
specifier: ^18.2.13
|
||||
@@ -463,6 +502,13 @@ importers:
|
||||
eslint-plugin-unused-imports:
|
||||
specifier: ^2.0.0
|
||||
version: 2.0.0(@typescript-eslint/eslint-plugin@5.60.0)(eslint@8.43.0)
|
||||
devDependencies:
|
||||
lint-staged:
|
||||
specifier: ^13.2.2
|
||||
version: 13.2.2
|
||||
pretty-quick:
|
||||
specifier: ^3.1.3
|
||||
version: 3.1.3(prettier@2.8.8)
|
||||
|
||||
packages/eslint-config-react:
|
||||
dependencies:
|
||||
@@ -490,6 +536,44 @@ importers:
|
||||
eslint-plugin-react-hooks:
|
||||
specifier: ^4.6.0
|
||||
version: 4.6.0(eslint@8.43.0)
|
||||
devDependencies:
|
||||
lint-staged:
|
||||
specifier: ^13.2.2
|
||||
version: 13.2.2
|
||||
pretty-quick:
|
||||
specifier: ^3.1.3
|
||||
version: 3.1.3(prettier@2.8.8)
|
||||
|
||||
packages/types:
|
||||
dependencies:
|
||||
'@semaphore-protocol/proof':
|
||||
specifier: ^3.10.1
|
||||
version: 3.10.1(@semaphore-protocol/group@3.10.1)(@semaphore-protocol/identity@3.10.1)
|
||||
'@zk-kit/incremental-merkle-tree':
|
||||
specifier: ^1.1.0
|
||||
version: 1.1.0
|
||||
rlnjs:
|
||||
specifier: ^2.0.8
|
||||
version: 2.0.8
|
||||
devDependencies:
|
||||
'@cryptkeeper/eslint-config-base':
|
||||
specifier: workspace:^
|
||||
version: link:../eslint-config-base
|
||||
eslint:
|
||||
specifier: ^8.43.0
|
||||
version: 8.43.0
|
||||
lint-staged:
|
||||
specifier: ^13.2.2
|
||||
version: 13.2.2
|
||||
prettier:
|
||||
specifier: ^2.8.8
|
||||
version: 2.8.8
|
||||
pretty-quick:
|
||||
specifier: ^3.1.3
|
||||
version: 3.1.3(prettier@2.8.8)
|
||||
typescript:
|
||||
specifier: ^5.1.3
|
||||
version: 5.1.3
|
||||
|
||||
packages:
|
||||
|
||||
@@ -2525,7 +2609,7 @@ packages:
|
||||
resolution: {integrity: sha512-LylnJoZ0CTdgErnKY8OxohvW4K+p6UHD3sxt+3P9AmMyBQjYR4IpoqoYZZ+9aMj89cmCQ21UvdhndAx04er3NA==}
|
||||
dependencies:
|
||||
fastfile: 0.0.20
|
||||
ffjavascript: 0.2.55
|
||||
ffjavascript: 0.2.59
|
||||
dev: false
|
||||
|
||||
/@interep/identity@0.3.0:
|
||||
@@ -3956,15 +4040,6 @@ packages:
|
||||
'@zk-kit/incremental-merkle-tree': 1.1.0
|
||||
dev: false
|
||||
|
||||
/@semaphore-protocol/group@3.9.0:
|
||||
resolution: {integrity: sha512-HcmIib9zq+0Br9TLgRy80r+/e2FSnmzN6//tmOFjUAtRquvpKYcDH2XsUkQYN5/Am7PtLoQc2fREpCsuYKeOUg==}
|
||||
dependencies:
|
||||
'@ethersproject/bignumber': 5.7.0
|
||||
'@ethersproject/bytes': 5.7.0
|
||||
'@ethersproject/keccak256': 5.7.0
|
||||
'@zk-kit/incremental-merkle-tree': 1.0.0
|
||||
dev: false
|
||||
|
||||
/@semaphore-protocol/identity@2.6.1:
|
||||
resolution: {integrity: sha512-pS3+p1Oer0P+S2AyRPrZcLqrWvelgVmweUuMC2hodRF5yEBUmLwXI/kez4qw8zOqwCXiAFpLTevaGlpp2EhsWg==}
|
||||
dependencies:
|
||||
@@ -3990,17 +4065,7 @@ packages:
|
||||
js-sha512: 0.8.0
|
||||
dev: false
|
||||
|
||||
/@semaphore-protocol/identity@3.9.0:
|
||||
resolution: {integrity: sha512-f289QUGWuqbMRzocZBqyM7X/+fuP4Mn5lvsBUqLDVgDmYBu5W2ggTTKzZ4fYwFI4TzkkgMgR1M5nIr6ed+B91w==}
|
||||
dependencies:
|
||||
'@ethersproject/bignumber': 5.7.0
|
||||
'@ethersproject/keccak256': 5.7.0
|
||||
'@ethersproject/random': 5.7.0
|
||||
'@ethersproject/strings': 5.7.0
|
||||
js-sha512: 0.8.0
|
||||
dev: false
|
||||
|
||||
/@semaphore-protocol/proof@3.10.1(@semaphore-protocol/group@3.9.0)(@semaphore-protocol/identity@3.9.0):
|
||||
/@semaphore-protocol/proof@3.10.1(@semaphore-protocol/group@3.10.1)(@semaphore-protocol/identity@3.10.1):
|
||||
resolution: {integrity: sha512-MyJkosprFbgcG1EXUp32s6+OaFXS10wumwBwCWX6LMPRmsg4cGJALevnqNNtCLtT/Xb2ppdbcMlc2CxtxSY2+w==}
|
||||
peerDependencies:
|
||||
'@semaphore-protocol/group': 3.10.1
|
||||
@@ -4010,8 +4075,8 @@ packages:
|
||||
'@ethersproject/bytes': 5.7.0
|
||||
'@ethersproject/keccak256': 5.7.0
|
||||
'@ethersproject/strings': 5.7.0
|
||||
'@semaphore-protocol/group': 3.9.0
|
||||
'@semaphore-protocol/identity': 3.9.0
|
||||
'@semaphore-protocol/group': 3.10.1
|
||||
'@semaphore-protocol/identity': 3.10.1
|
||||
'@zk-kit/incremental-merkle-tree': 0.4.3
|
||||
snarkjs: 0.4.13
|
||||
dev: false
|
||||
@@ -5207,10 +5272,6 @@ packages:
|
||||
resolution: {integrity: sha512-2qHfrJXtPx8/UmF0wFAUr4VqCLr3J/P859fk/e3fwKLUnf3baeIUAO6inY4wrh0NGy4bzpKUWYjDph0yTbPz6A==}
|
||||
dev: false
|
||||
|
||||
/@zk-kit/incremental-merkle-tree@1.0.0:
|
||||
resolution: {integrity: sha512-2iRLZfHnZ6wKE+oZN2CnpkKYCE5f5dpv6YRIwLDCz0xwJZrIMQ81AamFBdxPesQSYMMP0GkC0iv1rm6gxAL2Ow==}
|
||||
dev: false
|
||||
|
||||
/@zk-kit/incremental-merkle-tree@1.1.0:
|
||||
resolution: {integrity: sha512-WnNR/GQse3lX8zOHMU8zwhgX8u3qPoul8w4GjJ0WDHq+VGJimo7EGheRZ/ILeBQabnlzAerdv3vBqYBehBeoKA==}
|
||||
dev: false
|
||||
@@ -13842,25 +13903,6 @@ packages:
|
||||
- utf-8-validate
|
||||
dev: false
|
||||
|
||||
/rlnjs@3.1.0:
|
||||
resolution: {integrity: sha512-XTfJD56LLSTwlhNgWiTEM68u9IwBIP4KBK7yfwKJ0rjVVrcTglwYex7vX4ntdhGfpZQYhI0Z2yjoZZxh/3OL7w==}
|
||||
dependencies:
|
||||
'@ethersproject/bytes': 5.7.0
|
||||
'@ethersproject/keccak256': 5.7.0
|
||||
'@ethersproject/solidity': 5.7.0
|
||||
'@ethersproject/strings': 5.7.0
|
||||
'@semaphore-protocol/group': 3.10.1
|
||||
'@semaphore-protocol/identity': 3.10.1
|
||||
'@zk-kit/incremental-merkle-tree': 0.4.3
|
||||
ethers: 6.6.0
|
||||
ffjavascript: 0.2.55
|
||||
poseidon-lite: 0.0.2
|
||||
snarkjs: 0.4.27
|
||||
transitivePeerDependencies:
|
||||
- bufferutil
|
||||
- utf-8-validate
|
||||
dev: false
|
||||
|
||||
/rlp@2.2.7:
|
||||
resolution: {integrity: sha512-d5gdPmgQ0Z+AklL2NVXr/IoSjNZFfTVvQWzL/AM2AOcSzYP2xjlb0AC8YyCLc41MSNf6P6QVtjgPdmVtzb+4lQ==}
|
||||
hasBin: true
|
||||
|
||||
@@ -28,5 +28,5 @@
|
||||
},
|
||||
"esm": true,
|
||||
"swc": true
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user