fix: multipart secret updates & lint issues

Former-commit-id: 03b9e0c134ec1f4ca80c433d9e4110542d5d8041 [formerly f6c970d916]
Former-commit-id: f2541c7ba4c1c009a70d67c0eff60ec2069e3fd7
This commit is contained in:
bdim1
2021-12-28 10:54:35 +01:00
parent e33e5ea5bb
commit 5945d892ce
3 changed files with 8 additions and 4 deletions

View File

@@ -88,12 +88,12 @@ class ZkIdentity {
* Creates secret from ZkIdentity
* @returns
*/
genSecret(parts: number = 2): void {
genSecret(parts = 2): void {
if(parts < 2) throw new Error("Invalid number of parts");
if(parts === 2) {
this.secret = [this.identityNullifier, this.identityTrapdoor]
} else {
let initialComponent = Fq.pow(this.identityNullifier, this.identityTrapdoor);
const initialComponent = Fq.pow(this.identityTrapdoor, this.identityNullifier);
this.secret = [initialComponent]
for(let i = 1; i < parts; i++) {
this.secret.push(Fq.pow(initialComponent, BigInt(i + 1)))

View File

@@ -1,4 +1,7 @@
/* eslint @typescript-eslint/no-var-requires: "off" */
const ZqField = require("ffjavascript").ZqField
export const SNARK_FIELD_SIZE = BigInt("21888242871839275222246405745257275088548364400416034343698204186575808495617")
const ZqField = require("ffjavascript").ZqField
export const Fq = new ZqField(SNARK_FIELD_SIZE)

View File

@@ -1,7 +1,8 @@
{
"compilerOptions": {
"declaration": true,
"declarationDir": "./dist/types"
"declarationDir": "./dist/types",
},
"include": ["src"]
}