diff --git a/dist/index.js b/dist/index.js index a11f945..3571114 100644 --- a/dist/index.js +++ b/dist/index.js @@ -99009,11 +99009,6 @@ function generateAppIdentifier (appName) { // const vkey = JSON.parse(vkeyPath) // doesn't work // const wasmFilePath = path.join('./zkeyFiles', 'rln', 'rln.wasm') // const finalZkeyPath = path.join('./zkeyFiles', 'rln', 'rln_final.zkey') -var zkeyFiles = { - vkeyPath: "/zkeyFiles/verification_key.json", - wasmFilePath: "/zkeyFiles/rln.wasm", - finalZkeyPath: "/zkeyFiles/rln_final.zkey" -}; var RLN = /** @class */ (function () { // private memIndex: number function RLN(appName, onChain, rlnIdentifier) { @@ -99026,17 +99021,17 @@ var RLN = /** @class */ (function () { : generateAppIdentifier(appName); } /* call initRLN to create rln instance */ - RLN.prototype.initRLN = function (existingIdentity) { + RLN.prototype.initRLN = function (vKeyPath, wasmFilePath, finalZkeyPath, existingIdentity) { return __awaiter(this, void 0, void 0, function () { var _a; return __generator(this, function (_b) { switch (_b.label) { case 0: _a = this; - return [4 /*yield*/, fetch(zkeyFiles.vkeyPath).then(function (res) { return res.json(); })]; + return [4 /*yield*/, fetch(vKeyPath).then(function (res) { return res.json(); })]; case 1: _a.vKey = _b.sent(); - this.rlnjs = new rlnjs.RLN(zkeyFiles.wasmFilePath, zkeyFiles.finalZkeyPath, this.vKey, this.rlnIdentifier, existingIdentity); + this.rlnjs = new rlnjs.RLN(wasmFilePath, finalZkeyPath, this.vKey, this.rlnIdentifier, existingIdentity); this.rlnIdentifier = this.rlnjs.rlnIdentifier; this.cache = new rlnjs.Cache(this.rlnjs.rlnIdentifier); this.identityCommitment = this.rlnjs.identity.getCommitment(); diff --git a/dist/index.mjs b/dist/index.mjs index e4fb28c..bf25aba 100644 --- a/dist/index.mjs +++ b/dist/index.mjs @@ -228240,11 +228240,6 @@ function generateAppIdentifier (appName) { // const vkey = JSON.parse(vkeyPath) // doesn't work // const wasmFilePath = path.join('./zkeyFiles', 'rln', 'rln.wasm') // const finalZkeyPath = path.join('./zkeyFiles', 'rln', 'rln_final.zkey') -var zkeyFiles = { - vkeyPath: "/zkeyFiles/verification_key.json", - wasmFilePath: "/zkeyFiles/rln.wasm", - finalZkeyPath: "/zkeyFiles/rln_final.zkey" -}; var RLN = /** @class */ (function () { // private memIndex: number function RLN(appName, onChain, rlnIdentifier) { @@ -228257,17 +228252,17 @@ var RLN = /** @class */ (function () { : generateAppIdentifier(appName); } /* call initRLN to create rln instance */ - RLN.prototype.initRLN = function (existingIdentity) { + RLN.prototype.initRLN = function (vKeyPath, wasmFilePath, finalZkeyPath, existingIdentity) { return __awaiter$1(this, void 0, void 0, function () { var _a; return __generator$1(this, function (_b) { switch (_b.label) { case 0: _a = this; - return [4 /*yield*/, fetch(zkeyFiles.vkeyPath).then(function (res) { return res.json(); })]; + return [4 /*yield*/, fetch(vKeyPath).then(function (res) { return res.json(); })]; case 1: _a.vKey = _b.sent(); - this.rlnjs = new RLN$1(zkeyFiles.wasmFilePath, zkeyFiles.finalZkeyPath, this.vKey, this.rlnIdentifier, existingIdentity); + this.rlnjs = new RLN$1(wasmFilePath, finalZkeyPath, this.vKey, this.rlnIdentifier, existingIdentity); this.rlnIdentifier = this.rlnjs.rlnIdentifier; this.cache = new Cache(this.rlnjs.rlnIdentifier); this.identityCommitment = this.rlnjs.identity.getCommitment(); diff --git a/dist/types/RLN.d.ts b/dist/types/RLN.d.ts index 4cb568c..3d58e97 100644 --- a/dist/types/RLN.d.ts +++ b/dist/types/RLN.d.ts @@ -11,7 +11,7 @@ export default class RLN { identityCommitment?: bigint; vKey?: any; constructor(appName: string, onChain?: Contract, rlnIdentifier?: bigint); - initRLN(existingIdentity?: string): Promise; + initRLN(vKeyPath: string, wasmFilePath: string, finalZkeyPath: string, existingIdentity?: string): Promise; initOnChain(): Promise; generateRLNProof(msg: string, epoch: bigint): Promise; verifyProof(rlnProof: RLNFullProof): Promise; diff --git a/src/RLN.ts b/src/RLN.ts index 12ff150..2dec372 100644 --- a/src/RLN.ts +++ b/src/RLN.ts @@ -12,12 +12,6 @@ import generateAppIdentifier from "./utils/generateAppId" // const wasmFilePath = path.join('./zkeyFiles', 'rln', 'rln.wasm') // const finalZkeyPath = path.join('./zkeyFiles', 'rln', 'rln_final.zkey') -const zkeyFiles = { - vkeyPath: "/zkeyFiles/verification_key.json", - wasmFilePath: "/zkeyFiles/rln.wasm", - finalZkeyPath: "/zkeyFiles/rln_final.zkey" -} - export default class RLN { registry: Registry @@ -47,11 +41,11 @@ export default class RLN { } /* call initRLN to create rln instance */ - public async initRLN(existingIdentity?: string) { - this.vKey = await fetch(zkeyFiles.vkeyPath).then((res) => res.json()) + public async initRLN(vKeyPath: string, wasmFilePath: string, finalZkeyPath: string, existingIdentity?: string) { + this.vKey = await fetch(vKeyPath).then((res) => res.json()) this.rlnjs = new RLNjs( - zkeyFiles.wasmFilePath, - zkeyFiles.finalZkeyPath, + wasmFilePath, + finalZkeyPath, this.vKey, this.rlnIdentifier, existingIdentity