Merge pull request #10 from waku-org/fix-exports

This commit is contained in:
fryorcraken.eth 2022-09-23 16:38:03 +10:00 committed by GitHub
commit b773a96084
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 67 additions and 45 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "@waku/rln",
"version": "0.0.1",
"version": "0.0.3",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@waku/rln",
"version": "0.0.1",
"version": "0.0.3",
"license": "MIT OR Apache-2.0",
"devDependencies": {
"@rollup/plugin-commonjs": "^22.0.2",

View File

@ -1,6 +1,6 @@
{
"name": "@waku/rln",
"version": "0.0.2",
"version": "0.0.3",
"description": "Rate Limit Nullifier for js-waku",
"types": "./dist/index.d.ts",
"module": "./dist/index.js",

View File

@ -1,11 +1,13 @@
import { RLNInstance } from "./rln";
import type { MembershipKey, RateLimitProof, RLNInstance } from "./rln.js";
// reexport the create function, dynamically imported from rln.ts
export async function create(): Promise<RLNInstance> {
// A dependency graph that contains any wasm must all be imported
// asynchronously. This file does the single async import, so
// that no one else needs to worry about it again.
const rlnModule = await import("./rln");
const rlnModule = await import("./rln.js");
return await rlnModule.create();
}
export { RLNInstance, MembershipKey, RateLimitProof };

View File

@ -1,59 +1,73 @@
/* tslint:disable */
/* eslint-disable */
/**
*/
*/
export function init_panic_hook(): void;
/**
* @param {number} tree_height
* @param {Uint8Array} zkey
* @param {Uint8Array} vk
* @returns {number}
*/
export function newRLN(tree_height: number, zkey: Uint8Array, vk: Uint8Array): number;
* @param {number} tree_height
* @param {Uint8Array} zkey
* @param {Uint8Array} vk
* @returns {number}
*/
export function newRLN(
tree_height: number,
zkey: Uint8Array,
vk: Uint8Array
): number;
/**
* @param {number} ctx
* @param {Uint8Array} input
* @returns {Uint8Array}
*/
export function getSerializedRLNWitness(ctx: number, input: Uint8Array): Uint8Array;
* @param {number} ctx
* @param {Uint8Array} input
* @returns {Uint8Array}
*/
export function getSerializedRLNWitness(
ctx: number,
input: Uint8Array
): Uint8Array;
/**
* @param {number} ctx
* @param {Uint8Array} input
*/
* @param {number} ctx
* @param {Uint8Array} input
*/
export function insertMember(ctx: number, input: Uint8Array): void;
/**
* @param {number} ctx
* @param {Uint8Array} serialized_witness
* @returns {object}
*/
export function RLNWitnessToJson(ctx: number, serialized_witness: Uint8Array): object;
* @param {number} ctx
* @param {Uint8Array} serialized_witness
* @returns {object}
*/
export function RLNWitnessToJson(
ctx: number,
serialized_witness: Uint8Array
): object;
/**
* @param {number} ctx
* @param {(bigint)[]} calculated_witness
* @param {Uint8Array} serialized_witness
* @returns {Uint8Array}
*/
export function generate_rln_proof_with_witness(ctx: number, calculated_witness: (bigint)[], serialized_witness: Uint8Array): Uint8Array;
* @param {number} ctx
* @param {(bigint)[]} calculated_witness
* @param {Uint8Array} serialized_witness
* @returns {Uint8Array}
*/
export function generate_rln_proof_with_witness(
ctx: number,
calculated_witness: bigint[],
serialized_witness: Uint8Array
): Uint8Array;
/**
* @param {number} ctx
* @returns {Uint8Array}
*/
* @param {number} ctx
* @returns {Uint8Array}
*/
export function generateMembershipKey(ctx: number): Uint8Array;
/**
* @param {number} ctx
* @param {Uint8Array} proof
* @returns {boolean}
*/
* @param {number} ctx
* @param {Uint8Array} proof
* @returns {boolean}
*/
export function verifyProof(ctx: number, proof: Uint8Array): boolean;
/**
*/
*/
export class RLN {
free(): void;
}
/**
* A struct representing an aborted instruction execution, with a message
* indicating the cause.
*/
* A struct representing an aborted instruction execution, with a message
* indicating the cause.
*/
export class WasmerRuntimeError {
free(): void;
}

View File

@ -1,12 +1,18 @@
/* tslint:disable */
/* eslint-disable */
export const memory: WebAssembly.Memory;
export function __wbg_rln_free(a: number): void;
export function newRLN(a: number, b: number, c: number): number;
export function getSerializedRLNWitness(a: number, b: number): number;
export function insertMember(a: number, b: number, c: number): void;
export function RLNWitnessToJson(a: number, b: number): number;
export function generate_rln_proof_with_witness(a: number, b: number, c: number, d: number, e: number): void;
export function generate_rln_proof_with_witness(
a: number,
b: number,
c: number,
d: number,
e: number
): void;
export function generateMembershipKey(a: number, b: number): void;
export function verifyProof(a: number, b: number): number;
export function init_panic_hook(): void;