New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@noir-lang/acvm_js

Package Overview
Dependencies
Maintainers
0
Versions
354
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 1.0.0-beta.0-6d0f86b.nightly to 1.0.0-beta.0-73ccd45.nightly

16

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 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 buildInfo(): number;
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;

@@ -18,2 +10,7 @@ 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 buildInfo(): number;
export function initLogLevel(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 compressWitness(a: number, b: number): void;

@@ -23,2 +20,5 @@ export function decompressWitness(a: number, b: number, c: number): void;

export function decompressWitnessStack(a: number, b: number, c: 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 __wbindgen_malloc(a: number): number;

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

/* tslint:disable */
/* eslint-disable */
/**
* Sets the package's logging level.
*
* @param {LogLevel} level - The maximum level of logging to be emitted.
*/
export function initLogLevel(filter: string): void;
/**
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
*
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
* @returns {WitnessMap} A witness map containing the circuit's return values.
* @param {Uint8Array} program
* @param {WitnessMap} witness_map
* @returns {WitnessMap}
*/
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
/**
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
*
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
* @param {Uint8Array} program
* @param {WitnessMap} solved_witness
* @returns {WitnessMap}
*/
export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
/**
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
*
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
* @param {Uint8Array} program
* @param {WitnessMap} solved_witness
* @returns {WitnessMap}
*/
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
/**
* 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;
/**
* 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`

@@ -121,2 +49,46 @@ * @param {string} lhs

/**
* 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;
/**
* Sets the package's logging level.
*
* @param {LogLevel} level - The maximum level of logging to be emitted.
*/
export function initLogLevel(filter: string): void;
/**
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
*
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
* @returns {WitnessMap} A witness map containing the circuit's return values.
* @param {Uint8Array} program
* @param {WitnessMap} witness_map
* @returns {WitnessMap}
*/
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
/**
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
*
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
* @param {Uint8Array} program
* @param {WitnessMap} solved_witness
* @returns {WitnessMap}
*/
export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
/**
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
*
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
* @param {Uint8Array} program
* @param {WitnessMap} solved_witness
* @returns {WitnessMap}
*/
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
/**
* Compresses a `WitnessMap` into the binary format outputted by Nargo.

@@ -150,40 +122,31 @@ *

export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
export type RawAssertionPayload = {
selector: string;
data: string[];
};
export type ExecutionError = Error & {
callStack?: string[];
rawAssertionPayload?: RawAssertionPayload;
brilligFunctionId?: number;
};
// 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;
}
* 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>;
export type StackItem = {
index: number;
witness: WitnessMap;
}
export type WitnessStack = Array<StackItem>;
/**

@@ -216,1 +179,38 @@ * @typedef {Object} BuildInfo - Information about how the installed package was built

export type RawAssertionPayload = {
selector: string;
data: string[];
};
export type ExecutionError = Error & {
callStack?: string[];
rawAssertionPayload?: RawAssertionPayload;
brilligFunctionId?: number;
};
export type StackItem = {
index: number;
witness: WitnessMap;
}
export type WitnessStack = Array<StackItem>;
// 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;
}

@@ -26,2 +26,24 @@ 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 });

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

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,168 +226,2 @@ // primitive types

/**
* Sets the package's logging level.
*
* @param {LogLevel} level - The maximum level of logging to be emitted.
*/
module.exports.initLogLevel = function(filter) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.initLogLevel(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
if (r1) {
throw takeObject(r0);
}
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
function passArray8ToWasm0(arg, malloc) {
const ptr = malloc(arg.length * 1) >>> 0;
getUint8Memory0().set(arg, ptr / 1);
WASM_VECTOR_LEN = arg.length;
return ptr;
}
/**
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
*
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
* @returns {WitnessMap} A witness map containing the circuit's return values.
* @param {Uint8Array} program
* @param {WitnessMap} witness_map
* @returns {WitnessMap}
*/
module.exports.getReturnWitness = function(program, witness_map) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
if (r2) {
throw takeObject(r1);
}
return takeObject(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
*
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
* @param {Uint8Array} program
* @param {WitnessMap} solved_witness
* @returns {WitnessMap}
*/
module.exports.getPublicParametersWitness = function(program, solved_witness) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
if (r2) {
throw takeObject(r1);
}
return takeObject(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
*
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
* @param {Uint8Array} program
* @param {WitnessMap} solved_witness
* @returns {WitnessMap}
*/
module.exports.getPublicWitness = function(program, solved_witness) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
if (r2) {
throw takeObject(r1);
}
return takeObject(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* 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);
};
/**
* 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);
};
/**
* 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.
*/
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);
};
/**
* Performs a bitwise AND operation between `lhs` and `rhs`

@@ -458,2 +292,9 @@ * @param {string} lhs

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) {

@@ -527,2 +368,116 @@ ptr = ptr >>> 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);
};
/**
* Sets the package's logging level.
*
* @param {LogLevel} level - The maximum level of logging to be emitted.
*/
module.exports.initLogLevel = function(filter) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.initLogLevel(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
if (r1) {
throw takeObject(r0);
}
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
*
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
* @returns {WitnessMap} A witness map containing the circuit's return values.
* @param {Uint8Array} program
* @param {WitnessMap} witness_map
* @returns {WitnessMap}
*/
module.exports.getReturnWitness = function(program, witness_map) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
if (r2) {
throw takeObject(r1);
}
return takeObject(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
*
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
* @param {Uint8Array} program
* @param {WitnessMap} solved_witness
* @returns {WitnessMap}
*/
module.exports.getPublicParametersWitness = function(program, solved_witness) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
if (r2) {
throw takeObject(r1);
}
return takeObject(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
*
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
* @param {Uint8Array} program
* @param {WitnessMap} solved_witness
* @returns {WitnessMap}
*/
module.exports.getPublicWitness = function(program, solved_witness) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
if (r2) {
throw takeObject(r1);
}
return takeObject(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* Compresses a `WitnessMap` into the binary format outputted by Nargo.

@@ -626,2 +581,48 @@ *

/**
* 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);
};
/**
* 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.
*/
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);
};
function __wbg_adapter_75(arg0, arg1, arg2, arg3, arg4) {

@@ -646,17 +647,9 @@ wasm.wasm_bindgen__convert__closures__invoke3_mut__h45040feada3ebb25(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));

module.exports.__wbindgen_is_string = function(arg0) {
const ret = typeof(getObject(arg0)) === 'string';
return 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_is_array = function(arg0) {
const ret = Array.isArray(getObject(arg0));
return ret;
};
module.exports.__wbindgen_string_new = function(arg0, arg1) {
const ret = getStringFromWasm0(arg0, arg1);
return addHeapObject(ret);
};
module.exports.__wbindgen_cb_drop = function(arg0) {

@@ -677,7 +670,12 @@ const obj = takeObject(arg0).original;

module.exports.__wbg_new_d9156d5ca3339252 = function() {
const ret = new Map();
module.exports.__wbindgen_string_new = function(arg0, arg1) {
const ret = getStringFromWasm0(arg0, arg1);
return addHeapObject(ret);
};
module.exports.__wbg_new_1549a44c58f2740a = function() {
const ret = new Array();
return addHeapObject(ret);
};
module.exports.__wbindgen_number_new = function(arg0) {

@@ -688,2 +686,17 @@ const ret = arg0;

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_new_d9156d5ca3339252 = function() {
const ret = new Map();
return addHeapObject(ret);
};
module.exports.__wbindgen_string_get = function(arg0, arg1) {

@@ -698,14 +711,2 @@ const obj = getObject(arg1);

module.exports.__wbg_new_1549a44c58f2740a = function() {
const ret = new Array();
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.__wbg_new_abda76e883ba8a5f = function() {

@@ -712,0 +713,0 @@ const ret = new Error();

{
"name": "@noir-lang/acvm_js",
"version": "1.0.0-beta.0-6d0f86b.nightly",
"version": "1.0.0-beta.0-73ccd45.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 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 buildInfo(): number;
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;

@@ -18,2 +10,7 @@ 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 buildInfo(): number;
export function initLogLevel(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 compressWitness(a: number, b: number): void;

@@ -23,2 +20,5 @@ export function decompressWitness(a: number, b: number, c: number): void;

export function decompressWitnessStack(a: number, b: number, c: 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 __wbindgen_malloc(a: number): number;

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

/* tslint:disable */
/* eslint-disable */
/**
* Sets the package's logging level.
*
* @param {LogLevel} level - The maximum level of logging to be emitted.
*/
export function initLogLevel(filter: string): void;
/**
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
*
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
* @returns {WitnessMap} A witness map containing the circuit's return values.
* @param {Uint8Array} program
* @param {WitnessMap} witness_map
* @returns {WitnessMap}
*/
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
/**
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
*
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
* @param {Uint8Array} program
* @param {WitnessMap} solved_witness
* @returns {WitnessMap}
*/
export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
/**
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
*
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
* @param {Uint8Array} program
* @param {WitnessMap} solved_witness
* @returns {WitnessMap}
*/
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
/**
* 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;
/**
* 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`

@@ -121,2 +49,46 @@ * @param {string} lhs

/**
* 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;
/**
* Sets the package's logging level.
*
* @param {LogLevel} level - The maximum level of logging to be emitted.
*/
export function initLogLevel(filter: string): void;
/**
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
*
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
* @returns {WitnessMap} A witness map containing the circuit's return values.
* @param {Uint8Array} program
* @param {WitnessMap} witness_map
* @returns {WitnessMap}
*/
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
/**
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
*
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
* @param {Uint8Array} program
* @param {WitnessMap} solved_witness
* @returns {WitnessMap}
*/
export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
/**
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
*
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
* @param {Uint8Array} program
* @param {WitnessMap} solved_witness
* @returns {WitnessMap}
*/
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
/**
* Compresses a `WitnessMap` into the binary format outputted by Nargo.

@@ -150,40 +122,31 @@ *

export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
export type RawAssertionPayload = {
selector: string;
data: string[];
};
export type ExecutionError = Error & {
callStack?: string[];
rawAssertionPayload?: RawAssertionPayload;
brilligFunctionId?: number;
};
// 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;
}
* 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>;
export type StackItem = {
index: number;
witness: WitnessMap;
}
export type WitnessStack = Array<StackItem>;
/**

@@ -217,2 +180,39 @@ * @typedef {Object} BuildInfo - Information about how the installed package was built

export type RawAssertionPayload = {
selector: string;
data: string[];
};
export type ExecutionError = Error & {
callStack?: string[];
rawAssertionPayload?: RawAssertionPayload;
brilligFunctionId?: number;
};
export type StackItem = {
index: number;
witness: WitnessMap;
}
export type WitnessStack = Array<StackItem>;
// 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 InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;

@@ -222,10 +222,2 @@

readonly memory: WebAssembly.Memory;
readonly initLogLevel: (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 buildInfo: () => number;
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;

@@ -237,2 +229,7 @@ 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 buildInfo: () => number;
readonly initLogLevel: (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 compressWitness: (a: number, b: number) => void;

@@ -242,2 +239,5 @@ readonly decompressWitness: (a: number, b: number, c: number) => void;

readonly decompressWitnessStack: (a: number, b: number, c: 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 __wbindgen_malloc: (a: number) => number;

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

@@ -23,2 +23,24 @@ 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') } } );

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

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,168 +223,2 @@ // primitive types

/**
* Sets the package's logging level.
*
* @param {LogLevel} level - The maximum level of logging to be emitted.
*/
export function initLogLevel(filter) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.initLogLevel(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
if (r1) {
throw takeObject(r0);
}
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
function passArray8ToWasm0(arg, malloc) {
const ptr = malloc(arg.length * 1) >>> 0;
getUint8Memory0().set(arg, ptr / 1);
WASM_VECTOR_LEN = arg.length;
return ptr;
}
/**
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
*
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
* @returns {WitnessMap} A witness map containing the circuit's return values.
* @param {Uint8Array} program
* @param {WitnessMap} witness_map
* @returns {WitnessMap}
*/
export function getReturnWitness(program, witness_map) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
if (r2) {
throw takeObject(r1);
}
return takeObject(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
/**
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
*
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
* @param {Uint8Array} program
* @param {WitnessMap} solved_witness
* @returns {WitnessMap}
*/
export function getPublicParametersWitness(program, solved_witness) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
if (r2) {
throw takeObject(r1);
}
return takeObject(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
/**
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
*
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
* @param {Uint8Array} program
* @param {WitnessMap} solved_witness
* @returns {WitnessMap}
*/
export function getPublicWitness(program, solved_witness) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
if (r2) {
throw takeObject(r1);
}
return takeObject(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
/**
* 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);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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`

@@ -455,2 +289,9 @@ * @param {string} lhs

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) {

@@ -524,2 +365,116 @@ ptr = ptr >>> 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);
}
/**
* Sets the package's logging level.
*
* @param {LogLevel} level - The maximum level of logging to be emitted.
*/
export function initLogLevel(filter) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.initLogLevel(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
if (r1) {
throw takeObject(r0);
}
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
/**
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
*
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
* @returns {WitnessMap} A witness map containing the circuit's return values.
* @param {Uint8Array} program
* @param {WitnessMap} witness_map
* @returns {WitnessMap}
*/
export function getReturnWitness(program, witness_map) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
if (r2) {
throw takeObject(r1);
}
return takeObject(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
/**
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
*
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
* @param {Uint8Array} program
* @param {WitnessMap} solved_witness
* @returns {WitnessMap}
*/
export function getPublicParametersWitness(program, solved_witness) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
if (r2) {
throw takeObject(r1);
}
return takeObject(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
/**
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
*
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
* @param {Uint8Array} program
* @param {WitnessMap} solved_witness
* @returns {WitnessMap}
*/
export function getPublicWitness(program, solved_witness) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
if (r2) {
throw takeObject(r1);
}
return takeObject(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
/**
* Compresses a `WitnessMap` into the binary format outputted by Nargo.

@@ -623,2 +578,48 @@ *

/**
* 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);
}
/**
* 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);
}
/**
* 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);
}
function __wbg_adapter_75(arg0, arg1, arg2, arg3, arg4) {

@@ -676,14 +677,8 @@ wasm.wasm_bindgen__convert__closures__invoke3_mut__h45040feada3ebb25(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));

};
imports.wbg.__wbindgen_is_string = function(arg0) {
const ret = typeof(getObject(arg0)) === 'string';
return 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_is_array = function(arg0) {
const ret = Array.isArray(getObject(arg0));
return ret;
};
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
const ret = getStringFromWasm0(arg0, arg1);
return addHeapObject(ret);
};
imports.wbg.__wbindgen_cb_drop = function(arg0) {

@@ -702,6 +697,10 @@ const obj = takeObject(arg0).original;

};
imports.wbg.__wbg_new_d9156d5ca3339252 = function() {
const ret = new Map();
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
const ret = getStringFromWasm0(arg0, arg1);
return addHeapObject(ret);
};
imports.wbg.__wbg_new_1549a44c58f2740a = function() {
const ret = new Array();
return addHeapObject(ret);
};
imports.wbg.__wbindgen_number_new = function(arg0) {

@@ -711,2 +710,14 @@ const ret = arg0;

};
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_new_d9156d5ca3339252 = function() {
const ret = new Map();
return addHeapObject(ret);
};
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {

@@ -720,12 +731,2 @@ const obj = getObject(arg1);

};
imports.wbg.__wbg_new_1549a44c58f2740a = function() {
const ret = new Array();
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.__wbg_new_abda76e883ba8a5f = function() {

@@ -732,0 +733,0 @@ const ret = new Error();

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