Socket
Socket
Sign inDemoInstall

@noir-lang/acvm_js

Package Overview
Dependencies
Maintainers
0
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.50.0 to 0.51.0

10

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 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;
export function xor(a: number, b: number): number;
export function sha256(a: number, b: number, c: number): void;
export function sha256_compression(a: number, b: number, c: number, d: number, e: number): void;
export function blake2s256(a: number, b: number, c: number): void;

@@ -15,3 +19,2 @@ export function keccak256(a: number, b: number, c: number): void;

export function decompressWitnessStack(a: number, b: number, c: number): void;
export function initLogLevel(a: number, b: number, c: number): void;
export function buildInfo(): number;

@@ -21,5 +24,2 @@ export function getReturnWitness(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 __wbindgen_malloc(a: number): number;

@@ -26,0 +26,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;
/**
* 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`

@@ -18,7 +52,8 @@ * @param {string} lhs

/**
* Calculates the SHA256 hash of the input bytes
* @param {Uint8Array} inputs
* @returns {Uint8Array}
* Sha256 compression function
* @param {Uint32Array} inputs
* @param {Uint32Array} state
* @returns {Uint32Array}
*/
export function sha256(inputs: Uint8Array): Uint8Array;
export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
/**

@@ -84,8 +119,2 @@ * Calculates the Blake2s256 hash of the input bytes

/**
* Sets the package's logging level.
*
* @param {LogLevel} level - The maximum level of logging to be emitted.
*/
export function initLogLevel(filter: string): void;
/**
* Returns the `BuildInfo` object containing information about how the installed package was built.

@@ -128,31 +157,18 @@ * @returns {BuildInfo} - Information on how the installed package was built.

export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
// Map from witness index to hex string value of witness.
export type WitnessMap = Map<number, string>;
/**
* 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>;
* 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 ForeignCallInput = string[]

@@ -172,18 +188,3 @@ export type ForeignCallOutput = string | string[]

// 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;
}
/**
* @typedef {Object} BuildInfo - Information about how the installed package was built

@@ -190,0 +191,0 @@ * @property {string} gitHash - The hash of the git commit from which the package was built.

@@ -12,2 +12,16 @@ let imports = {};

let heap_next = heap.length;
function dropObject(idx) {
if (idx < 132) return;
heap[idx] = heap_next;
heap_next = idx;
}
function takeObject(idx) {
const ret = getObject(idx);
dropObject(idx);
return ret;
}
function isLikeNone(x) {

@@ -35,16 +49,2 @@ return x === undefined || x === null;

let heap_next = heap.length;
function dropObject(idx) {
if (idx < 132) return;
heap[idx] = heap_next;
heap_next = idx;
}
function takeObject(idx) {
const ret = getObject(idx);
dropObject(idx);
return ret;
}
function addHeapObject(obj) {

@@ -226,2 +226,75 @@ if (heap_next === heap.length) heap.push(heap.length + 1);

/**
* 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;
}
/**
* 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`

@@ -248,5 +321,14 @@ * @param {string} lhs

function passArray8ToWasm0(arg, malloc) {
const ptr = malloc(arg.length * 1) >>> 0;
getUint8Memory0().set(arg, ptr / 1);
let cachedUint32Memory0 = null;
function getUint32Memory0() {
if (cachedUint32Memory0 === null || cachedUint32Memory0.byteLength === 0) {
cachedUint32Memory0 = new Uint32Array(wasm.memory.buffer);
}
return cachedUint32Memory0;
}
function passArray32ToWasm0(arg, malloc) {
const ptr = malloc(arg.length * 4) >>> 0;
getUint32Memory0().set(arg, ptr / 4);
WASM_VECTOR_LEN = arg.length;

@@ -256,22 +338,25 @@ return ptr;

function getArrayU8FromWasm0(ptr, len) {
function getArrayU32FromWasm0(ptr, len) {
ptr = ptr >>> 0;
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
return getUint32Memory0().subarray(ptr / 4, ptr / 4 + len);
}
/**
* Calculates the SHA256 hash of the input bytes
* @param {Uint8Array} inputs
* @returns {Uint8Array}
* Sha256 compression function
* @param {Uint32Array} inputs
* @param {Uint32Array} state
* @returns {Uint32Array}
*/
module.exports.sha256 = function(inputs) {
module.exports.sha256_compression = function(inputs, state) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.sha256(retptr, ptr0, len0);
const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
const len1 = WASM_VECTOR_LEN;
wasm.sha256_compression(retptr, ptr0, len0, ptr1, len1);
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;
var v3 = getArrayU32FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 4);
return v3;
} finally {

@@ -282,2 +367,6 @@ wasm.__wbindgen_add_to_stack_pointer(16);

function getArrayU8FromWasm0(ptr, len) {
ptr = ptr >>> 0;
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
}
/**

@@ -467,23 +556,2 @@ * Calculates the Blake2s256 hash of the input bytes

/**
* 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);
}
};
/**
* Returns the `BuildInfo` object containing information about how the installed package was built.

@@ -581,48 +649,2 @@ * @returns {BuildInfo} - Information on how the installed package was built.

/**
* 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_76(arg0, arg1, arg2, arg3, arg4) {

@@ -643,2 +665,12 @@ wasm.wasm_bindgen__convert__closures__invoke3_mut__h17fc532521b46256(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));

module.exports.__wbindgen_cb_drop = function(arg0) {
const obj = takeObject(arg0).original;
if (obj.cnt-- == 1) {
obj.a = 0;
return true;
}
const ret = false;
return ret;
};
module.exports.__wbindgen_number_get = function(arg0, arg1) {

@@ -655,13 +687,3 @@ const obj = getObject(arg1);

module.exports.__wbindgen_cb_drop = function(arg0) {
const obj = takeObject(arg0).original;
if (obj.cnt-- == 1) {
obj.a = 0;
return true;
}
const ret = false;
return ret;
};
module.exports.__wbg_new_7c63fcfa4f1f863b = function() {
module.exports.__wbg_new_3b3e21164d5381ca = function() {
const ret = new Map();

@@ -690,3 +712,3 @@ return addHeapObject(ret);

module.exports.__wbg_constructor_cd1bce44c75e1104 = function(arg0) {
module.exports.__wbg_constructor_f4bcf4c70838c703 = function(arg0) {
const ret = new Error(takeObject(arg0));

@@ -696,7 +718,2 @@ return addHeapObject(ret);

module.exports.__wbg_new_76b464e4772843b0 = function() {
const ret = new Array();
return addHeapObject(ret);
};
module.exports.__wbindgen_is_array = function(arg0) {

@@ -712,2 +729,7 @@ const ret = Array.isArray(getObject(arg0));

module.exports.__wbg_new_e14625531a95427d = function() {
const ret = new Array();
return addHeapObject(ret);
};
module.exports.__wbg_new_abda76e883ba8a5f = function() {

@@ -932,3 +954,3 @@ const ret = new Error();

module.exports.__wbindgen_closure_wrapper747 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 265, __wbg_adapter_22);
const ret = makeMutClosure(arg0, arg1, 266, __wbg_adapter_22);
return addHeapObject(ret);

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

{
"name": "@noir-lang/acvm_js",
"version": "0.50.0",
"version": "0.51.0",
"publishConfig": {

@@ -43,3 +43,3 @@ "access": "public"

"@web/test-runner": "^0.18.1",
"@web/test-runner-playwright": "^0.10.0",
"@web/test-runner-playwright": "^0.11.0",
"chai": "^4.4.1",

@@ -46,0 +46,0 @@ "eslint": "^8.57.0",

/* tslint:disable */
/* eslint-disable */
export const memory: WebAssembly.Memory;
export function initLogLevel(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 and(a: number, b: number): number;
export function xor(a: number, b: number): number;
export function sha256(a: number, b: number, c: number): void;
export function sha256_compression(a: number, b: number, c: number, d: number, e: number): void;
export function blake2s256(a: number, b: number, c: number): void;

@@ -15,3 +19,2 @@ export function keccak256(a: number, b: number, c: number): void;

export function decompressWitnessStack(a: number, b: number, c: number): void;
export function initLogLevel(a: number, b: number, c: number): void;
export function buildInfo(): number;

@@ -21,5 +24,2 @@ export function getReturnWitness(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 __wbindgen_malloc(a: number): number;

@@ -26,0 +26,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;
/**
* 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`

@@ -18,7 +52,8 @@ * @param {string} lhs

/**
* Calculates the SHA256 hash of the input bytes
* @param {Uint8Array} inputs
* @returns {Uint8Array}
* Sha256 compression function
* @param {Uint32Array} inputs
* @param {Uint32Array} state
* @returns {Uint32Array}
*/
export function sha256(inputs: Uint8Array): Uint8Array;
export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
/**

@@ -84,8 +119,2 @@ * Calculates the Blake2s256 hash of the input bytes

/**
* Sets the package's logging level.
*
* @param {LogLevel} level - The maximum level of logging to be emitted.
*/
export function initLogLevel(filter: string): void;
/**
* Returns the `BuildInfo` object containing information about how the installed package was built.

@@ -128,31 +157,18 @@ * @returns {BuildInfo} - Information on how the installed package was built.

export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
// Map from witness index to hex string value of witness.
export type WitnessMap = Map<number, string>;
/**
* 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>;
* 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 ForeignCallInput = string[]

@@ -172,18 +188,3 @@ export type ForeignCallOutput = string | string[]

// 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;
}
/**
* @typedef {Object} BuildInfo - Information about how the installed package was built

@@ -228,5 +229,9 @@ * @property {string} gitHash - The hash of the git commit from which the package was built.

readonly memory: WebAssembly.Memory;
readonly initLogLevel: (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 and: (a: number, b: number) => number;
readonly xor: (a: number, b: number) => number;
readonly sha256: (a: number, b: number, c: number) => void;
readonly sha256_compression: (a: number, b: number, c: number, d: number, e: number) => void;
readonly blake2s256: (a: number, b: number, c: number) => void;

@@ -240,3 +245,2 @@ readonly keccak256: (a: number, b: number, c: number) => void;

readonly decompressWitnessStack: (a: number, b: number, c: number) => void;
readonly initLogLevel: (a: number, b: number, c: number) => void;
readonly buildInfo: () => number;

@@ -246,5 +250,2 @@ readonly getReturnWitness: (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 __wbindgen_malloc: (a: number) => number;

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

@@ -9,2 +9,16 @@ let wasm;

let heap_next = heap.length;
function dropObject(idx) {
if (idx < 132) return;
heap[idx] = heap_next;
heap_next = idx;
}
function takeObject(idx) {
const ret = getObject(idx);
dropObject(idx);
return ret;
}
function isLikeNone(x) {

@@ -32,16 +46,2 @@ return x === undefined || x === null;

let heap_next = heap.length;
function dropObject(idx) {
if (idx < 132) return;
heap[idx] = heap_next;
heap_next = idx;
}
function takeObject(idx) {
const ret = getObject(idx);
dropObject(idx);
return ret;
}
function addHeapObject(obj) {

@@ -223,2 +223,75 @@ if (heap_next === heap.length) heap.push(heap.length + 1);

/**
* 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;
}
/**
* 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`

@@ -245,5 +318,14 @@ * @param {string} lhs

function passArray8ToWasm0(arg, malloc) {
const ptr = malloc(arg.length * 1) >>> 0;
getUint8Memory0().set(arg, ptr / 1);
let cachedUint32Memory0 = null;
function getUint32Memory0() {
if (cachedUint32Memory0 === null || cachedUint32Memory0.byteLength === 0) {
cachedUint32Memory0 = new Uint32Array(wasm.memory.buffer);
}
return cachedUint32Memory0;
}
function passArray32ToWasm0(arg, malloc) {
const ptr = malloc(arg.length * 4) >>> 0;
getUint32Memory0().set(arg, ptr / 4);
WASM_VECTOR_LEN = arg.length;

@@ -253,22 +335,25 @@ return ptr;

function getArrayU8FromWasm0(ptr, len) {
function getArrayU32FromWasm0(ptr, len) {
ptr = ptr >>> 0;
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
return getUint32Memory0().subarray(ptr / 4, ptr / 4 + len);
}
/**
* Calculates the SHA256 hash of the input bytes
* @param {Uint8Array} inputs
* @returns {Uint8Array}
* Sha256 compression function
* @param {Uint32Array} inputs
* @param {Uint32Array} state
* @returns {Uint32Array}
*/
export function sha256(inputs) {
export function sha256_compression(inputs, state) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.sha256(retptr, ptr0, len0);
const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
const len1 = WASM_VECTOR_LEN;
wasm.sha256_compression(retptr, ptr0, len0, ptr1, len1);
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;
var v3 = getArrayU32FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 4);
return v3;
} finally {

@@ -279,2 +364,6 @@ wasm.__wbindgen_add_to_stack_pointer(16);

function getArrayU8FromWasm0(ptr, len) {
ptr = ptr >>> 0;
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
}
/**

@@ -464,23 +553,2 @@ * Calculates the Blake2s256 hash of the input bytes

/**
* 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);
}
}
/**
* Returns the `BuildInfo` object containing information about how the installed package was built.

@@ -578,48 +646,2 @@ * @returns {BuildInfo} - Information on how the installed package was built.

/**
* 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_76(arg0, arg1, arg2, arg3, arg4) {

@@ -674,2 +696,11 @@ wasm.wasm_bindgen__convert__closures__invoke3_mut__h17fc532521b46256(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));

imports.wbg = {};
imports.wbg.__wbindgen_cb_drop = function(arg0) {
const obj = takeObject(arg0).original;
if (obj.cnt-- == 1) {
obj.a = 0;
return true;
}
const ret = false;
return ret;
};
imports.wbg.__wbindgen_number_get = function(arg0, arg1) {

@@ -684,12 +715,3 @@ const obj = getObject(arg1);

};
imports.wbg.__wbindgen_cb_drop = function(arg0) {
const obj = takeObject(arg0).original;
if (obj.cnt-- == 1) {
obj.a = 0;
return true;
}
const ret = false;
return ret;
};
imports.wbg.__wbg_new_7c63fcfa4f1f863b = function() {
imports.wbg.__wbg_new_3b3e21164d5381ca = function() {
const ret = new Map();

@@ -714,10 +736,6 @@ return addHeapObject(ret);

};
imports.wbg.__wbg_constructor_cd1bce44c75e1104 = function(arg0) {
imports.wbg.__wbg_constructor_f4bcf4c70838c703 = function(arg0) {
const ret = new Error(takeObject(arg0));
return addHeapObject(ret);
};
imports.wbg.__wbg_new_76b464e4772843b0 = function() {
const ret = new Array();
return addHeapObject(ret);
};
imports.wbg.__wbindgen_is_array = function(arg0) {

@@ -731,2 +749,6 @@ const ret = Array.isArray(getObject(arg0));

};
imports.wbg.__wbg_new_e14625531a95427d = function() {
const ret = new Array();
return addHeapObject(ret);
};
imports.wbg.__wbg_new_abda76e883ba8a5f = function() {

@@ -916,3 +938,3 @@ const ret = new Error();

imports.wbg.__wbindgen_closure_wrapper747 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 265, __wbg_adapter_22);
const ret = makeMutClosure(arg0, arg1, 266, __wbg_adapter_22);
return addHeapObject(ret);

@@ -933,2 +955,3 @@ };

cachedInt32Memory0 = null;
cachedUint32Memory0 = null;
cachedUint8Memory0 = null;

@@ -935,0 +958,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