Socket
Socket
Sign inDemoInstall

@noir-lang/acvm_js

Package Overview
Dependencies
Maintainers
1
Versions
255
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@noir-lang/acvm_js - npm Package Compare versions

Comparing version 0.46.0-86fd0ac.nightly to 0.46.0-ab0b1a8.nightly

26

nodejs/acvm_js_bg.wasm.d.ts
/* tslint:disable */
/* eslint-disable */
export const memory: WebAssembly.Memory;
export function initLogLevel(a: number, b: number, c: number): void;
export function compressWitness(a: number, b: number): void;
export function decompressWitness(a: number, b: number, c: number): void;
export function compressWitnessStack(a: number, b: number): void;
export function decompressWitnessStack(a: number, b: number, c: number): void;
export function getReturnWitness(a: number, b: number, c: number, d: number): void;
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
export function getPublicWitness(a: number, b: number, c: number, d: number): void;
export function executeCircuit(a: number, b: number, c: number, d: number): number;
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
export function executeProgram(a: number, b: number, c: number, d: number): number;
export function and(a: number, b: number): number;

@@ -11,18 +22,3 @@ export function xor(a: number, b: number): number;

export function ecdsa_secp256r1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
export function __wbg_wasmblackboxfunctionsolver_free(a: number): void;
export function createBlackBoxSolver(): number;
export function executeCircuit(a: number, b: number, c: number, d: number): number;
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number, e: number): number;
export function executeCircuitWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number;
export function executeProgram(a: number, b: number, c: number, d: number): number;
export function executeProgramWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number;
export function initLogLevel(a: number, b: number, c: number): void;
export function buildInfo(): number;
export function compressWitness(a: number, b: number): void;
export function decompressWitness(a: number, b: number, c: number): void;
export function compressWitnessStack(a: number, b: number): void;
export function decompressWitnessStack(a: number, b: number, c: number): void;
export function getReturnWitness(a: number, b: number, c: number, d: number): void;
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
export function getPublicWitness(a: number, b: number, c: number, d: number): void;
export function __wbindgen_malloc(a: number): number;

@@ -29,0 +25,0 @@ export function __wbindgen_realloc(a: number, b: number, c: number): number;

/* tslint:disable */
/* eslint-disable */
/**
* Performs a bitwise AND operation between `lhs` and `rhs`
* @param {string} lhs
* @param {string} rhs
* @returns {string}
*/
export function and(lhs: string, rhs: string): string;
/**
* Performs a bitwise XOR operation between `lhs` and `rhs`
* @param {string} lhs
* @param {string} rhs
* @returns {string}
*/
export function xor(lhs: string, rhs: string): string;
/**
* Calculates the SHA256 hash of the input bytes
* @param {Uint8Array} inputs
* @returns {Uint8Array}
*/
export function sha256(inputs: Uint8Array): Uint8Array;
/**
* Calculates the Blake2s256 hash of the input bytes
* @param {Uint8Array} inputs
* @returns {Uint8Array}
*/
export function blake2s256(inputs: Uint8Array): Uint8Array;
/**
* Calculates the Keccak256 hash of the input bytes
* @param {Uint8Array} inputs
* @returns {Uint8Array}
*/
export function keccak256(inputs: Uint8Array): Uint8Array;
/**
* Verifies a ECDSA signature over the secp256k1 curve.
* @param {Uint8Array} hashed_msg
* @param {Uint8Array} public_key_x_bytes
* @param {Uint8Array} public_key_y_bytes
* @param {Uint8Array} signature
* @returns {boolean}
*/
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
/**
* Verifies a ECDSA signature over the secp256r1 curve.
* @param {Uint8Array} hashed_msg
* @param {Uint8Array} public_key_x_bytes
* @param {Uint8Array} public_key_y_bytes
* @param {Uint8Array} signature
* @returns {boolean}
*/
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
/**
* @returns {Promise<WasmBlackBoxFunctionSolver>}
*/
export function createBlackBoxSolver(): Promise<WasmBlackBoxFunctionSolver>;
/**
* Executes an ACIR circuit to generate the solved witness from the initial witness.
*
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
*/
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
/**
* Executes an ACIR circuit to generate the solved witness from the initial witness.
* This method also extracts the public return values from the solved witness into its own return witness.
*
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
*/
export function executeCircuitWithReturnWitness(_solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
/**
* Executes an ACIR circuit to generate the solved witness from the initial witness.
*
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
*/
export function executeCircuitWithBlackBoxSolver(_solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
/**
*/
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
/**
*/
export function executeProgramWithBlackBoxSolver(_solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_executor: ForeignCallHandler): Promise<WitnessStack>;
/**
* Sets the package's logging level.

@@ -100,7 +10,2 @@ *

/**
* Returns the `BuildInfo` object containing information about how the installed package was built.
* @returns {BuildInfo} - Information on how the installed package was built.
*/
export function buildInfo(): BuildInfo;
/**
* Compresses a `WitnessMap` into the binary format outputted by Nargo.

@@ -167,2 +72,85 @@ *

export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
/**
* Executes an ACIR circuit to generate the solved witness from the initial witness.
*
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
*/
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
/**
* Executes an ACIR circuit to generate the solved witness from the initial witness.
* This method also extracts the public return values from the solved witness into its own return witness.
*
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
*/
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
/**
* Executes an ACIR circuit to generate the solved witness from the initial witness.
*
* @param {Uint8Array} program - A serialized representation of an ACIR program
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
*/
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
/**
* Performs a bitwise AND operation between `lhs` and `rhs`
* @param {string} lhs
* @param {string} rhs
* @returns {string}
*/
export function and(lhs: string, rhs: string): string;
/**
* Performs a bitwise XOR operation between `lhs` and `rhs`
* @param {string} lhs
* @param {string} rhs
* @returns {string}
*/
export function xor(lhs: string, rhs: string): string;
/**
* Calculates the SHA256 hash of the input bytes
* @param {Uint8Array} inputs
* @returns {Uint8Array}
*/
export function sha256(inputs: Uint8Array): Uint8Array;
/**
* Calculates the Blake2s256 hash of the input bytes
* @param {Uint8Array} inputs
* @returns {Uint8Array}
*/
export function blake2s256(inputs: Uint8Array): Uint8Array;
/**
* Calculates the Keccak256 hash of the input bytes
* @param {Uint8Array} inputs
* @returns {Uint8Array}
*/
export function keccak256(inputs: Uint8Array): Uint8Array;
/**
* Verifies a ECDSA signature over the secp256k1 curve.
* @param {Uint8Array} hashed_msg
* @param {Uint8Array} public_key_x_bytes
* @param {Uint8Array} public_key_y_bytes
* @param {Uint8Array} signature
* @returns {boolean}
*/
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
/**
* Verifies a ECDSA signature over the secp256r1 curve.
* @param {Uint8Array} hashed_msg
* @param {Uint8Array} public_key_x_bytes
* @param {Uint8Array} public_key_y_bytes
* @param {Uint8Array} signature
* @returns {boolean}
*/
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
/**
* Returns the `BuildInfo` object containing information about how the installed package was built.
* @returns {BuildInfo} - Information on how the installed package was built.
*/
export function buildInfo(): BuildInfo;

@@ -180,13 +168,14 @@ export type RawAssertionPayload = {

export type ForeignCallInput = string[]
export type ForeignCallOutput = string | string[]
// Map from witness index to hex string value of witness.
export type WitnessMap = Map<number, string>;
/**
* A callback which performs an foreign call and returns the response.
* @callback ForeignCallHandler
* @param {string} name - The identifier for the type of foreign call being performed.
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
*/
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
* An execution result containing two witnesses.
* 1. The full solved witness of the execution.
* 2. The return witness which contains the given public return values within the full witness.
*/
export type SolvedAndReturnWitness = {
solvedWitness: WitnessMap;
returnWitness: WitnessMap;
}

@@ -209,17 +198,2 @@

// Map from witness index to hex string value of witness.
export type WitnessMap = Map<number, string>;
/**
* An execution result containing two witnesses.
* 1. The full solved witness of the execution.
* 2. The return witness which contains the given public return values within the full witness.
*/
export type SolvedAndReturnWitness = {
solvedWitness: WitnessMap;
returnWitness: WitnessMap;
}
export type StackItem = {

@@ -233,6 +207,15 @@ index: number;

export type ForeignCallInput = string[]
export type ForeignCallOutput = string | string[]
/**
* A callback which performs an foreign call and returns the response.
* @callback ForeignCallHandler
* @param {string} name - The identifier for the type of foreign call being performed.
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
*/
export class WasmBlackBoxFunctionSolver {
free(): void;
}
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;

@@ -26,24 +26,2 @@ let imports = {};

function isLikeNone(x) {
return x === undefined || x === null;
}
let cachedFloat64Memory0 = null;
function getFloat64Memory0() {
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
}
return cachedFloat64Memory0;
}
let cachedInt32Memory0 = null;
function getInt32Memory0() {
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
}
return cachedInt32Memory0;
}
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });

@@ -131,2 +109,24 @@

function isLikeNone(x) {
return x === undefined || x === null;
}
let cachedInt32Memory0 = null;
function getInt32Memory0() {
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
}
return cachedInt32Memory0;
}
let cachedFloat64Memory0 = null;
function getFloat64Memory0() {
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
}
return cachedFloat64Memory0;
}
function debugString(val) {

@@ -226,223 +226,2 @@ // primitive types

/**
* Performs a bitwise AND operation between `lhs` and `rhs`
* @param {string} lhs
* @param {string} rhs
* @returns {string}
*/
module.exports.and = function(lhs, rhs) {
const ret = wasm.and(addHeapObject(lhs), addHeapObject(rhs));
return takeObject(ret);
};
/**
* Performs a bitwise XOR operation between `lhs` and `rhs`
* @param {string} lhs
* @param {string} rhs
* @returns {string}
*/
module.exports.xor = function(lhs, rhs) {
const ret = wasm.xor(addHeapObject(lhs), addHeapObject(rhs));
return takeObject(ret);
};
function passArray8ToWasm0(arg, malloc) {
const ptr = malloc(arg.length * 1) >>> 0;
getUint8Memory0().set(arg, ptr / 1);
WASM_VECTOR_LEN = arg.length;
return ptr;
}
function getArrayU8FromWasm0(ptr, len) {
ptr = ptr >>> 0;
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
}
/**
* Calculates the SHA256 hash of the input bytes
* @param {Uint8Array} inputs
* @returns {Uint8Array}
*/
module.exports.sha256 = function(inputs) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.sha256(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v2 = getArrayU8FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 1);
return v2;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* Calculates the Blake2s256 hash of the input bytes
* @param {Uint8Array} inputs
* @returns {Uint8Array}
*/
module.exports.blake2s256 = function(inputs) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.blake2s256(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v2 = getArrayU8FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 1);
return v2;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* Calculates the Keccak256 hash of the input bytes
* @param {Uint8Array} inputs
* @returns {Uint8Array}
*/
module.exports.keccak256 = function(inputs) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.keccak256(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v2 = getArrayU8FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 1);
return v2;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* Verifies a ECDSA signature over the secp256k1 curve.
* @param {Uint8Array} hashed_msg
* @param {Uint8Array} public_key_x_bytes
* @param {Uint8Array} public_key_y_bytes
* @param {Uint8Array} signature
* @returns {boolean}
*/
module.exports.ecdsa_secp256k1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
const len1 = WASM_VECTOR_LEN;
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
const len2 = WASM_VECTOR_LEN;
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
const len3 = WASM_VECTOR_LEN;
const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
return ret !== 0;
};
/**
* Verifies a ECDSA signature over the secp256r1 curve.
* @param {Uint8Array} hashed_msg
* @param {Uint8Array} public_key_x_bytes
* @param {Uint8Array} public_key_y_bytes
* @param {Uint8Array} signature
* @returns {boolean}
*/
module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
const len1 = WASM_VECTOR_LEN;
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
const len2 = WASM_VECTOR_LEN;
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
const len3 = WASM_VECTOR_LEN;
const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
return ret !== 0;
};
/**
* @returns {Promise<WasmBlackBoxFunctionSolver>}
*/
module.exports.createBlackBoxSolver = function() {
const ret = wasm.createBlackBoxSolver();
return takeObject(ret);
};
/**
* Executes an ACIR circuit to generate the solved witness from the initial witness.
*
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
*/
module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
return takeObject(ret);
};
function _assertClass(instance, klass) {
if (!(instance instanceof klass)) {
throw new Error(`expected instance of ${klass.name}`);
}
return instance.ptr;
}
/**
* Executes an ACIR circuit to generate the solved witness from the initial witness.
* This method also extracts the public return values from the solved witness into its own return witness.
*
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
*/
module.exports.executeCircuitWithReturnWitness = function(_solver, program, initial_witness, foreign_call_handler) {
_assertClass(_solver, WasmBlackBoxFunctionSolver);
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.executeCircuitWithReturnWitness(_solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
return takeObject(ret);
};
/**
* Executes an ACIR circuit to generate the solved witness from the initial witness.
*
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
*/
module.exports.executeCircuitWithBlackBoxSolver = function(_solver, program, initial_witness, foreign_call_handler) {
_assertClass(_solver, WasmBlackBoxFunctionSolver);
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.executeCircuitWithBlackBoxSolver(_solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
return takeObject(ret);
};
/**
*/
module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
return takeObject(ret);
};
/**
*/
module.exports.executeProgramWithBlackBoxSolver = function(_solver, program, initial_witness, foreign_call_executor) {
_assertClass(_solver, WasmBlackBoxFunctionSolver);
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.executeProgramWithBlackBoxSolver(_solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_executor));
return takeObject(ret);
};
/**
* Sets the package's logging level.

@@ -468,12 +247,7 @@ *

function getArrayU8FromWasm0(ptr, len) {
ptr = ptr >>> 0;
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
}
/**
* Returns the `BuildInfo` object containing information about how the installed package was built.
* @returns {BuildInfo} - Information on how the installed package was built.
*/
module.exports.buildInfo = function() {
const ret = wasm.buildInfo();
return takeObject(ret);
};
/**
* Compresses a `WitnessMap` into the binary format outputted by Nargo.

@@ -503,2 +277,8 @@ *

function passArray8ToWasm0(arg, malloc) {
const ptr = malloc(arg.length * 1) >>> 0;
getUint8Memory0().set(arg, ptr / 1);
WASM_VECTOR_LEN = arg.length;
return ptr;
}
/**

@@ -662,42 +442,198 @@ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.

function __wbg_adapter_81(arg0, arg1, arg2, arg3, arg4) {
wasm.wasm_bindgen__convert__closures__invoke3_mut__h629417323d5efbaa(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
}
/**
* Executes an ACIR circuit to generate the solved witness from the initial witness.
*
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
*/
module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
return takeObject(ret);
};
function handleError(f, args) {
try {
return f.apply(this, args);
} catch (e) {
wasm.__wbindgen_exn_store(addHeapObject(e));
}
}
function __wbg_adapter_98(arg0, arg1, arg2, arg3) {
wasm.wasm_bindgen__convert__closures__invoke2_mut__h4efdd1050cfb3ea7(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
}
/**
* Executes an ACIR circuit to generate the solved witness from the initial witness.
* This method also extracts the public return values from the solved witness into its own return witness.
*
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
*/
module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
return takeObject(ret);
};
/**
* Executes an ACIR circuit to generate the solved witness from the initial witness.
*
* @param {Uint8Array} program - A serialized representation of an ACIR program
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
*/
class WasmBlackBoxFunctionSolver {
module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
return takeObject(ret);
};
static __wrap(ptr) {
ptr = ptr >>> 0;
const obj = Object.create(WasmBlackBoxFunctionSolver.prototype);
obj.__wbg_ptr = ptr;
/**
* Performs a bitwise AND operation between `lhs` and `rhs`
* @param {string} lhs
* @param {string} rhs
* @returns {string}
*/
module.exports.and = function(lhs, rhs) {
const ret = wasm.and(addHeapObject(lhs), addHeapObject(rhs));
return takeObject(ret);
};
return obj;
/**
* Performs a bitwise XOR operation between `lhs` and `rhs`
* @param {string} lhs
* @param {string} rhs
* @returns {string}
*/
module.exports.xor = function(lhs, rhs) {
const ret = wasm.xor(addHeapObject(lhs), addHeapObject(rhs));
return takeObject(ret);
};
/**
* Calculates the SHA256 hash of the input bytes
* @param {Uint8Array} inputs
* @returns {Uint8Array}
*/
module.exports.sha256 = function(inputs) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.sha256(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v2 = getArrayU8FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 1);
return v2;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
__destroy_into_raw() {
const ptr = this.__wbg_ptr;
this.__wbg_ptr = 0;
/**
* Calculates the Blake2s256 hash of the input bytes
* @param {Uint8Array} inputs
* @returns {Uint8Array}
*/
module.exports.blake2s256 = function(inputs) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.blake2s256(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v2 = getArrayU8FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 1);
return v2;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
return ptr;
/**
* Calculates the Keccak256 hash of the input bytes
* @param {Uint8Array} inputs
* @returns {Uint8Array}
*/
module.exports.keccak256 = function(inputs) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.keccak256(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v2 = getArrayU8FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 1);
return v2;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_wasmblackboxfunctionsolver_free(ptr);
/**
* Verifies a ECDSA signature over the secp256k1 curve.
* @param {Uint8Array} hashed_msg
* @param {Uint8Array} public_key_x_bytes
* @param {Uint8Array} public_key_y_bytes
* @param {Uint8Array} signature
* @returns {boolean}
*/
module.exports.ecdsa_secp256k1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
const len1 = WASM_VECTOR_LEN;
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
const len2 = WASM_VECTOR_LEN;
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
const len3 = WASM_VECTOR_LEN;
const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
return ret !== 0;
};
/**
* Verifies a ECDSA signature over the secp256r1 curve.
* @param {Uint8Array} hashed_msg
* @param {Uint8Array} public_key_x_bytes
* @param {Uint8Array} public_key_y_bytes
* @param {Uint8Array} signature
* @returns {boolean}
*/
module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
const len1 = WASM_VECTOR_LEN;
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
const len2 = WASM_VECTOR_LEN;
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
const len3 = WASM_VECTOR_LEN;
const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
return ret !== 0;
};
/**
* Returns the `BuildInfo` object containing information about how the installed package was built.
* @returns {BuildInfo} - Information on how the installed package was built.
*/
module.exports.buildInfo = function() {
const ret = wasm.buildInfo();
return takeObject(ret);
};
function __wbg_adapter_76(arg0, arg1, arg2, arg3, arg4) {
wasm.wasm_bindgen__convert__closures__invoke3_mut__h629417323d5efbaa(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
}
function handleError(f, args) {
try {
return f.apply(this, args);
} catch (e) {
wasm.__wbindgen_exn_store(addHeapObject(e));
}
}
module.exports.WasmBlackBoxFunctionSolver = WasmBlackBoxFunctionSolver;
function __wbg_adapter_93(arg0, arg1, arg2, arg3) {
wasm.wasm_bindgen__convert__closures__invoke2_mut__h4efdd1050cfb3ea7(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
}

@@ -708,14 +644,2 @@ module.exports.__wbindgen_object_drop_ref = function(arg0) {

module.exports.__wbg_wasmblackboxfunctionsolver_new = function(arg0) {
const ret = WasmBlackBoxFunctionSolver.__wrap(arg0);
return addHeapObject(ret);
};
module.exports.__wbindgen_number_get = function(arg0, arg1) {
const obj = getObject(arg1);
const ret = typeof(obj) === 'number' ? obj : undefined;
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
};
module.exports.__wbindgen_cb_drop = function(arg0) {

@@ -731,12 +655,2 @@ const obj = takeObject(arg0).original;

module.exports.__wbindgen_is_array = function(arg0) {
const ret = Array.isArray(getObject(arg0));
return ret;
};
module.exports.__wbindgen_is_string = function(arg0) {
const ret = typeof(getObject(arg0)) === 'string';
return ret;
};
module.exports.__wbg_constructor_81b34c49dcbdd2af = function(arg0) {

@@ -752,2 +666,7 @@ const ret = new Error(takeObject(arg0));

module.exports.__wbindgen_is_array = function(arg0) {
const ret = Array.isArray(getObject(arg0));
return ret;
};
module.exports.__wbg_new_6f6c75f9324b78e8 = function() {

@@ -772,2 +691,9 @@ const ret = new Map();

module.exports.__wbindgen_number_get = function(arg0, arg1) {
const obj = getObject(arg1);
const ret = typeof(obj) === 'number' ? obj : undefined;
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
};
module.exports.__wbg_new_ee5ac63ff3b0fa4d = function() {

@@ -778,2 +704,7 @@ const ret = new Array();

module.exports.__wbindgen_is_string = function(arg0) {
const ret = typeof(getObject(arg0)) === 'string';
return ret;
};
module.exports.__wbg_new_abda76e883ba8a5f = function() {

@@ -868,3 +799,3 @@ const ret = new Error();

try {
return __wbg_adapter_81(a, state0.b, arg0, arg1, arg2);
return __wbg_adapter_76(a, state0.b, arg0, arg1, arg2);
} finally {

@@ -916,3 +847,3 @@ state0.a = a;

try {
return __wbg_adapter_98(a, state0.b, arg0, arg1);
return __wbg_adapter_93(a, state0.b, arg0, arg1);
} finally {

@@ -950,3 +881,3 @@ state0.a = a;

try {
return __wbg_adapter_98(a, state0.b, arg0, arg1);
return __wbg_adapter_93(a, state0.b, arg0, arg1);
} finally {

@@ -1000,4 +931,4 @@ state0.a = a;

module.exports.__wbindgen_closure_wrapper493 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 201, __wbg_adapter_22);
module.exports.__wbindgen_closure_wrapper742 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 242, __wbg_adapter_22);
return addHeapObject(ret);

@@ -1004,0 +935,0 @@ };

{
"name": "@noir-lang/acvm_js",
"version": "0.46.0-86fd0ac.nightly",
"version": "0.46.0-ab0b1a8.nightly",
"publishConfig": {

@@ -5,0 +5,0 @@ "access": "public"

/* tslint:disable */
/* eslint-disable */
export const memory: WebAssembly.Memory;
export function initLogLevel(a: number, b: number, c: number): void;
export function compressWitness(a: number, b: number): void;
export function decompressWitness(a: number, b: number, c: number): void;
export function compressWitnessStack(a: number, b: number): void;
export function decompressWitnessStack(a: number, b: number, c: number): void;
export function getReturnWitness(a: number, b: number, c: number, d: number): void;
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
export function getPublicWitness(a: number, b: number, c: number, d: number): void;
export function executeCircuit(a: number, b: number, c: number, d: number): number;
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
export function executeProgram(a: number, b: number, c: number, d: number): number;
export function and(a: number, b: number): number;

@@ -11,18 +22,3 @@ export function xor(a: number, b: number): number;

export function ecdsa_secp256r1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
export function __wbg_wasmblackboxfunctionsolver_free(a: number): void;
export function createBlackBoxSolver(): number;
export function executeCircuit(a: number, b: number, c: number, d: number): number;
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number, e: number): number;
export function executeCircuitWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number;
export function executeProgram(a: number, b: number, c: number, d: number): number;
export function executeProgramWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number;
export function initLogLevel(a: number, b: number, c: number): void;
export function buildInfo(): number;
export function compressWitness(a: number, b: number): void;
export function decompressWitness(a: number, b: number, c: number): void;
export function compressWitnessStack(a: number, b: number): void;
export function decompressWitnessStack(a: number, b: number, c: number): void;
export function getReturnWitness(a: number, b: number, c: number, d: number): void;
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
export function getPublicWitness(a: number, b: number, c: number, d: number): void;
export function __wbindgen_malloc(a: number): number;

@@ -29,0 +25,0 @@ export function __wbindgen_realloc(a: number, b: number, c: number): number;

/* tslint:disable */
/* eslint-disable */
/**
* Performs a bitwise AND operation between `lhs` and `rhs`
* @param {string} lhs
* @param {string} rhs
* @returns {string}
*/
export function and(lhs: string, rhs: string): string;
/**
* Performs a bitwise XOR operation between `lhs` and `rhs`
* @param {string} lhs
* @param {string} rhs
* @returns {string}
*/
export function xor(lhs: string, rhs: string): string;
/**
* Calculates the SHA256 hash of the input bytes
* @param {Uint8Array} inputs
* @returns {Uint8Array}
*/
export function sha256(inputs: Uint8Array): Uint8Array;
/**
* Calculates the Blake2s256 hash of the input bytes
* @param {Uint8Array} inputs
* @returns {Uint8Array}
*/
export function blake2s256(inputs: Uint8Array): Uint8Array;
/**
* Calculates the Keccak256 hash of the input bytes
* @param {Uint8Array} inputs
* @returns {Uint8Array}
*/
export function keccak256(inputs: Uint8Array): Uint8Array;
/**
* Verifies a ECDSA signature over the secp256k1 curve.
* @param {Uint8Array} hashed_msg
* @param {Uint8Array} public_key_x_bytes
* @param {Uint8Array} public_key_y_bytes
* @param {Uint8Array} signature
* @returns {boolean}
*/
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
/**
* Verifies a ECDSA signature over the secp256r1 curve.
* @param {Uint8Array} hashed_msg
* @param {Uint8Array} public_key_x_bytes
* @param {Uint8Array} public_key_y_bytes
* @param {Uint8Array} signature
* @returns {boolean}
*/
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
/**
* @returns {Promise<WasmBlackBoxFunctionSolver>}
*/
export function createBlackBoxSolver(): Promise<WasmBlackBoxFunctionSolver>;
/**
* Executes an ACIR circuit to generate the solved witness from the initial witness.
*
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
*/
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
/**
* Executes an ACIR circuit to generate the solved witness from the initial witness.
* This method also extracts the public return values from the solved witness into its own return witness.
*
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
*/
export function executeCircuitWithReturnWitness(_solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
/**
* Executes an ACIR circuit to generate the solved witness from the initial witness.
*
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
*/
export function executeCircuitWithBlackBoxSolver(_solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
/**
*/
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
/**
*/
export function executeProgramWithBlackBoxSolver(_solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_executor: ForeignCallHandler): Promise<WitnessStack>;
/**
* Sets the package's logging level.

@@ -100,7 +10,2 @@ *

/**
* Returns the `BuildInfo` object containing information about how the installed package was built.
* @returns {BuildInfo} - Information on how the installed package was built.
*/
export function buildInfo(): BuildInfo;
/**
* Compresses a `WitnessMap` into the binary format outputted by Nargo.

@@ -167,2 +72,85 @@ *

export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
/**
* Executes an ACIR circuit to generate the solved witness from the initial witness.
*
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
*/
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
/**
* Executes an ACIR circuit to generate the solved witness from the initial witness.
* This method also extracts the public return values from the solved witness into its own return witness.
*
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
*/
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
/**
* Executes an ACIR circuit to generate the solved witness from the initial witness.
*
* @param {Uint8Array} program - A serialized representation of an ACIR program
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
*/
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
/**
* Performs a bitwise AND operation between `lhs` and `rhs`
* @param {string} lhs
* @param {string} rhs
* @returns {string}
*/
export function and(lhs: string, rhs: string): string;
/**
* Performs a bitwise XOR operation between `lhs` and `rhs`
* @param {string} lhs
* @param {string} rhs
* @returns {string}
*/
export function xor(lhs: string, rhs: string): string;
/**
* Calculates the SHA256 hash of the input bytes
* @param {Uint8Array} inputs
* @returns {Uint8Array}
*/
export function sha256(inputs: Uint8Array): Uint8Array;
/**
* Calculates the Blake2s256 hash of the input bytes
* @param {Uint8Array} inputs
* @returns {Uint8Array}
*/
export function blake2s256(inputs: Uint8Array): Uint8Array;
/**
* Calculates the Keccak256 hash of the input bytes
* @param {Uint8Array} inputs
* @returns {Uint8Array}
*/
export function keccak256(inputs: Uint8Array): Uint8Array;
/**
* Verifies a ECDSA signature over the secp256k1 curve.
* @param {Uint8Array} hashed_msg
* @param {Uint8Array} public_key_x_bytes
* @param {Uint8Array} public_key_y_bytes
* @param {Uint8Array} signature
* @returns {boolean}
*/
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
/**
* Verifies a ECDSA signature over the secp256r1 curve.
* @param {Uint8Array} hashed_msg
* @param {Uint8Array} public_key_x_bytes
* @param {Uint8Array} public_key_y_bytes
* @param {Uint8Array} signature
* @returns {boolean}
*/
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
/**
* Returns the `BuildInfo` object containing information about how the installed package was built.
* @returns {BuildInfo} - Information on how the installed package was built.
*/
export function buildInfo(): BuildInfo;

@@ -180,13 +168,14 @@ export type RawAssertionPayload = {

export type ForeignCallInput = string[]
export type ForeignCallOutput = string | string[]
// Map from witness index to hex string value of witness.
export type WitnessMap = Map<number, string>;
/**
* A callback which performs an foreign call and returns the response.
* @callback ForeignCallHandler
* @param {string} name - The identifier for the type of foreign call being performed.
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
*/
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
* An execution result containing two witnesses.
* 1. The full solved witness of the execution.
* 2. The return witness which contains the given public return values within the full witness.
*/
export type SolvedAndReturnWitness = {
solvedWitness: WitnessMap;
returnWitness: WitnessMap;
}

@@ -209,17 +198,2 @@

// Map from witness index to hex string value of witness.
export type WitnessMap = Map<number, string>;
/**
* An execution result containing two witnesses.
* 1. The full solved witness of the execution.
* 2. The return witness which contains the given public return values within the full witness.
*/
export type SolvedAndReturnWitness = {
solvedWitness: WitnessMap;
returnWitness: WitnessMap;
}
export type StackItem = {

@@ -233,8 +207,17 @@ index: number;

export type ForeignCallInput = string[]
export type ForeignCallOutput = string | string[]
/**
* A callback which performs an foreign call and returns the response.
* @callback ForeignCallHandler
* @param {string} name - The identifier for the type of foreign call being performed.
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
*/
export class WasmBlackBoxFunctionSolver {
free(): void;
}
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;

@@ -244,2 +227,13 @@

readonly memory: WebAssembly.Memory;
readonly initLogLevel: (a: number, b: number, c: number) => void;
readonly compressWitness: (a: number, b: number) => void;
readonly decompressWitness: (a: number, b: number, c: number) => void;
readonly compressWitnessStack: (a: number, b: number) => void;
readonly decompressWitnessStack: (a: number, b: number, c: number) => void;
readonly getReturnWitness: (a: number, b: number, c: number, d: number) => void;
readonly getPublicParametersWitness: (a: number, b: number, c: number, d: number) => void;
readonly getPublicWitness: (a: number, b: number, c: number, d: number) => void;
readonly executeCircuit: (a: number, b: number, c: number, d: number) => number;
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: number, d: number) => number;
readonly executeProgram: (a: number, b: number, c: number, d: number) => number;
readonly and: (a: number, b: number) => number;

@@ -252,18 +246,3 @@ readonly xor: (a: number, b: number) => number;

readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
readonly __wbg_wasmblackboxfunctionsolver_free: (a: number) => void;
readonly createBlackBoxSolver: () => number;
readonly executeCircuit: (a: number, b: number, c: number, d: number) => number;
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: number, d: number, e: number) => number;
readonly executeCircuitWithBlackBoxSolver: (a: number, b: number, c: number, d: number, e: number) => number;
readonly executeProgram: (a: number, b: number, c: number, d: number) => number;
readonly executeProgramWithBlackBoxSolver: (a: number, b: number, c: number, d: number, e: number) => number;
readonly initLogLevel: (a: number, b: number, c: number) => void;
readonly buildInfo: () => number;
readonly compressWitness: (a: number, b: number) => void;
readonly decompressWitness: (a: number, b: number, c: number) => void;
readonly compressWitnessStack: (a: number, b: number) => void;
readonly decompressWitnessStack: (a: number, b: number, c: number) => void;
readonly getReturnWitness: (a: number, b: number, c: number, d: number) => void;
readonly getPublicParametersWitness: (a: number, b: number, c: number, d: number) => void;
readonly getPublicWitness: (a: number, b: number, c: number, d: number) => void;
readonly __wbindgen_malloc: (a: number) => number;

@@ -270,0 +249,0 @@ readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;

@@ -23,24 +23,2 @@ let wasm;

function isLikeNone(x) {
return x === undefined || x === null;
}
let cachedFloat64Memory0 = null;
function getFloat64Memory0() {
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
}
return cachedFloat64Memory0;
}
let cachedInt32Memory0 = null;
function getInt32Memory0() {
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
}
return cachedInt32Memory0;
}
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );

@@ -128,2 +106,24 @@

function isLikeNone(x) {
return x === undefined || x === null;
}
let cachedInt32Memory0 = null;
function getInt32Memory0() {
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
}
return cachedInt32Memory0;
}
let cachedFloat64Memory0 = null;
function getFloat64Memory0() {
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
}
return cachedFloat64Memory0;
}
function debugString(val) {

@@ -223,223 +223,2 @@ // primitive types

/**
* Performs a bitwise AND operation between `lhs` and `rhs`
* @param {string} lhs
* @param {string} rhs
* @returns {string}
*/
export function and(lhs, rhs) {
const ret = wasm.and(addHeapObject(lhs), addHeapObject(rhs));
return takeObject(ret);
}
/**
* Performs a bitwise XOR operation between `lhs` and `rhs`
* @param {string} lhs
* @param {string} rhs
* @returns {string}
*/
export function xor(lhs, rhs) {
const ret = wasm.xor(addHeapObject(lhs), addHeapObject(rhs));
return takeObject(ret);
}
function passArray8ToWasm0(arg, malloc) {
const ptr = malloc(arg.length * 1) >>> 0;
getUint8Memory0().set(arg, ptr / 1);
WASM_VECTOR_LEN = arg.length;
return ptr;
}
function getArrayU8FromWasm0(ptr, len) {
ptr = ptr >>> 0;
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
}
/**
* Calculates the SHA256 hash of the input bytes
* @param {Uint8Array} inputs
* @returns {Uint8Array}
*/
export function sha256(inputs) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.sha256(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v2 = getArrayU8FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 1);
return v2;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
/**
* Calculates the Blake2s256 hash of the input bytes
* @param {Uint8Array} inputs
* @returns {Uint8Array}
*/
export function blake2s256(inputs) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.blake2s256(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v2 = getArrayU8FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 1);
return v2;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
/**
* Calculates the Keccak256 hash of the input bytes
* @param {Uint8Array} inputs
* @returns {Uint8Array}
*/
export function keccak256(inputs) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.keccak256(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v2 = getArrayU8FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 1);
return v2;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
/**
* Verifies a ECDSA signature over the secp256k1 curve.
* @param {Uint8Array} hashed_msg
* @param {Uint8Array} public_key_x_bytes
* @param {Uint8Array} public_key_y_bytes
* @param {Uint8Array} signature
* @returns {boolean}
*/
export function ecdsa_secp256k1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
const len1 = WASM_VECTOR_LEN;
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
const len2 = WASM_VECTOR_LEN;
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
const len3 = WASM_VECTOR_LEN;
const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
return ret !== 0;
}
/**
* Verifies a ECDSA signature over the secp256r1 curve.
* @param {Uint8Array} hashed_msg
* @param {Uint8Array} public_key_x_bytes
* @param {Uint8Array} public_key_y_bytes
* @param {Uint8Array} signature
* @returns {boolean}
*/
export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
const len1 = WASM_VECTOR_LEN;
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
const len2 = WASM_VECTOR_LEN;
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
const len3 = WASM_VECTOR_LEN;
const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
return ret !== 0;
}
/**
* @returns {Promise<WasmBlackBoxFunctionSolver>}
*/
export function createBlackBoxSolver() {
const ret = wasm.createBlackBoxSolver();
return takeObject(ret);
}
/**
* Executes an ACIR circuit to generate the solved witness from the initial witness.
*
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
*/
export function executeCircuit(program, initial_witness, foreign_call_handler) {
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
return takeObject(ret);
}
function _assertClass(instance, klass) {
if (!(instance instanceof klass)) {
throw new Error(`expected instance of ${klass.name}`);
}
return instance.ptr;
}
/**
* Executes an ACIR circuit to generate the solved witness from the initial witness.
* This method also extracts the public return values from the solved witness into its own return witness.
*
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
*/
export function executeCircuitWithReturnWitness(_solver, program, initial_witness, foreign_call_handler) {
_assertClass(_solver, WasmBlackBoxFunctionSolver);
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.executeCircuitWithReturnWitness(_solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
return takeObject(ret);
}
/**
* Executes an ACIR circuit to generate the solved witness from the initial witness.
*
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
*/
export function executeCircuitWithBlackBoxSolver(_solver, program, initial_witness, foreign_call_handler) {
_assertClass(_solver, WasmBlackBoxFunctionSolver);
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.executeCircuitWithBlackBoxSolver(_solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
return takeObject(ret);
}
/**
*/
export function executeProgram(program, initial_witness, foreign_call_handler) {
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
return takeObject(ret);
}
/**
*/
export function executeProgramWithBlackBoxSolver(_solver, program, initial_witness, foreign_call_executor) {
_assertClass(_solver, WasmBlackBoxFunctionSolver);
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.executeProgramWithBlackBoxSolver(_solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_executor));
return takeObject(ret);
}
/**
* Sets the package's logging level.

@@ -465,11 +244,6 @@ *

/**
* Returns the `BuildInfo` object containing information about how the installed package was built.
* @returns {BuildInfo} - Information on how the installed package was built.
*/
export function buildInfo() {
const ret = wasm.buildInfo();
return takeObject(ret);
function getArrayU8FromWasm0(ptr, len) {
ptr = ptr >>> 0;
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
}
/**

@@ -500,2 +274,8 @@ * Compresses a `WitnessMap` into the binary format outputted by Nargo.

function passArray8ToWasm0(arg, malloc) {
const ptr = malloc(arg.length * 1) >>> 0;
getUint8Memory0().set(arg, ptr / 1);
WASM_VECTOR_LEN = arg.length;
return ptr;
}
/**

@@ -659,41 +439,198 @@ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.

function __wbg_adapter_81(arg0, arg1, arg2, arg3, arg4) {
wasm.wasm_bindgen__convert__closures__invoke3_mut__h629417323d5efbaa(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
/**
* Executes an ACIR circuit to generate the solved witness from the initial witness.
*
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
*/
export function executeCircuit(program, initial_witness, foreign_call_handler) {
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
return takeObject(ret);
}
function handleError(f, args) {
try {
return f.apply(this, args);
} catch (e) {
wasm.__wbindgen_exn_store(addHeapObject(e));
}
/**
* Executes an ACIR circuit to generate the solved witness from the initial witness.
* This method also extracts the public return values from the solved witness into its own return witness.
*
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
*/
export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
return takeObject(ret);
}
function __wbg_adapter_98(arg0, arg1, arg2, arg3) {
wasm.wasm_bindgen__convert__closures__invoke2_mut__h4efdd1050cfb3ea7(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
/**
* Executes an ACIR circuit to generate the solved witness from the initial witness.
*
* @param {Uint8Array} program - A serialized representation of an ACIR program
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
*/
export function executeProgram(program, initial_witness, foreign_call_handler) {
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
return takeObject(ret);
}
/**
* Performs a bitwise AND operation between `lhs` and `rhs`
* @param {string} lhs
* @param {string} rhs
* @returns {string}
*/
export class WasmBlackBoxFunctionSolver {
export function and(lhs, rhs) {
const ret = wasm.and(addHeapObject(lhs), addHeapObject(rhs));
return takeObject(ret);
}
static __wrap(ptr) {
ptr = ptr >>> 0;
const obj = Object.create(WasmBlackBoxFunctionSolver.prototype);
obj.__wbg_ptr = ptr;
/**
* Performs a bitwise XOR operation between `lhs` and `rhs`
* @param {string} lhs
* @param {string} rhs
* @returns {string}
*/
export function xor(lhs, rhs) {
const ret = wasm.xor(addHeapObject(lhs), addHeapObject(rhs));
return takeObject(ret);
}
return obj;
/**
* Calculates the SHA256 hash of the input bytes
* @param {Uint8Array} inputs
* @returns {Uint8Array}
*/
export function sha256(inputs) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.sha256(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v2 = getArrayU8FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 1);
return v2;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
__destroy_into_raw() {
const ptr = this.__wbg_ptr;
this.__wbg_ptr = 0;
/**
* Calculates the Blake2s256 hash of the input bytes
* @param {Uint8Array} inputs
* @returns {Uint8Array}
*/
export function blake2s256(inputs) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.blake2s256(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v2 = getArrayU8FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 1);
return v2;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
return ptr;
/**
* Calculates the Keccak256 hash of the input bytes
* @param {Uint8Array} inputs
* @returns {Uint8Array}
*/
export function keccak256(inputs) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.keccak256(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v2 = getArrayU8FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 1);
return v2;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_wasmblackboxfunctionsolver_free(ptr);
/**
* Verifies a ECDSA signature over the secp256k1 curve.
* @param {Uint8Array} hashed_msg
* @param {Uint8Array} public_key_x_bytes
* @param {Uint8Array} public_key_y_bytes
* @param {Uint8Array} signature
* @returns {boolean}
*/
export function ecdsa_secp256k1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
const len1 = WASM_VECTOR_LEN;
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
const len2 = WASM_VECTOR_LEN;
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
const len3 = WASM_VECTOR_LEN;
const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
return ret !== 0;
}
/**
* Verifies a ECDSA signature over the secp256r1 curve.
* @param {Uint8Array} hashed_msg
* @param {Uint8Array} public_key_x_bytes
* @param {Uint8Array} public_key_y_bytes
* @param {Uint8Array} signature
* @returns {boolean}
*/
export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
const len1 = WASM_VECTOR_LEN;
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
const len2 = WASM_VECTOR_LEN;
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
const len3 = WASM_VECTOR_LEN;
const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
return ret !== 0;
}
/**
* Returns the `BuildInfo` object containing information about how the installed package was built.
* @returns {BuildInfo} - Information on how the installed package was built.
*/
export function buildInfo() {
const ret = wasm.buildInfo();
return takeObject(ret);
}
function __wbg_adapter_76(arg0, arg1, arg2, arg3, arg4) {
wasm.wasm_bindgen__convert__closures__invoke3_mut__h629417323d5efbaa(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
}
function handleError(f, args) {
try {
return f.apply(this, args);
} catch (e) {
wasm.__wbindgen_exn_store(addHeapObject(e));
}
}
function __wbg_adapter_93(arg0, arg1, arg2, arg3) {
wasm.wasm_bindgen__convert__closures__invoke2_mut__h4efdd1050cfb3ea7(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
}

@@ -737,12 +674,2 @@ async function __wbg_load(module, imports) {

};
imports.wbg.__wbg_wasmblackboxfunctionsolver_new = function(arg0) {
const ret = WasmBlackBoxFunctionSolver.__wrap(arg0);
return addHeapObject(ret);
};
imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
const obj = getObject(arg1);
const ret = typeof(obj) === 'number' ? obj : undefined;
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
};
imports.wbg.__wbindgen_cb_drop = function(arg0) {

@@ -757,10 +684,2 @@ const obj = takeObject(arg0).original;

};
imports.wbg.__wbindgen_is_array = function(arg0) {
const ret = Array.isArray(getObject(arg0));
return ret;
};
imports.wbg.__wbindgen_is_string = function(arg0) {
const ret = typeof(getObject(arg0)) === 'string';
return ret;
};
imports.wbg.__wbg_constructor_81b34c49dcbdd2af = function(arg0) {

@@ -774,2 +693,6 @@ const ret = new Error(takeObject(arg0));

};
imports.wbg.__wbindgen_is_array = function(arg0) {
const ret = Array.isArray(getObject(arg0));
return ret;
};
imports.wbg.__wbg_new_6f6c75f9324b78e8 = function() {

@@ -791,2 +714,8 @@ const ret = new Map();

};
imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
const obj = getObject(arg1);
const ret = typeof(obj) === 'number' ? obj : undefined;
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
};
imports.wbg.__wbg_new_ee5ac63ff3b0fa4d = function() {

@@ -796,2 +725,6 @@ const ret = new Array();

};
imports.wbg.__wbindgen_is_string = function(arg0) {
const ret = typeof(getObject(arg0)) === 'string';
return ret;
};
imports.wbg.__wbg_new_abda76e883ba8a5f = function() {

@@ -870,3 +803,3 @@ const ret = new Error();

try {
return __wbg_adapter_81(a, state0.b, arg0, arg1, arg2);
return __wbg_adapter_76(a, state0.b, arg0, arg1, arg2);
} finally {

@@ -911,3 +844,3 @@ state0.a = a;

try {
return __wbg_adapter_98(a, state0.b, arg0, arg1);
return __wbg_adapter_93(a, state0.b, arg0, arg1);
} finally {

@@ -941,3 +874,3 @@ state0.a = a;

try {
return __wbg_adapter_98(a, state0.b, arg0, arg1);
return __wbg_adapter_93(a, state0.b, arg0, arg1);
} finally {

@@ -983,4 +916,4 @@ state0.a = a;

};
imports.wbg.__wbindgen_closure_wrapper493 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 201, __wbg_adapter_22);
imports.wbg.__wbindgen_closure_wrapper742 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 242, __wbg_adapter_22);
return addHeapObject(ret);

@@ -987,0 +920,0 @@ };

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc