Skip to content

Commit

Permalink
Fix SES error
Browse files Browse the repository at this point in the history
  • Loading branch information
Kolezhniuk committed Jul 14, 2023
1 parent d9bef5b commit d093aaa
Show file tree
Hide file tree
Showing 8 changed files with 918 additions and 1,285 deletions.
2,152 changes: 878 additions & 1,274 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@
"@4c/fetch-mock": "^8.0.0",
"@esbuild-plugins/node-globals-polyfill": "^0.1.1",
"@esbuild-plugins/node-modules-polyfill": "^0.1.4",
"@microsoft/api-documenter": "^7.20.1",
"@microsoft/api-extractor": "^7.34.4",
"@microsoft/api-documenter": "^7.8.20",
"@microsoft/api-extractor": "^7.9.0",
"@types/chai": "^4.3.4",
"@types/chai-as-promised": "^7.1.5",
"@types/elliptic": "^6.4.14",
"@types/jsonld": "^1.4.8",
"@types/jsonld": "^1.5.9",
"@types/mocha": "^10.0.1",
"@types/node": "^18.16.19",
"@types/uuid": "^9.0.2",
Expand Down Expand Up @@ -88,7 +88,6 @@
"ethers": "^5.7.2",
"ffjavascript": "^0.2.57",
"idb-keyval": "^6.2.0",
"ipfs-http-client": "56.0.3",
"jsonld": "^8.1.1",
"multiformats": "^9.6.5",
"rfc4648": "^1.5.2",
Expand Down
8 changes: 5 additions & 3 deletions src/proof/prover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import { CircuitId } from '../circuits';
import { ICircuitStorage } from '../storage/interfaces/circuits';
import { witnessBuilder } from './witness_calculator';
import { byteDecoder } from '../utils';
const snarkjs = require('snarkjs');
const getCurveFromName = require('ffjavascript').getCurveFromName;
import * as snarkjs from 'snarkjs';
import { getCurveFromName } from 'ffjavascript';
import { log } from 'console';

Check warning on line 9 in src/proof/prover.ts

View workflow job for this annotation

GitHub Actions / build (18.16.1)

'log' is defined but never used

/* eslint-disable no-console */

Expand Down Expand Up @@ -54,7 +55,7 @@ export class NativeProver {
await this.terminateCurve();

return {
proof: proof,
proof,
pub_signals: publicSignals
};
} catch (e) {
Expand All @@ -65,6 +66,7 @@ export class NativeProver {

private async terminateCurve(): Promise<void> {
const curve = await getCurveFromName(NativeProver.curveName);
console.log(curve);
curve.terminate();
}
}
6 changes: 3 additions & 3 deletions src/schema-processor/jsonld/parser.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const jsonld = require('jsonld/lib');
const ldcontext = require('jsonld/lib/context');
import * as jsonld from 'jsonld/lib';
import * as ldcontext from 'jsonld/lib/context';

/**
* LDParser can parse JSONLD schema according to specification
Expand All @@ -26,7 +26,7 @@ export class LDParser {
throw new Error(`Failed process LD context. Error ${e}`);
}

const terms = res.mappings as Map<string, unknown>;
const terms = res.mappings;
return terms;
}

Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"strict": true,
},
"include": [
"src"
"src",
"types"
]
}
3 changes: 3 additions & 0 deletions types/ffjavascript.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare module 'ffjavascript' {
export function getCurveFromName(name: string): Promise<{ terminate: () => void }>;
}
11 changes: 11 additions & 0 deletions types/jsonld/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
declare module 'jsonld/lib' {
function processContext(
activeCtx: unknown,
localCtx: unknown,
opts: unknown
): Promise<{ mappings: Map<string, unknown> }>;
}

declare module 'jsonld/lib/context' {
function getInitialContext(opts: unknown): Map<string, unknown>;
}
13 changes: 13 additions & 0 deletions types/snarkjs.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
declare module 'snarkjs' {
export namespace groth16 {
export function verify(verKey: object, pubSignals: string[], proof: object): Promise<void>;

export function prove(
provingKey: object,
wtnsBytes: object
): Promise<{
proof: { pi_a: string[]; pi_b: string[][]; pi_c: string[]; protocol: string };
publicSignals: string[];
}>;
}
}

0 comments on commit d093aaa

Please sign in to comment.