@noir-lang/acvm_js
Advanced tools
Comparing version 0.42.0 to 0.43.0-5992436.nightly
/* tslint:disable */ | ||
/* eslint-disable */ | ||
export const memory: WebAssembly.Memory; | ||
export function compressWitness(a: number, b: number): void; | ||
export function decompressWitness(a: number, b: number, c: number): void; | ||
export function compressWitnessStack(a: number, b: number): void; | ||
export function decompressWitnessStack(a: number, b: number, c: number): void; | ||
export function __wbg_wasmblackboxfunctionsolver_free(a: number): void; | ||
export function createBlackBoxSolver(): number; | ||
export function executeCircuit(a: number, b: number, c: number, d: number): number; | ||
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number, e: number): number; | ||
export function executeCircuitWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number; | ||
export function executeProgram(a: number, b: number, c: number, d: number): number; | ||
export function executeProgramWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number; | ||
export function 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 blake2s256(a: number, b: number, c: number): void; | ||
export function keccak256(a: number, b: number, c: number): void; | ||
export function ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: 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 ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number; | ||
export function keccak256(a: number, b: number, c: number): void; | ||
export function blake2s256(a: number, b: number, c: number): void; | ||
export function sha256(a: number, b: number, c: number): void; | ||
export function xor(a: number, b: number): number; | ||
export function and(a: number, b: number): number; | ||
export function executeCircuitWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number; | ||
export function executeCircuit(a: number, b: number, c: number, d: number): number; | ||
export function createBlackBoxSolver(): number; | ||
export function __wbg_wasmblackboxfunctionsolver_free(a: number): void; | ||
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 getPublicParametersWitness(a: number, b: number, c: number, d: number): void; | ||
export function getReturnWitness(a: number, b: number, c: number, d: number): void; | ||
export function initLogLevel(a: number, b: number, c: number): void; | ||
export function decompressWitness(a: number, b: number, c: number): void; | ||
export function compressWitness(a: number, b: number): void; | ||
export function buildInfo(): number; | ||
@@ -31,2 +36,3 @@ export function __wbg_trap_free(a: number): void; | ||
export function __wbindgen_exn_store(a: number): void; | ||
export function wasm_bindgen__convert__closures__invoke3_mut__h28a07b2d2a2056af(a: number, b: number, c: number, d: number, e: number): void; | ||
export function wasm_bindgen__convert__closures__invoke2_mut__h79f8a29187e94f15(a: number, b: number, c: number, d: number): void; |
/* tslint:disable */ | ||
/* eslint-disable */ | ||
/** | ||
* Verifies a ECDSA signature over the secp256r1 curve. | ||
* @param {Uint8Array} hashed_msg | ||
* @param {Uint8Array} public_key_x_bytes | ||
* @param {Uint8Array} public_key_y_bytes | ||
* @param {Uint8Array} signature | ||
* @returns {boolean} | ||
* Compresses a `WitnessMap` into the binary format outputted by Nargo. | ||
* | ||
* @param {WitnessMap} witness_map - A witness map. | ||
* @returns {Uint8Array} A compressed witness map | ||
*/ | ||
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean; | ||
export function compressWitness(witness_map: WitnessMap): Uint8Array; | ||
/** | ||
* Verifies a ECDSA signature over the secp256k1 curve. | ||
* @param {Uint8Array} hashed_msg | ||
* @param {Uint8Array} public_key_x_bytes | ||
* @param {Uint8Array} public_key_y_bytes | ||
* @param {Uint8Array} signature | ||
* @returns {boolean} | ||
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`. | ||
* This should be used to only fetch the witness map for the main function. | ||
* | ||
* @param {Uint8Array} compressed_witness - A compressed witness. | ||
* @returns {WitnessMap} The decompressed witness map. | ||
*/ | ||
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean; | ||
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap; | ||
/** | ||
* Calculates the Keccak256 hash of the input bytes | ||
* @param {Uint8Array} inputs | ||
* @returns {Uint8Array} | ||
* Compresses a `WitnessStack` into the binary format outputted by Nargo. | ||
* | ||
* @param {WitnessStack} witness_stack - A witness stack. | ||
* @returns {Uint8Array} A compressed witness stack | ||
*/ | ||
export function keccak256(inputs: Uint8Array): Uint8Array; | ||
export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array; | ||
/** | ||
* Calculates the Blake2s256 hash of the input bytes | ||
* @param {Uint8Array} inputs | ||
* @returns {Uint8Array} | ||
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`. | ||
* | ||
* @param {Uint8Array} compressed_witness - A compressed witness. | ||
* @returns {WitnessStack} The decompressed witness stack. | ||
*/ | ||
export function blake2s256(inputs: Uint8Array): Uint8Array; | ||
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack; | ||
/** | ||
* Calculates the SHA256 hash of the input bytes | ||
* @param {Uint8Array} inputs | ||
* @returns {Uint8Array} | ||
* @returns {Promise<WasmBlackBoxFunctionSolver>} | ||
*/ | ||
export function sha256(inputs: Uint8Array): Uint8Array; | ||
export function createBlackBoxSolver(): Promise<WasmBlackBoxFunctionSolver>; | ||
/** | ||
* Performs a bitwise XOR operation between `lhs` and `rhs` | ||
* @param {string} lhs | ||
* @param {string} rhs | ||
* @returns {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 xor(lhs: string, rhs: string): string; | ||
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>; | ||
/** | ||
* Performs a bitwise AND operation between `lhs` and `rhs` | ||
* @param {string} lhs | ||
* @param {string} rhs | ||
* @returns {string} | ||
*/ | ||
export function and(lhs: string, rhs: string): string; | ||
/** | ||
* 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. | ||
* | ||
@@ -60,8 +53,9 @@ * @param {&WasmBlackBoxFunctionSolver} solver - A black box solver. | ||
* @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. | ||
* @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 executeCircuitWithBlackBoxSolver(solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>; | ||
export function executeCircuitWithReturnWitness(solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>; | ||
/** | ||
* Executes an ACIR circuit to generate the solved witness from the initial witness. | ||
* | ||
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver. | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
@@ -72,18 +66,76 @@ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`.. | ||
*/ | ||
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>; | ||
export function executeCircuitWithBlackBoxSolver(solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>; | ||
/** | ||
* @returns {Promise<WasmBlackBoxFunctionSolver>} | ||
*/ | ||
export function createBlackBoxSolver(): Promise<WasmBlackBoxFunctionSolver>; | ||
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>; | ||
/** | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs. | ||
*/ | ||
export function executeProgramWithBlackBoxSolver(solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_executor: ForeignCallHandler): Promise<WitnessStack>; | ||
/** | ||
* Performs a bitwise AND operation between `lhs` and `rhs` | ||
* @param {string} lhs | ||
* @param {string} rhs | ||
* @returns {string} | ||
*/ | ||
export function and(lhs: string, rhs: string): string; | ||
/** | ||
* Performs a bitwise XOR operation between `lhs` and `rhs` | ||
* @param {string} lhs | ||
* @param {string} rhs | ||
* @returns {string} | ||
*/ | ||
export function xor(lhs: string, rhs: string): string; | ||
/** | ||
* Calculates the SHA256 hash of the input bytes | ||
* @param {Uint8Array} inputs | ||
* @returns {Uint8Array} | ||
*/ | ||
export function sha256(inputs: Uint8Array): Uint8Array; | ||
/** | ||
* Calculates the Blake2s256 hash of the input bytes | ||
* @param {Uint8Array} inputs | ||
* @returns {Uint8Array} | ||
*/ | ||
export function blake2s256(inputs: Uint8Array): Uint8Array; | ||
/** | ||
* Calculates the Keccak256 hash of the input bytes | ||
* @param {Uint8Array} inputs | ||
* @returns {Uint8Array} | ||
*/ | ||
export function keccak256(inputs: Uint8Array): Uint8Array; | ||
/** | ||
* Verifies a ECDSA signature over the secp256k1 curve. | ||
* @param {Uint8Array} hashed_msg | ||
* @param {Uint8Array} public_key_x_bytes | ||
* @param {Uint8Array} public_key_y_bytes | ||
* @param {Uint8Array} signature | ||
* @returns {boolean} | ||
*/ | ||
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean; | ||
/** | ||
* Verifies a ECDSA signature over the secp256r1 curve. | ||
* @param {Uint8Array} hashed_msg | ||
* @param {Uint8Array} public_key_x_bytes | ||
* @param {Uint8Array} public_key_y_bytes | ||
* @param {Uint8Array} signature | ||
* @returns {boolean} | ||
*/ | ||
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean; | ||
/** | ||
* 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 public inputs. | ||
* @returns {WitnessMap} A witness map containing the circuit's return values. | ||
* @param {Uint8Array} program | ||
* @param {WitnessMap} solved_witness | ||
* @param {WitnessMap} witness_map | ||
* @returns {WitnessMap} | ||
*/ | ||
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap; | ||
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap; | ||
/** | ||
@@ -101,33 +153,13 @@ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters. | ||
/** | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values. | ||
* 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 return values. | ||
* @returns {WitnessMap} A witness map containing the circuit's public inputs. | ||
* @param {Uint8Array} program | ||
* @param {WitnessMap} witness_map | ||
* @param {WitnessMap} solved_witness | ||
* @returns {WitnessMap} | ||
*/ | ||
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap; | ||
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap; | ||
/** | ||
* Sets the package's logging level. | ||
* | ||
* @param {LogLevel} level - The maximum level of logging to be emitted. | ||
*/ | ||
export function initLogLevel(filter: string): void; | ||
/** | ||
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`. | ||
* | ||
* @param {Uint8Array} compressed_witness - A compressed witness. | ||
* @returns {WitnessMap} The decompressed witness map. | ||
*/ | ||
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap; | ||
/** | ||
* Compresses a `WitnessMap` into the binary format outputted by Nargo. | ||
* | ||
* @param {Uint8Array} compressed_witness - A witness map. | ||
* @returns {WitnessMap} A compressed witness map | ||
*/ | ||
export function compressWitness(witness_map: WitnessMap): Uint8Array; | ||
/** | ||
* Returns the `BuildInfo` object containing information about how the installed package was built. | ||
@@ -138,13 +170,2 @@ * @returns {BuildInfo} - Information on how the installed package was built. | ||
export type ExecutionError = Error & { | ||
callStack?: string[]; | ||
}; | ||
// Map from witness index to hex string value of witness. | ||
export type WitnessMap = Map<number, string>; | ||
export type ForeignCallInput = string[] | ||
@@ -164,3 +185,24 @@ export type ForeignCallOutput = string | string[] | ||
export type ExecutionError = Error & { | ||
callStack?: 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 | ||
@@ -178,2 +220,11 @@ * @property {string} gitHash - The hash of the git commit from which the package was built. | ||
export type StackItem = { | ||
index: number; | ||
witness: WitnessMap; | ||
} | ||
export type WitnessStack = Array<StackItem>; | ||
/** | ||
@@ -180,0 +231,0 @@ */ |
let imports = {}; | ||
imports['__wbindgen_placeholder__'] = module.exports; | ||
let wasm; | ||
const { TextEncoder, TextDecoder } = require(`util`); | ||
const { TextDecoder, TextEncoder } = require(`util`); | ||
@@ -26,13 +26,28 @@ const heap = new Array(128).fill(undefined); | ||
function addHeapObject(obj) { | ||
if (heap_next === heap.length) heap.push(heap.length + 1); | ||
const idx = heap_next; | ||
heap_next = heap[idx]; | ||
function isLikeNone(x) { | ||
return x === undefined || x === null; | ||
} | ||
heap[idx] = obj; | ||
return idx; | ||
let cachedFloat64Memory0 = null; | ||
function getFloat64Memory0() { | ||
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) { | ||
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer); | ||
} | ||
return cachedFloat64Memory0; | ||
} | ||
let WASM_VECTOR_LEN = 0; | ||
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 }); | ||
cachedTextDecoder.decode(); | ||
let cachedUint8Memory0 = null; | ||
@@ -47,2 +62,18 @@ | ||
function getStringFromWasm0(ptr, len) { | ||
ptr = ptr >>> 0; | ||
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); | ||
} | ||
function addHeapObject(obj) { | ||
if (heap_next === heap.length) heap.push(heap.length + 1); | ||
const idx = heap_next; | ||
heap_next = heap[idx]; | ||
heap[idx] = obj; | ||
return idx; | ||
} | ||
let WASM_VECTOR_LEN = 0; | ||
let cachedTextEncoder = new TextEncoder('utf-8'); | ||
@@ -101,33 +132,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 cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); | ||
cachedTextDecoder.decode(); | ||
function getStringFromWasm0(ptr, len) { | ||
ptr = ptr >>> 0; | ||
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); | ||
} | ||
let cachedFloat64Memory0 = null; | ||
function getFloat64Memory0() { | ||
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) { | ||
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer); | ||
} | ||
return cachedFloat64Memory0; | ||
} | ||
let cachedBigInt64Memory0 = null; | ||
@@ -235,2 +235,31 @@ | ||
function getArrayU8FromWasm0(ptr, len) { | ||
ptr = ptr >>> 0; | ||
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len); | ||
} | ||
/** | ||
* Compresses a `WitnessMap` into the binary format outputted by Nargo. | ||
* | ||
* @param {WitnessMap} witness_map - A witness map. | ||
* @returns {Uint8Array} A compressed witness map | ||
*/ | ||
module.exports.compressWitness = function(witness_map) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
wasm.compressWitness(retptr, addHeapObject(witness_map)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
var r3 = getInt32Memory0()[retptr / 4 + 3]; | ||
if (r3) { | ||
throw takeObject(r2); | ||
} | ||
var v1 = getArrayU8FromWasm0(r0, r1).slice(); | ||
wasm.__wbindgen_free(r0, r1 * 1); | ||
return v1; | ||
} finally { | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
} | ||
}; | ||
function passArray8ToWasm0(arg, malloc) { | ||
@@ -243,63 +272,21 @@ const ptr = malloc(arg.length * 1) >>> 0; | ||
/** | ||
* Verifies a ECDSA signature over the secp256r1 curve. | ||
* @param {Uint8Array} hashed_msg | ||
* @param {Uint8Array} public_key_x_bytes | ||
* @param {Uint8Array} public_key_y_bytes | ||
* @param {Uint8Array} signature | ||
* @returns {boolean} | ||
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`. | ||
* This should be used to only fetch the witness map for the main function. | ||
* | ||
* @param {Uint8Array} compressed_witness - A compressed witness. | ||
* @returns {WitnessMap} The decompressed witness map. | ||
*/ | ||
module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) { | ||
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc); | ||
const len1 = WASM_VECTOR_LEN; | ||
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc); | ||
const len2 = WASM_VECTOR_LEN; | ||
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc); | ||
const len3 = WASM_VECTOR_LEN; | ||
const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3); | ||
return ret !== 0; | ||
}; | ||
/** | ||
* Verifies a ECDSA signature over the secp256k1 curve. | ||
* @param {Uint8Array} hashed_msg | ||
* @param {Uint8Array} public_key_x_bytes | ||
* @param {Uint8Array} public_key_y_bytes | ||
* @param {Uint8Array} signature | ||
* @returns {boolean} | ||
*/ | ||
module.exports.ecdsa_secp256k1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) { | ||
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc); | ||
const len1 = WASM_VECTOR_LEN; | ||
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc); | ||
const len2 = WASM_VECTOR_LEN; | ||
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc); | ||
const len3 = WASM_VECTOR_LEN; | ||
const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3); | ||
return ret !== 0; | ||
}; | ||
function getArrayU8FromWasm0(ptr, len) { | ||
ptr = ptr >>> 0; | ||
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len); | ||
} | ||
/** | ||
* Calculates the Keccak256 hash of the input bytes | ||
* @param {Uint8Array} inputs | ||
* @returns {Uint8Array} | ||
*/ | ||
module.exports.keccak256 = function(inputs) { | ||
module.exports.decompressWitness = function(compressed_witness) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc); | ||
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.keccak256(retptr, ptr0, len0); | ||
wasm.decompressWitness(retptr, ptr0, len0); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var v2 = getArrayU8FromWasm0(r0, r1).slice(); | ||
wasm.__wbindgen_free(r0, r1 * 1); | ||
return v2; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
if (r2) { | ||
throw takeObject(r1); | ||
} | ||
return takeObject(r0); | ||
} finally { | ||
@@ -311,17 +298,21 @@ wasm.__wbindgen_add_to_stack_pointer(16); | ||
/** | ||
* Calculates the Blake2s256 hash of the input bytes | ||
* @param {Uint8Array} inputs | ||
* @returns {Uint8Array} | ||
* Compresses a `WitnessStack` into the binary format outputted by Nargo. | ||
* | ||
* @param {WitnessStack} witness_stack - A witness stack. | ||
* @returns {Uint8Array} A compressed witness stack | ||
*/ | ||
module.exports.blake2s256 = function(inputs) { | ||
module.exports.compressWitnessStack = function(witness_stack) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.blake2s256(retptr, ptr0, len0); | ||
wasm.compressWitnessStack(retptr, addHeapObject(witness_stack)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var v2 = getArrayU8FromWasm0(r0, r1).slice(); | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
var r3 = getInt32Memory0()[retptr / 4 + 3]; | ||
if (r3) { | ||
throw takeObject(r2); | ||
} | ||
var v1 = getArrayU8FromWasm0(r0, r1).slice(); | ||
wasm.__wbindgen_free(r0, r1 * 1); | ||
return v2; | ||
return v1; | ||
} finally { | ||
@@ -333,17 +324,20 @@ wasm.__wbindgen_add_to_stack_pointer(16); | ||
/** | ||
* Calculates the SHA256 hash of the input bytes | ||
* @param {Uint8Array} inputs | ||
* @returns {Uint8Array} | ||
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`. | ||
* | ||
* @param {Uint8Array} compressed_witness - A compressed witness. | ||
* @returns {WitnessStack} The decompressed witness stack. | ||
*/ | ||
module.exports.sha256 = function(inputs) { | ||
module.exports.decompressWitnessStack = function(compressed_witness) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc); | ||
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.sha256(retptr, ptr0, len0); | ||
wasm.decompressWitnessStack(retptr, ptr0, len0); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var v2 = getArrayU8FromWasm0(r0, r1).slice(); | ||
wasm.__wbindgen_free(r0, r1 * 1); | ||
return v2; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
if (r2) { | ||
throw takeObject(r1); | ||
} | ||
return takeObject(r0); | ||
} finally { | ||
@@ -355,9 +349,6 @@ wasm.__wbindgen_add_to_stack_pointer(16); | ||
/** | ||
* Performs a bitwise XOR operation between `lhs` and `rhs` | ||
* @param {string} lhs | ||
* @param {string} rhs | ||
* @returns {string} | ||
* @returns {Promise<WasmBlackBoxFunctionSolver>} | ||
*/ | ||
module.exports.xor = function(lhs, rhs) { | ||
const ret = wasm.xor(addHeapObject(lhs), addHeapObject(rhs)); | ||
module.exports.createBlackBoxSolver = function() { | ||
const ret = wasm.createBlackBoxSolver(); | ||
return takeObject(ret); | ||
@@ -367,9 +358,13 @@ }; | ||
/** | ||
* Performs a bitwise AND operation between `lhs` and `rhs` | ||
* @param {string} lhs | ||
* @param {string} rhs | ||
* @returns {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. | ||
*/ | ||
module.exports.and = function(lhs, rhs) { | ||
const ret = wasm.and(addHeapObject(lhs), addHeapObject(rhs)); | ||
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); | ||
@@ -386,2 +381,3 @@ }; | ||
* 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. | ||
* | ||
@@ -392,9 +388,9 @@ * @param {&WasmBlackBoxFunctionSolver} solver - A black box solver. | ||
* @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. | ||
* @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.executeCircuitWithBlackBoxSolver = function(solver, program, initial_witness, foreign_call_handler) { | ||
module.exports.executeCircuitWithReturnWitness = function(solver, program, initial_witness, foreign_call_handler) { | ||
_assertClass(solver, WasmBlackBoxFunctionSolver); | ||
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
const ret = wasm.executeCircuitWithBlackBoxSolver(solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler)); | ||
const ret = wasm.executeCircuitWithReturnWitness(solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler)); | ||
return takeObject(ret); | ||
@@ -406,2 +402,3 @@ }; | ||
* | ||
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver. | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
@@ -412,6 +409,7 @@ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`.. | ||
*/ | ||
module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) { | ||
module.exports.executeCircuitWithBlackBoxSolver = function(solver, program, initial_witness, foreign_call_handler) { | ||
_assertClass(solver, WasmBlackBoxFunctionSolver); | ||
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler)); | ||
const ret = wasm.executeCircuitWithBlackBoxSolver(solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler)); | ||
return takeObject(ret); | ||
@@ -421,6 +419,7 @@ }; | ||
/** | ||
* @returns {Promise<WasmBlackBoxFunctionSolver>} | ||
*/ | ||
module.exports.createBlackBoxSolver = function() { | ||
const ret = wasm.createBlackBoxSolver(); | ||
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); | ||
@@ -430,24 +429,49 @@ }; | ||
/** | ||
* 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) { | ||
module.exports.executeProgramWithBlackBoxSolver = function(solver, program, initial_witness, foreign_call_executor) { | ||
_assertClass(solver, WasmBlackBoxFunctionSolver); | ||
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
const ret = wasm.executeProgramWithBlackBoxSolver(solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_executor)); | ||
return takeObject(ret); | ||
}; | ||
/** | ||
* Performs a bitwise AND operation between `lhs` and `rhs` | ||
* @param {string} lhs | ||
* @param {string} rhs | ||
* @returns {string} | ||
*/ | ||
module.exports.and = function(lhs, rhs) { | ||
const ret = wasm.and(addHeapObject(lhs), addHeapObject(rhs)); | ||
return takeObject(ret); | ||
}; | ||
/** | ||
* Performs a bitwise XOR operation between `lhs` and `rhs` | ||
* @param {string} lhs | ||
* @param {string} rhs | ||
* @returns {string} | ||
*/ | ||
module.exports.xor = function(lhs, rhs) { | ||
const ret = wasm.xor(addHeapObject(lhs), addHeapObject(rhs)); | ||
return takeObject(ret); | ||
}; | ||
/** | ||
* Calculates the SHA256 hash of the input bytes | ||
* @param {Uint8Array} inputs | ||
* @returns {Uint8Array} | ||
*/ | ||
module.exports.sha256 = function(inputs) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc); | ||
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness)); | ||
wasm.sha256(retptr, ptr0, len0); | ||
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); | ||
var v2 = getArrayU8FromWasm0(r0, r1).slice(); | ||
wasm.__wbindgen_free(r0, r1 * 1); | ||
return v2; | ||
} finally { | ||
@@ -459,24 +483,17 @@ 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} | ||
* Calculates the Blake2s256 hash of the input bytes | ||
* @param {Uint8Array} inputs | ||
* @returns {Uint8Array} | ||
*/ | ||
module.exports.getPublicParametersWitness = function(program, solved_witness) { | ||
module.exports.blake2s256 = function(inputs) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc); | ||
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness)); | ||
wasm.blake2s256(retptr, ptr0, len0); | ||
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); | ||
var v2 = getArrayU8FromWasm0(r0, r1).slice(); | ||
wasm.__wbindgen_free(r0, r1 * 1); | ||
return v2; | ||
} finally { | ||
@@ -488,24 +505,17 @@ 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} | ||
* Calculates the Keccak256 hash of the input bytes | ||
* @param {Uint8Array} inputs | ||
* @returns {Uint8Array} | ||
*/ | ||
module.exports.getReturnWitness = function(program, witness_map) { | ||
module.exports.keccak256 = function(inputs) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc); | ||
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map)); | ||
wasm.keccak256(retptr, ptr0, len0); | ||
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); | ||
var v2 = getArrayU8FromWasm0(r0, r1).slice(); | ||
wasm.__wbindgen_free(r0, r1 * 1); | ||
return v2; | ||
} finally { | ||
@@ -517,2 +527,44 @@ wasm.__wbindgen_add_to_stack_pointer(16); | ||
/** | ||
* Verifies a ECDSA signature over the secp256k1 curve. | ||
* @param {Uint8Array} hashed_msg | ||
* @param {Uint8Array} public_key_x_bytes | ||
* @param {Uint8Array} public_key_y_bytes | ||
* @param {Uint8Array} signature | ||
* @returns {boolean} | ||
*/ | ||
module.exports.ecdsa_secp256k1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) { | ||
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc); | ||
const len1 = WASM_VECTOR_LEN; | ||
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc); | ||
const len2 = WASM_VECTOR_LEN; | ||
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc); | ||
const len3 = WASM_VECTOR_LEN; | ||
const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3); | ||
return ret !== 0; | ||
}; | ||
/** | ||
* Verifies a ECDSA signature over the secp256r1 curve. | ||
* @param {Uint8Array} hashed_msg | ||
* @param {Uint8Array} public_key_x_bytes | ||
* @param {Uint8Array} public_key_y_bytes | ||
* @param {Uint8Array} signature | ||
* @returns {boolean} | ||
*/ | ||
module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) { | ||
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc); | ||
const len1 = WASM_VECTOR_LEN; | ||
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc); | ||
const len2 = WASM_VECTOR_LEN; | ||
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc); | ||
const len3 = WASM_VECTOR_LEN; | ||
const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3); | ||
return ret !== 0; | ||
}; | ||
/** | ||
* Sets the package's logging level. | ||
@@ -539,13 +591,17 @@ * | ||
/** | ||
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`. | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values. | ||
* | ||
* @param {Uint8Array} compressed_witness - A compressed witness. | ||
* @returns {WitnessMap} The decompressed witness map. | ||
* @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.decompressWitness = function(compressed_witness) { | ||
module.exports.getReturnWitness = function(program, witness_map) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc); | ||
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.decompressWitness(retptr, ptr0, len0); | ||
wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
@@ -564,21 +620,24 @@ var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
/** | ||
* Compresses a `WitnessMap` into the binary format outputted by Nargo. | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters. | ||
* | ||
* @param {Uint8Array} compressed_witness - A witness map. | ||
* @returns {WitnessMap} A compressed witness map | ||
* @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.compressWitness = function(witness_map) { | ||
module.exports.getPublicParametersWitness = function(program, solved_witness) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
wasm.compressWitness(retptr, addHeapObject(witness_map)); | ||
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]; | ||
var r3 = getInt32Memory0()[retptr / 4 + 3]; | ||
if (r3) { | ||
throw takeObject(r2); | ||
if (r2) { | ||
throw takeObject(r1); | ||
} | ||
var v1 = getArrayU8FromWasm0(r0, r1).slice(); | ||
wasm.__wbindgen_free(r0, r1 * 1); | ||
return v1; | ||
return takeObject(r0); | ||
} finally { | ||
@@ -590,2 +649,30 @@ 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. | ||
@@ -606,3 +693,7 @@ * @returns {BuildInfo} - Information on how the installed package was built. | ||
} | ||
function __wbg_adapter_159(arg0, arg1, arg2, arg3) { | ||
function __wbg_adapter_134(arg0, arg1, arg2, arg3, arg4) { | ||
wasm.wasm_bindgen__convert__closures__invoke3_mut__h28a07b2d2a2056af(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4)); | ||
} | ||
function __wbg_adapter_171(arg0, arg1, arg2, arg3) { | ||
wasm.wasm_bindgen__convert__closures__invoke2_mut__h79f8a29187e94f15(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3)); | ||
@@ -666,2 +757,39 @@ } | ||
module.exports.__wbg_wasmblackboxfunctionsolver_new = function(arg0) { | ||
const ret = WasmBlackBoxFunctionSolver.__wrap(arg0); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbindgen_is_array = function(arg0) { | ||
const ret = Array.isArray(getObject(arg0)); | ||
return ret; | ||
}; | ||
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) { | ||
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_string_new = function(arg0, arg1) { | ||
const ret = getStringFromWasm0(arg0, arg1); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbindgen_is_undefined = function(arg0) { | ||
const ret = getObject(arg0) === undefined; | ||
return ret; | ||
}; | ||
module.exports.__wbindgen_object_clone_ref = function(arg0) { | ||
@@ -672,3 +800,8 @@ const ret = getObject(arg0); | ||
module.exports.__wbg_new_0d2c031c3755a625 = function() { | ||
module.exports.__wbg_constructor_885d22c82fec0fdb = function(arg0) { | ||
const ret = new Error(takeObject(arg0)); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbg_new_e1076c3a38c86fee = function() { | ||
const ret = new Map(); | ||
@@ -692,17 +825,2 @@ return addHeapObject(ret); | ||
module.exports.__wbg_constructor_9a4af6ecd5050c55 = function(arg0) { | ||
const ret = new Error(takeObject(arg0)); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbindgen_string_new = function(arg0, arg1) { | ||
const ret = getStringFromWasm0(arg0, arg1); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbg_wasmblackboxfunctionsolver_new = function(arg0) { | ||
const ret = WasmBlackBoxFunctionSolver.__wrap(arg0); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbindgen_error_new = function(arg0, arg1) { | ||
@@ -713,14 +831,2 @@ const ret = new Error(getStringFromWasm0(arg0, arg1)); | ||
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_undefined = function(arg0) { | ||
const ret = getObject(arg0) === undefined; | ||
return ret; | ||
}; | ||
module.exports.__wbindgen_is_string = function(arg0) { | ||
@@ -731,17 +837,7 @@ const ret = typeof(getObject(arg0)) === 'string'; | ||
module.exports.__wbindgen_is_array = function(arg0) { | ||
const ret = Array.isArray(getObject(arg0)); | ||
return ret; | ||
module.exports.__wbg_new_967d701c7af7cc58 = function() { | ||
const ret = new Array(); | ||
return addHeapObject(ret); | ||
}; | ||
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_abda76e883ba8a5f = function() { | ||
@@ -772,2 +868,12 @@ const ret = new Error(); | ||
module.exports.__wbindgen_bigint_from_i64 = function(arg0) { | ||
const ret = arg0; | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbindgen_bigint_from_u128 = function(arg0, arg1) { | ||
const ret = BigInt.asUintN(64, arg0) << BigInt(64) | BigInt.asUintN(64, arg1); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbindgen_ge = function(arg0, arg1) { | ||
@@ -798,12 +904,2 @@ const ret = getObject(arg0) >= getObject(arg1); | ||
module.exports.__wbindgen_bigint_from_i64 = function(arg0) { | ||
const ret = arg0; | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbindgen_bigint_from_u128 = function(arg0, arg1) { | ||
const ret = BigInt.asUintN(64, arg0) << BigInt(64) | BigInt.asUintN(64, arg1); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbindgen_is_object = function(arg0) { | ||
@@ -831,2 +927,34 @@ const val = getObject(arg0); | ||
module.exports.__wbg_debug_e3f6a1578e6d45ca = function(arg0) { | ||
console.debug(getObject(arg0)); | ||
}; | ||
module.exports.__wbg_debug_efabe4eb183aa5d4 = function(arg0, arg1, arg2, arg3) { | ||
console.debug(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3)); | ||
}; | ||
module.exports.__wbg_error_a7e23606158b68b9 = function(arg0) { | ||
console.error(getObject(arg0)); | ||
}; | ||
module.exports.__wbg_error_50f42b952a595a23 = function(arg0, arg1, arg2, arg3) { | ||
console.error(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3)); | ||
}; | ||
module.exports.__wbg_info_05db236d79f1b785 = function(arg0) { | ||
console.info(getObject(arg0)); | ||
}; | ||
module.exports.__wbg_info_24d8f53d98f12b95 = function(arg0, arg1, arg2, arg3) { | ||
console.info(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3)); | ||
}; | ||
module.exports.__wbg_warn_9bdd743e9f5fe1e0 = function(arg0) { | ||
console.warn(getObject(arg0)); | ||
}; | ||
module.exports.__wbg_warn_8342bfbc6028193a = function(arg0, arg1, arg2, arg3) { | ||
console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3)); | ||
}; | ||
module.exports.__wbg_crypto_c48a774b022d20ac = function(arg0) { | ||
@@ -870,34 +998,2 @@ const ret = getObject(arg0).crypto; | ||
module.exports.__wbg_debug_e3f6a1578e6d45ca = function(arg0) { | ||
console.debug(getObject(arg0)); | ||
}; | ||
module.exports.__wbg_debug_efabe4eb183aa5d4 = function(arg0, arg1, arg2, arg3) { | ||
console.debug(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3)); | ||
}; | ||
module.exports.__wbg_error_a7e23606158b68b9 = function(arg0) { | ||
console.error(getObject(arg0)); | ||
}; | ||
module.exports.__wbg_error_50f42b952a595a23 = function(arg0, arg1, arg2, arg3) { | ||
console.error(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3)); | ||
}; | ||
module.exports.__wbg_info_05db236d79f1b785 = function(arg0) { | ||
console.info(getObject(arg0)); | ||
}; | ||
module.exports.__wbg_info_24d8f53d98f12b95 = function(arg0, arg1, arg2, arg3) { | ||
console.info(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3)); | ||
}; | ||
module.exports.__wbg_warn_9bdd743e9f5fe1e0 = function(arg0) { | ||
console.warn(getObject(arg0)); | ||
}; | ||
module.exports.__wbg_warn_8342bfbc6028193a = function(arg0, arg1, arg2, arg3) { | ||
console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3)); | ||
}; | ||
module.exports.__wbg_get_7303ed2ef026b2f5 = function(arg0, arg1) { | ||
@@ -928,2 +1024,7 @@ const ret = getObject(arg0)[arg1 >>> 0]; | ||
module.exports.__wbg_new_0f2b71ca2f2a6029 = function() { | ||
const ret = new Map(); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbg_get_f53c921291c381bd = function() { return handleError(function (arg0, arg1) { | ||
@@ -978,2 +1079,20 @@ const ret = Reflect.get(getObject(arg0), getObject(arg1)); | ||
module.exports.__wbg_forEach_5ae261259d7517c8 = function(arg0, arg1, arg2) { | ||
try { | ||
var state0 = {a: arg1, b: arg2}; | ||
var cb0 = (arg0, arg1, arg2) => { | ||
const a = state0.a; | ||
state0.a = 0; | ||
try { | ||
return __wbg_adapter_134(a, state0.b, arg0, arg1, arg2); | ||
} finally { | ||
state0.a = a; | ||
} | ||
}; | ||
getObject(arg0).forEach(cb0); | ||
} finally { | ||
state0.a = state0.b = 0; | ||
} | ||
}; | ||
module.exports.__wbg_push_109cfc26d02582dd = function(arg0, arg1) { | ||
@@ -984,2 +1103,7 @@ const ret = getObject(arg0).push(getObject(arg1)); | ||
module.exports.__wbg_reverse_a322332d916e2705 = function(arg0) { | ||
const ret = getObject(arg0).reverse(); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbg_byteLength_1a59a59856fc656a = function(arg0) { | ||
@@ -1061,3 +1185,3 @@ const ret = getObject(arg0).byteLength; | ||
try { | ||
return __wbg_adapter_159(a, state0.b, arg0, arg1); | ||
return __wbg_adapter_171(a, state0.b, arg0, arg1); | ||
} finally { | ||
@@ -1094,2 +1218,7 @@ state0.a = a; | ||
module.exports.__wbg_fromEntries_d1b310956d20d858 = function() { return handleError(function (arg0) { | ||
const ret = Object.fromEntries(getObject(arg0)); | ||
return addHeapObject(ret); | ||
}, arguments) }; | ||
module.exports.__wbg_toString_e2b23ac99490a381 = function(arg0) { | ||
@@ -1100,2 +1229,7 @@ const ret = getObject(arg0).toString(); | ||
module.exports.__wbg_values_099fd000c271c313 = function(arg0) { | ||
const ret = Object.values(getObject(arg0)); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbg_new_2b55e405e4af4986 = function(arg0, arg1) { | ||
@@ -1108,3 +1242,3 @@ try { | ||
try { | ||
return __wbg_adapter_159(a, state0.b, arg0, arg1); | ||
return __wbg_adapter_171(a, state0.b, arg0, arg1); | ||
} finally { | ||
@@ -1271,4 +1405,4 @@ state0.a = a; | ||
module.exports.__wbindgen_closure_wrapper1401 = function(arg0, arg1, arg2) { | ||
const ret = makeMutClosure(arg0, arg1, 486, __wbg_adapter_52); | ||
module.exports.__wbindgen_closure_wrapper2124 = function(arg0, arg1, arg2) { | ||
const ret = makeMutClosure(arg0, arg1, 724, __wbg_adapter_52); | ||
return addHeapObject(ret); | ||
@@ -1275,0 +1409,0 @@ }; |
{ | ||
"name": "@noir-lang/acvm_js", | ||
"version": "0.42.0", | ||
"version": "0.43.0-5992436.nightly", | ||
"publishConfig": { | ||
@@ -37,5 +37,3 @@ "access": "public" | ||
"nightly:version": "jq --arg new_version \"-$(git rev-parse --short HEAD)$1\" '.version = .version + $new_version' package.json > package-tmp.json && mv package-tmp.json package.json", | ||
"clean": "chmod u+w web nodejs || true && rm -rf web nodejs", | ||
"build:nix": "nix build -L .#acvm_js", | ||
"install:from:nix": "yarn clean && yarn build:nix && cp -rL ./result/acvm_js/nodejs ./ && cp -rL ./result/acvm_js/web ./" | ||
"clean": "chmod u+w web nodejs || true && rm -rf web nodejs" | ||
}, | ||
@@ -42,0 +40,0 @@ "devDependencies": { |
/* tslint:disable */ | ||
/* eslint-disable */ | ||
export const memory: WebAssembly.Memory; | ||
export function compressWitness(a: number, b: number): void; | ||
export function decompressWitness(a: number, b: number, c: number): void; | ||
export function compressWitnessStack(a: number, b: number): void; | ||
export function decompressWitnessStack(a: number, b: number, c: number): void; | ||
export function __wbg_wasmblackboxfunctionsolver_free(a: number): void; | ||
export function createBlackBoxSolver(): number; | ||
export function executeCircuit(a: number, b: number, c: number, d: number): number; | ||
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number, e: number): number; | ||
export function executeCircuitWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number; | ||
export function executeProgram(a: number, b: number, c: number, d: number): number; | ||
export function executeProgramWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number; | ||
export function 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 blake2s256(a: number, b: number, c: number): void; | ||
export function keccak256(a: number, b: number, c: number): void; | ||
export function ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: 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 ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number; | ||
export function keccak256(a: number, b: number, c: number): void; | ||
export function blake2s256(a: number, b: number, c: number): void; | ||
export function sha256(a: number, b: number, c: number): void; | ||
export function xor(a: number, b: number): number; | ||
export function and(a: number, b: number): number; | ||
export function executeCircuitWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number; | ||
export function executeCircuit(a: number, b: number, c: number, d: number): number; | ||
export function createBlackBoxSolver(): number; | ||
export function __wbg_wasmblackboxfunctionsolver_free(a: number): void; | ||
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 getPublicParametersWitness(a: number, b: number, c: number, d: number): void; | ||
export function getReturnWitness(a: number, b: number, c: number, d: number): void; | ||
export function initLogLevel(a: number, b: number, c: number): void; | ||
export function decompressWitness(a: number, b: number, c: number): void; | ||
export function compressWitness(a: number, b: number): void; | ||
export function buildInfo(): number; | ||
@@ -31,2 +36,3 @@ export function __wbg_trap_free(a: number): void; | ||
export function __wbindgen_exn_store(a: number): void; | ||
export function wasm_bindgen__convert__closures__invoke3_mut__h28a07b2d2a2056af(a: number, b: number, c: number, d: number, e: number): void; | ||
export function wasm_bindgen__convert__closures__invoke2_mut__h79f8a29187e94f15(a: number, b: number, c: number, d: number): void; |
/* tslint:disable */ | ||
/* eslint-disable */ | ||
/** | ||
* Verifies a ECDSA signature over the secp256r1 curve. | ||
* @param {Uint8Array} hashed_msg | ||
* @param {Uint8Array} public_key_x_bytes | ||
* @param {Uint8Array} public_key_y_bytes | ||
* @param {Uint8Array} signature | ||
* @returns {boolean} | ||
* Compresses a `WitnessMap` into the binary format outputted by Nargo. | ||
* | ||
* @param {WitnessMap} witness_map - A witness map. | ||
* @returns {Uint8Array} A compressed witness map | ||
*/ | ||
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean; | ||
export function compressWitness(witness_map: WitnessMap): Uint8Array; | ||
/** | ||
* Verifies a ECDSA signature over the secp256k1 curve. | ||
* @param {Uint8Array} hashed_msg | ||
* @param {Uint8Array} public_key_x_bytes | ||
* @param {Uint8Array} public_key_y_bytes | ||
* @param {Uint8Array} signature | ||
* @returns {boolean} | ||
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`. | ||
* This should be used to only fetch the witness map for the main function. | ||
* | ||
* @param {Uint8Array} compressed_witness - A compressed witness. | ||
* @returns {WitnessMap} The decompressed witness map. | ||
*/ | ||
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean; | ||
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap; | ||
/** | ||
* Calculates the Keccak256 hash of the input bytes | ||
* @param {Uint8Array} inputs | ||
* @returns {Uint8Array} | ||
* Compresses a `WitnessStack` into the binary format outputted by Nargo. | ||
* | ||
* @param {WitnessStack} witness_stack - A witness stack. | ||
* @returns {Uint8Array} A compressed witness stack | ||
*/ | ||
export function keccak256(inputs: Uint8Array): Uint8Array; | ||
export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array; | ||
/** | ||
* Calculates the Blake2s256 hash of the input bytes | ||
* @param {Uint8Array} inputs | ||
* @returns {Uint8Array} | ||
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`. | ||
* | ||
* @param {Uint8Array} compressed_witness - A compressed witness. | ||
* @returns {WitnessStack} The decompressed witness stack. | ||
*/ | ||
export function blake2s256(inputs: Uint8Array): Uint8Array; | ||
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack; | ||
/** | ||
* Calculates the SHA256 hash of the input bytes | ||
* @param {Uint8Array} inputs | ||
* @returns {Uint8Array} | ||
* @returns {Promise<WasmBlackBoxFunctionSolver>} | ||
*/ | ||
export function sha256(inputs: Uint8Array): Uint8Array; | ||
export function createBlackBoxSolver(): Promise<WasmBlackBoxFunctionSolver>; | ||
/** | ||
* Performs a bitwise XOR operation between `lhs` and `rhs` | ||
* @param {string} lhs | ||
* @param {string} rhs | ||
* @returns {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 xor(lhs: string, rhs: string): string; | ||
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>; | ||
/** | ||
* Performs a bitwise AND operation between `lhs` and `rhs` | ||
* @param {string} lhs | ||
* @param {string} rhs | ||
* @returns {string} | ||
*/ | ||
export function and(lhs: string, rhs: string): string; | ||
/** | ||
* 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. | ||
* | ||
@@ -60,8 +53,9 @@ * @param {&WasmBlackBoxFunctionSolver} solver - A black box solver. | ||
* @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. | ||
* @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 executeCircuitWithBlackBoxSolver(solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>; | ||
export function executeCircuitWithReturnWitness(solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>; | ||
/** | ||
* Executes an ACIR circuit to generate the solved witness from the initial witness. | ||
* | ||
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver. | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
@@ -72,18 +66,76 @@ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`.. | ||
*/ | ||
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>; | ||
export function executeCircuitWithBlackBoxSolver(solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>; | ||
/** | ||
* @returns {Promise<WasmBlackBoxFunctionSolver>} | ||
*/ | ||
export function createBlackBoxSolver(): Promise<WasmBlackBoxFunctionSolver>; | ||
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>; | ||
/** | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs. | ||
*/ | ||
export function executeProgramWithBlackBoxSolver(solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_executor: ForeignCallHandler): Promise<WitnessStack>; | ||
/** | ||
* Performs a bitwise AND operation between `lhs` and `rhs` | ||
* @param {string} lhs | ||
* @param {string} rhs | ||
* @returns {string} | ||
*/ | ||
export function and(lhs: string, rhs: string): string; | ||
/** | ||
* Performs a bitwise XOR operation between `lhs` and `rhs` | ||
* @param {string} lhs | ||
* @param {string} rhs | ||
* @returns {string} | ||
*/ | ||
export function xor(lhs: string, rhs: string): string; | ||
/** | ||
* Calculates the SHA256 hash of the input bytes | ||
* @param {Uint8Array} inputs | ||
* @returns {Uint8Array} | ||
*/ | ||
export function sha256(inputs: Uint8Array): Uint8Array; | ||
/** | ||
* Calculates the Blake2s256 hash of the input bytes | ||
* @param {Uint8Array} inputs | ||
* @returns {Uint8Array} | ||
*/ | ||
export function blake2s256(inputs: Uint8Array): Uint8Array; | ||
/** | ||
* Calculates the Keccak256 hash of the input bytes | ||
* @param {Uint8Array} inputs | ||
* @returns {Uint8Array} | ||
*/ | ||
export function keccak256(inputs: Uint8Array): Uint8Array; | ||
/** | ||
* Verifies a ECDSA signature over the secp256k1 curve. | ||
* @param {Uint8Array} hashed_msg | ||
* @param {Uint8Array} public_key_x_bytes | ||
* @param {Uint8Array} public_key_y_bytes | ||
* @param {Uint8Array} signature | ||
* @returns {boolean} | ||
*/ | ||
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean; | ||
/** | ||
* Verifies a ECDSA signature over the secp256r1 curve. | ||
* @param {Uint8Array} hashed_msg | ||
* @param {Uint8Array} public_key_x_bytes | ||
* @param {Uint8Array} public_key_y_bytes | ||
* @param {Uint8Array} signature | ||
* @returns {boolean} | ||
*/ | ||
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean; | ||
/** | ||
* 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 public inputs. | ||
* @returns {WitnessMap} A witness map containing the circuit's return values. | ||
* @param {Uint8Array} program | ||
* @param {WitnessMap} solved_witness | ||
* @param {WitnessMap} witness_map | ||
* @returns {WitnessMap} | ||
*/ | ||
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap; | ||
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap; | ||
/** | ||
@@ -101,33 +153,13 @@ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters. | ||
/** | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values. | ||
* 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 return values. | ||
* @returns {WitnessMap} A witness map containing the circuit's public inputs. | ||
* @param {Uint8Array} program | ||
* @param {WitnessMap} witness_map | ||
* @param {WitnessMap} solved_witness | ||
* @returns {WitnessMap} | ||
*/ | ||
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap; | ||
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap; | ||
/** | ||
* Sets the package's logging level. | ||
* | ||
* @param {LogLevel} level - The maximum level of logging to be emitted. | ||
*/ | ||
export function initLogLevel(filter: string): void; | ||
/** | ||
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`. | ||
* | ||
* @param {Uint8Array} compressed_witness - A compressed witness. | ||
* @returns {WitnessMap} The decompressed witness map. | ||
*/ | ||
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap; | ||
/** | ||
* Compresses a `WitnessMap` into the binary format outputted by Nargo. | ||
* | ||
* @param {Uint8Array} compressed_witness - A witness map. | ||
* @returns {WitnessMap} A compressed witness map | ||
*/ | ||
export function compressWitness(witness_map: WitnessMap): Uint8Array; | ||
/** | ||
* Returns the `BuildInfo` object containing information about how the installed package was built. | ||
@@ -138,13 +170,2 @@ * @returns {BuildInfo} - Information on how the installed package was built. | ||
export type ExecutionError = Error & { | ||
callStack?: string[]; | ||
}; | ||
// Map from witness index to hex string value of witness. | ||
export type WitnessMap = Map<number, string>; | ||
export type ForeignCallInput = string[] | ||
@@ -164,3 +185,24 @@ export type ForeignCallOutput = string | string[] | ||
export type ExecutionError = Error & { | ||
callStack?: 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 | ||
@@ -178,2 +220,11 @@ * @property {string} gitHash - The hash of the git commit from which the package was built. | ||
export type StackItem = { | ||
index: number; | ||
witness: WitnessMap; | ||
} | ||
export type WitnessStack = Array<StackItem>; | ||
/** | ||
@@ -189,19 +240,24 @@ */ | ||
readonly memory: WebAssembly.Memory; | ||
readonly compressWitness: (a: number, b: number) => void; | ||
readonly decompressWitness: (a: number, b: number, c: number) => void; | ||
readonly compressWitnessStack: (a: number, b: number) => void; | ||
readonly decompressWitnessStack: (a: number, b: number, c: number) => void; | ||
readonly __wbg_wasmblackboxfunctionsolver_free: (a: number) => void; | ||
readonly createBlackBoxSolver: () => number; | ||
readonly executeCircuit: (a: number, b: number, c: number, d: number) => number; | ||
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: number, d: number, e: number) => number; | ||
readonly executeCircuitWithBlackBoxSolver: (a: number, b: number, c: number, d: number, e: number) => number; | ||
readonly executeProgram: (a: number, b: number, c: number, d: number) => number; | ||
readonly executeProgramWithBlackBoxSolver: (a: number, b: number, c: number, d: number, e: number) => number; | ||
readonly and: (a: number, b: number) => number; | ||
readonly xor: (a: number, b: number) => number; | ||
readonly sha256: (a: number, b: number, c: number) => void; | ||
readonly blake2s256: (a: number, b: number, c: number) => void; | ||
readonly keccak256: (a: number, b: number, c: number) => void; | ||
readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number; | ||
readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number; | ||
readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number; | ||
readonly keccak256: (a: number, b: number, c: number) => void; | ||
readonly blake2s256: (a: number, b: number, c: number) => void; | ||
readonly sha256: (a: number, b: number, c: number) => void; | ||
readonly xor: (a: number, b: number) => number; | ||
readonly and: (a: number, b: number) => number; | ||
readonly executeCircuitWithBlackBoxSolver: (a: number, b: number, c: number, d: number, e: number) => number; | ||
readonly executeCircuit: (a: number, b: number, c: number, d: number) => number; | ||
readonly createBlackBoxSolver: () => number; | ||
readonly __wbg_wasmblackboxfunctionsolver_free: (a: number) => void; | ||
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 getPublicParametersWitness: (a: number, b: number, c: number, d: number) => void; | ||
readonly getReturnWitness: (a: number, b: number, c: number, d: number) => void; | ||
readonly initLogLevel: (a: number, b: number, c: number) => void; | ||
readonly decompressWitness: (a: number, b: number, c: number) => void; | ||
readonly compressWitness: (a: number, b: number) => void; | ||
readonly buildInfo: () => number; | ||
@@ -217,2 +273,3 @@ readonly __wbg_trap_free: (a: number) => void; | ||
readonly __wbindgen_exn_store: (a: number) => void; | ||
readonly wasm_bindgen__convert__closures__invoke3_mut__h28a07b2d2a2056af: (a: number, b: number, c: number, d: number, e: number) => void; | ||
readonly wasm_bindgen__convert__closures__invoke2_mut__h79f8a29187e94f15: (a: number, b: number, c: number, d: number) => void; | ||
@@ -219,0 +276,0 @@ } |
@@ -23,13 +23,28 @@ let wasm; | ||
function addHeapObject(obj) { | ||
if (heap_next === heap.length) heap.push(heap.length + 1); | ||
const idx = heap_next; | ||
heap_next = heap[idx]; | ||
function isLikeNone(x) { | ||
return x === undefined || x === null; | ||
} | ||
heap[idx] = obj; | ||
return idx; | ||
let cachedFloat64Memory0 = null; | ||
function getFloat64Memory0() { | ||
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) { | ||
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer); | ||
} | ||
return cachedFloat64Memory0; | ||
} | ||
let WASM_VECTOR_LEN = 0; | ||
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') } } ); | ||
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; | ||
let cachedUint8Memory0 = null; | ||
@@ -44,2 +59,18 @@ | ||
function getStringFromWasm0(ptr, len) { | ||
ptr = ptr >>> 0; | ||
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); | ||
} | ||
function addHeapObject(obj) { | ||
if (heap_next === heap.length) heap.push(heap.length + 1); | ||
const idx = heap_next; | ||
heap_next = heap[idx]; | ||
heap[idx] = obj; | ||
return idx; | ||
} | ||
let WASM_VECTOR_LEN = 0; | ||
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } ); | ||
@@ -98,33 +129,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; | ||
} | ||
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); | ||
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; | ||
function getStringFromWasm0(ptr, len) { | ||
ptr = ptr >>> 0; | ||
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); | ||
} | ||
let cachedFloat64Memory0 = null; | ||
function getFloat64Memory0() { | ||
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) { | ||
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer); | ||
} | ||
return cachedFloat64Memory0; | ||
} | ||
let cachedBigInt64Memory0 = null; | ||
@@ -232,2 +232,31 @@ | ||
function getArrayU8FromWasm0(ptr, len) { | ||
ptr = ptr >>> 0; | ||
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len); | ||
} | ||
/** | ||
* Compresses a `WitnessMap` into the binary format outputted by Nargo. | ||
* | ||
* @param {WitnessMap} witness_map - A witness map. | ||
* @returns {Uint8Array} A compressed witness map | ||
*/ | ||
export function compressWitness(witness_map) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
wasm.compressWitness(retptr, addHeapObject(witness_map)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
var r3 = getInt32Memory0()[retptr / 4 + 3]; | ||
if (r3) { | ||
throw takeObject(r2); | ||
} | ||
var v1 = getArrayU8FromWasm0(r0, r1).slice(); | ||
wasm.__wbindgen_free(r0, r1 * 1); | ||
return v1; | ||
} finally { | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
} | ||
} | ||
function passArray8ToWasm0(arg, malloc) { | ||
@@ -240,63 +269,21 @@ const ptr = malloc(arg.length * 1) >>> 0; | ||
/** | ||
* Verifies a ECDSA signature over the secp256r1 curve. | ||
* @param {Uint8Array} hashed_msg | ||
* @param {Uint8Array} public_key_x_bytes | ||
* @param {Uint8Array} public_key_y_bytes | ||
* @param {Uint8Array} signature | ||
* @returns {boolean} | ||
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`. | ||
* This should be used to only fetch the witness map for the main function. | ||
* | ||
* @param {Uint8Array} compressed_witness - A compressed witness. | ||
* @returns {WitnessMap} The decompressed witness map. | ||
*/ | ||
export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) { | ||
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc); | ||
const len1 = WASM_VECTOR_LEN; | ||
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc); | ||
const len2 = WASM_VECTOR_LEN; | ||
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc); | ||
const len3 = WASM_VECTOR_LEN; | ||
const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3); | ||
return ret !== 0; | ||
} | ||
/** | ||
* Verifies a ECDSA signature over the secp256k1 curve. | ||
* @param {Uint8Array} hashed_msg | ||
* @param {Uint8Array} public_key_x_bytes | ||
* @param {Uint8Array} public_key_y_bytes | ||
* @param {Uint8Array} signature | ||
* @returns {boolean} | ||
*/ | ||
export function ecdsa_secp256k1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) { | ||
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc); | ||
const len1 = WASM_VECTOR_LEN; | ||
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc); | ||
const len2 = WASM_VECTOR_LEN; | ||
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc); | ||
const len3 = WASM_VECTOR_LEN; | ||
const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3); | ||
return ret !== 0; | ||
} | ||
function getArrayU8FromWasm0(ptr, len) { | ||
ptr = ptr >>> 0; | ||
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len); | ||
} | ||
/** | ||
* Calculates the Keccak256 hash of the input bytes | ||
* @param {Uint8Array} inputs | ||
* @returns {Uint8Array} | ||
*/ | ||
export function keccak256(inputs) { | ||
export function decompressWitness(compressed_witness) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc); | ||
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.keccak256(retptr, ptr0, len0); | ||
wasm.decompressWitness(retptr, ptr0, len0); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var v2 = getArrayU8FromWasm0(r0, r1).slice(); | ||
wasm.__wbindgen_free(r0, r1 * 1); | ||
return v2; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
if (r2) { | ||
throw takeObject(r1); | ||
} | ||
return takeObject(r0); | ||
} finally { | ||
@@ -308,17 +295,21 @@ wasm.__wbindgen_add_to_stack_pointer(16); | ||
/** | ||
* Calculates the Blake2s256 hash of the input bytes | ||
* @param {Uint8Array} inputs | ||
* @returns {Uint8Array} | ||
* Compresses a `WitnessStack` into the binary format outputted by Nargo. | ||
* | ||
* @param {WitnessStack} witness_stack - A witness stack. | ||
* @returns {Uint8Array} A compressed witness stack | ||
*/ | ||
export function blake2s256(inputs) { | ||
export function compressWitnessStack(witness_stack) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.blake2s256(retptr, ptr0, len0); | ||
wasm.compressWitnessStack(retptr, addHeapObject(witness_stack)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var v2 = getArrayU8FromWasm0(r0, r1).slice(); | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
var r3 = getInt32Memory0()[retptr / 4 + 3]; | ||
if (r3) { | ||
throw takeObject(r2); | ||
} | ||
var v1 = getArrayU8FromWasm0(r0, r1).slice(); | ||
wasm.__wbindgen_free(r0, r1 * 1); | ||
return v2; | ||
return v1; | ||
} finally { | ||
@@ -330,17 +321,20 @@ wasm.__wbindgen_add_to_stack_pointer(16); | ||
/** | ||
* Calculates the SHA256 hash of the input bytes | ||
* @param {Uint8Array} inputs | ||
* @returns {Uint8Array} | ||
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`. | ||
* | ||
* @param {Uint8Array} compressed_witness - A compressed witness. | ||
* @returns {WitnessStack} The decompressed witness stack. | ||
*/ | ||
export function sha256(inputs) { | ||
export function decompressWitnessStack(compressed_witness) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc); | ||
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.sha256(retptr, ptr0, len0); | ||
wasm.decompressWitnessStack(retptr, ptr0, len0); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var v2 = getArrayU8FromWasm0(r0, r1).slice(); | ||
wasm.__wbindgen_free(r0, r1 * 1); | ||
return v2; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
if (r2) { | ||
throw takeObject(r1); | ||
} | ||
return takeObject(r0); | ||
} finally { | ||
@@ -352,9 +346,6 @@ wasm.__wbindgen_add_to_stack_pointer(16); | ||
/** | ||
* Performs a bitwise XOR operation between `lhs` and `rhs` | ||
* @param {string} lhs | ||
* @param {string} rhs | ||
* @returns {string} | ||
* @returns {Promise<WasmBlackBoxFunctionSolver>} | ||
*/ | ||
export function xor(lhs, rhs) { | ||
const ret = wasm.xor(addHeapObject(lhs), addHeapObject(rhs)); | ||
export function createBlackBoxSolver() { | ||
const ret = wasm.createBlackBoxSolver(); | ||
return takeObject(ret); | ||
@@ -364,9 +355,13 @@ } | ||
/** | ||
* Performs a bitwise AND operation between `lhs` and `rhs` | ||
* @param {string} lhs | ||
* @param {string} rhs | ||
* @returns {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 and(lhs, rhs) { | ||
const ret = wasm.and(addHeapObject(lhs), addHeapObject(rhs)); | ||
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); | ||
@@ -383,2 +378,3 @@ } | ||
* 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. | ||
* | ||
@@ -389,9 +385,9 @@ * @param {&WasmBlackBoxFunctionSolver} solver - A black box solver. | ||
* @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. | ||
* @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 executeCircuitWithBlackBoxSolver(solver, program, initial_witness, foreign_call_handler) { | ||
export function executeCircuitWithReturnWitness(solver, program, initial_witness, foreign_call_handler) { | ||
_assertClass(solver, WasmBlackBoxFunctionSolver); | ||
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
const ret = wasm.executeCircuitWithBlackBoxSolver(solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler)); | ||
const ret = wasm.executeCircuitWithReturnWitness(solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler)); | ||
return takeObject(ret); | ||
@@ -403,2 +399,3 @@ } | ||
* | ||
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver. | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
@@ -409,6 +406,7 @@ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`.. | ||
*/ | ||
export function executeCircuit(program, initial_witness, foreign_call_handler) { | ||
export function executeCircuitWithBlackBoxSolver(solver, program, initial_witness, foreign_call_handler) { | ||
_assertClass(solver, WasmBlackBoxFunctionSolver); | ||
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler)); | ||
const ret = wasm.executeCircuitWithBlackBoxSolver(solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler)); | ||
return takeObject(ret); | ||
@@ -418,6 +416,7 @@ } | ||
/** | ||
* @returns {Promise<WasmBlackBoxFunctionSolver>} | ||
*/ | ||
export function createBlackBoxSolver() { | ||
const ret = wasm.createBlackBoxSolver(); | ||
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); | ||
@@ -427,24 +426,49 @@ } | ||
/** | ||
* 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) { | ||
export function executeProgramWithBlackBoxSolver(solver, program, initial_witness, foreign_call_executor) { | ||
_assertClass(solver, WasmBlackBoxFunctionSolver); | ||
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
const ret = wasm.executeProgramWithBlackBoxSolver(solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_executor)); | ||
return takeObject(ret); | ||
} | ||
/** | ||
* Performs a bitwise AND operation between `lhs` and `rhs` | ||
* @param {string} lhs | ||
* @param {string} rhs | ||
* @returns {string} | ||
*/ | ||
export function and(lhs, rhs) { | ||
const ret = wasm.and(addHeapObject(lhs), addHeapObject(rhs)); | ||
return takeObject(ret); | ||
} | ||
/** | ||
* Performs a bitwise XOR operation between `lhs` and `rhs` | ||
* @param {string} lhs | ||
* @param {string} rhs | ||
* @returns {string} | ||
*/ | ||
export function xor(lhs, rhs) { | ||
const ret = wasm.xor(addHeapObject(lhs), addHeapObject(rhs)); | ||
return takeObject(ret); | ||
} | ||
/** | ||
* Calculates the SHA256 hash of the input bytes | ||
* @param {Uint8Array} inputs | ||
* @returns {Uint8Array} | ||
*/ | ||
export function sha256(inputs) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc); | ||
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness)); | ||
wasm.sha256(retptr, ptr0, len0); | ||
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); | ||
var v2 = getArrayU8FromWasm0(r0, r1).slice(); | ||
wasm.__wbindgen_free(r0, r1 * 1); | ||
return v2; | ||
} finally { | ||
@@ -456,24 +480,17 @@ 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} | ||
* Calculates the Blake2s256 hash of the input bytes | ||
* @param {Uint8Array} inputs | ||
* @returns {Uint8Array} | ||
*/ | ||
export function getPublicParametersWitness(program, solved_witness) { | ||
export function blake2s256(inputs) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc); | ||
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness)); | ||
wasm.blake2s256(retptr, ptr0, len0); | ||
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); | ||
var v2 = getArrayU8FromWasm0(r0, r1).slice(); | ||
wasm.__wbindgen_free(r0, r1 * 1); | ||
return v2; | ||
} finally { | ||
@@ -485,24 +502,17 @@ 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} | ||
* Calculates the Keccak256 hash of the input bytes | ||
* @param {Uint8Array} inputs | ||
* @returns {Uint8Array} | ||
*/ | ||
export function getReturnWitness(program, witness_map) { | ||
export function keccak256(inputs) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc); | ||
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map)); | ||
wasm.keccak256(retptr, ptr0, len0); | ||
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); | ||
var v2 = getArrayU8FromWasm0(r0, r1).slice(); | ||
wasm.__wbindgen_free(r0, r1 * 1); | ||
return v2; | ||
} finally { | ||
@@ -514,2 +524,44 @@ wasm.__wbindgen_add_to_stack_pointer(16); | ||
/** | ||
* Verifies a ECDSA signature over the secp256k1 curve. | ||
* @param {Uint8Array} hashed_msg | ||
* @param {Uint8Array} public_key_x_bytes | ||
* @param {Uint8Array} public_key_y_bytes | ||
* @param {Uint8Array} signature | ||
* @returns {boolean} | ||
*/ | ||
export function ecdsa_secp256k1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) { | ||
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc); | ||
const len1 = WASM_VECTOR_LEN; | ||
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc); | ||
const len2 = WASM_VECTOR_LEN; | ||
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc); | ||
const len3 = WASM_VECTOR_LEN; | ||
const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3); | ||
return ret !== 0; | ||
} | ||
/** | ||
* Verifies a ECDSA signature over the secp256r1 curve. | ||
* @param {Uint8Array} hashed_msg | ||
* @param {Uint8Array} public_key_x_bytes | ||
* @param {Uint8Array} public_key_y_bytes | ||
* @param {Uint8Array} signature | ||
* @returns {boolean} | ||
*/ | ||
export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) { | ||
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc); | ||
const len1 = WASM_VECTOR_LEN; | ||
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc); | ||
const len2 = WASM_VECTOR_LEN; | ||
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc); | ||
const len3 = WASM_VECTOR_LEN; | ||
const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3); | ||
return ret !== 0; | ||
} | ||
/** | ||
* Sets the package's logging level. | ||
@@ -536,13 +588,17 @@ * | ||
/** | ||
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`. | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values. | ||
* | ||
* @param {Uint8Array} compressed_witness - A compressed witness. | ||
* @returns {WitnessMap} The decompressed witness map. | ||
* @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 decompressWitness(compressed_witness) { | ||
export function getReturnWitness(program, witness_map) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc); | ||
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.decompressWitness(retptr, ptr0, len0); | ||
wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
@@ -561,21 +617,24 @@ var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
/** | ||
* Compresses a `WitnessMap` into the binary format outputted by Nargo. | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters. | ||
* | ||
* @param {Uint8Array} compressed_witness - A witness map. | ||
* @returns {WitnessMap} A compressed witness map | ||
* @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 compressWitness(witness_map) { | ||
export function getPublicParametersWitness(program, solved_witness) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
wasm.compressWitness(retptr, addHeapObject(witness_map)); | ||
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]; | ||
var r3 = getInt32Memory0()[retptr / 4 + 3]; | ||
if (r3) { | ||
throw takeObject(r2); | ||
if (r2) { | ||
throw takeObject(r1); | ||
} | ||
var v1 = getArrayU8FromWasm0(r0, r1).slice(); | ||
wasm.__wbindgen_free(r0, r1 * 1); | ||
return v1; | ||
return takeObject(r0); | ||
} finally { | ||
@@ -587,2 +646,30 @@ 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. | ||
@@ -603,3 +690,7 @@ * @returns {BuildInfo} - Information on how the installed package was built. | ||
} | ||
function __wbg_adapter_159(arg0, arg1, arg2, arg3) { | ||
function __wbg_adapter_134(arg0, arg1, arg2, arg3, arg4) { | ||
wasm.wasm_bindgen__convert__closures__invoke3_mut__h28a07b2d2a2056af(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4)); | ||
} | ||
function __wbg_adapter_171(arg0, arg1, arg2, arg3) { | ||
wasm.wasm_bindgen__convert__closures__invoke2_mut__h79f8a29187e94f15(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3)); | ||
@@ -694,2 +785,33 @@ } | ||
}; | ||
imports.wbg.__wbg_wasmblackboxfunctionsolver_new = function(arg0) { | ||
const ret = WasmBlackBoxFunctionSolver.__wrap(arg0); | ||
return addHeapObject(ret); | ||
}; | ||
imports.wbg.__wbindgen_is_array = function(arg0) { | ||
const ret = Array.isArray(getObject(arg0)); | ||
return ret; | ||
}; | ||
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) { | ||
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_string_new = function(arg0, arg1) { | ||
const ret = getStringFromWasm0(arg0, arg1); | ||
return addHeapObject(ret); | ||
}; | ||
imports.wbg.__wbindgen_is_undefined = function(arg0) { | ||
const ret = getObject(arg0) === undefined; | ||
return ret; | ||
}; | ||
imports.wbg.__wbindgen_object_clone_ref = function(arg0) { | ||
@@ -699,3 +821,7 @@ const ret = getObject(arg0); | ||
}; | ||
imports.wbg.__wbg_new_0d2c031c3755a625 = function() { | ||
imports.wbg.__wbg_constructor_885d22c82fec0fdb = function(arg0) { | ||
const ret = new Error(takeObject(arg0)); | ||
return addHeapObject(ret); | ||
}; | ||
imports.wbg.__wbg_new_e1076c3a38c86fee = function() { | ||
const ret = new Map(); | ||
@@ -716,14 +842,2 @@ return addHeapObject(ret); | ||
}; | ||
imports.wbg.__wbg_constructor_9a4af6ecd5050c55 = function(arg0) { | ||
const ret = new Error(takeObject(arg0)); | ||
return addHeapObject(ret); | ||
}; | ||
imports.wbg.__wbindgen_string_new = function(arg0, arg1) { | ||
const ret = getStringFromWasm0(arg0, arg1); | ||
return addHeapObject(ret); | ||
}; | ||
imports.wbg.__wbg_wasmblackboxfunctionsolver_new = function(arg0) { | ||
const ret = WasmBlackBoxFunctionSolver.__wrap(arg0); | ||
return addHeapObject(ret); | ||
}; | ||
imports.wbg.__wbindgen_error_new = function(arg0, arg1) { | ||
@@ -733,12 +847,2 @@ const ret = new Error(getStringFromWasm0(arg0, arg1)); | ||
}; | ||
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_undefined = function(arg0) { | ||
const ret = getObject(arg0) === undefined; | ||
return ret; | ||
}; | ||
imports.wbg.__wbindgen_is_string = function(arg0) { | ||
@@ -748,15 +852,6 @@ const ret = typeof(getObject(arg0)) === 'string'; | ||
}; | ||
imports.wbg.__wbindgen_is_array = function(arg0) { | ||
const ret = Array.isArray(getObject(arg0)); | ||
return ret; | ||
imports.wbg.__wbg_new_967d701c7af7cc58 = function() { | ||
const ret = new Array(); | ||
return addHeapObject(ret); | ||
}; | ||
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_abda76e883ba8a5f = function() { | ||
@@ -784,2 +879,10 @@ const ret = new Error(); | ||
}; | ||
imports.wbg.__wbindgen_bigint_from_i64 = function(arg0) { | ||
const ret = arg0; | ||
return addHeapObject(ret); | ||
}; | ||
imports.wbg.__wbindgen_bigint_from_u128 = function(arg0, arg1) { | ||
const ret = BigInt.asUintN(64, arg0) << BigInt(64) | BigInt.asUintN(64, arg1); | ||
return addHeapObject(ret); | ||
}; | ||
imports.wbg.__wbindgen_ge = function(arg0, arg1) { | ||
@@ -805,10 +908,2 @@ const ret = getObject(arg0) >= getObject(arg1); | ||
}; | ||
imports.wbg.__wbindgen_bigint_from_i64 = function(arg0) { | ||
const ret = arg0; | ||
return addHeapObject(ret); | ||
}; | ||
imports.wbg.__wbindgen_bigint_from_u128 = function(arg0, arg1) { | ||
const ret = BigInt.asUintN(64, arg0) << BigInt(64) | BigInt.asUintN(64, arg1); | ||
return addHeapObject(ret); | ||
}; | ||
imports.wbg.__wbindgen_is_object = function(arg0) { | ||
@@ -833,2 +928,26 @@ const val = getObject(arg0); | ||
}; | ||
imports.wbg.__wbg_debug_e3f6a1578e6d45ca = function(arg0) { | ||
console.debug(getObject(arg0)); | ||
}; | ||
imports.wbg.__wbg_debug_efabe4eb183aa5d4 = function(arg0, arg1, arg2, arg3) { | ||
console.debug(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3)); | ||
}; | ||
imports.wbg.__wbg_error_a7e23606158b68b9 = function(arg0) { | ||
console.error(getObject(arg0)); | ||
}; | ||
imports.wbg.__wbg_error_50f42b952a595a23 = function(arg0, arg1, arg2, arg3) { | ||
console.error(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3)); | ||
}; | ||
imports.wbg.__wbg_info_05db236d79f1b785 = function(arg0) { | ||
console.info(getObject(arg0)); | ||
}; | ||
imports.wbg.__wbg_info_24d8f53d98f12b95 = function(arg0, arg1, arg2, arg3) { | ||
console.info(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3)); | ||
}; | ||
imports.wbg.__wbg_warn_9bdd743e9f5fe1e0 = function(arg0) { | ||
console.warn(getObject(arg0)); | ||
}; | ||
imports.wbg.__wbg_warn_8342bfbc6028193a = function(arg0, arg1, arg2, arg3) { | ||
console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3)); | ||
}; | ||
imports.wbg.__wbg_crypto_c48a774b022d20ac = function(arg0) { | ||
@@ -864,26 +983,2 @@ const ret = getObject(arg0).crypto; | ||
}, arguments) }; | ||
imports.wbg.__wbg_debug_e3f6a1578e6d45ca = function(arg0) { | ||
console.debug(getObject(arg0)); | ||
}; | ||
imports.wbg.__wbg_debug_efabe4eb183aa5d4 = function(arg0, arg1, arg2, arg3) { | ||
console.debug(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3)); | ||
}; | ||
imports.wbg.__wbg_error_a7e23606158b68b9 = function(arg0) { | ||
console.error(getObject(arg0)); | ||
}; | ||
imports.wbg.__wbg_error_50f42b952a595a23 = function(arg0, arg1, arg2, arg3) { | ||
console.error(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3)); | ||
}; | ||
imports.wbg.__wbg_info_05db236d79f1b785 = function(arg0) { | ||
console.info(getObject(arg0)); | ||
}; | ||
imports.wbg.__wbg_info_24d8f53d98f12b95 = function(arg0, arg1, arg2, arg3) { | ||
console.info(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3)); | ||
}; | ||
imports.wbg.__wbg_warn_9bdd743e9f5fe1e0 = function(arg0) { | ||
console.warn(getObject(arg0)); | ||
}; | ||
imports.wbg.__wbg_warn_8342bfbc6028193a = function(arg0, arg1, arg2, arg3) { | ||
console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3)); | ||
}; | ||
imports.wbg.__wbg_get_7303ed2ef026b2f5 = function(arg0, arg1) { | ||
@@ -909,2 +1004,6 @@ const ret = getObject(arg0)[arg1 >>> 0]; | ||
}; | ||
imports.wbg.__wbg_new_0f2b71ca2f2a6029 = function() { | ||
const ret = new Map(); | ||
return addHeapObject(ret); | ||
}; | ||
imports.wbg.__wbg_get_f53c921291c381bd = function() { return handleError(function (arg0, arg1) { | ||
@@ -949,2 +1048,19 @@ const ret = Reflect.get(getObject(arg0), getObject(arg1)); | ||
}; | ||
imports.wbg.__wbg_forEach_5ae261259d7517c8 = function(arg0, arg1, arg2) { | ||
try { | ||
var state0 = {a: arg1, b: arg2}; | ||
var cb0 = (arg0, arg1, arg2) => { | ||
const a = state0.a; | ||
state0.a = 0; | ||
try { | ||
return __wbg_adapter_134(a, state0.b, arg0, arg1, arg2); | ||
} finally { | ||
state0.a = a; | ||
} | ||
}; | ||
getObject(arg0).forEach(cb0); | ||
} finally { | ||
state0.a = state0.b = 0; | ||
} | ||
}; | ||
imports.wbg.__wbg_push_109cfc26d02582dd = function(arg0, arg1) { | ||
@@ -954,2 +1070,6 @@ const ret = getObject(arg0).push(getObject(arg1)); | ||
}; | ||
imports.wbg.__wbg_reverse_a322332d916e2705 = function(arg0) { | ||
const ret = getObject(arg0).reverse(); | ||
return addHeapObject(ret); | ||
}; | ||
imports.wbg.__wbg_byteLength_1a59a59856fc656a = function(arg0) { | ||
@@ -1020,3 +1140,3 @@ const ret = getObject(arg0).byteLength; | ||
try { | ||
return __wbg_adapter_159(a, state0.b, arg0, arg1); | ||
return __wbg_adapter_171(a, state0.b, arg0, arg1); | ||
} finally { | ||
@@ -1049,2 +1169,6 @@ state0.a = a; | ||
}; | ||
imports.wbg.__wbg_fromEntries_d1b310956d20d858 = function() { return handleError(function (arg0) { | ||
const ret = Object.fromEntries(getObject(arg0)); | ||
return addHeapObject(ret); | ||
}, arguments) }; | ||
imports.wbg.__wbg_toString_e2b23ac99490a381 = function(arg0) { | ||
@@ -1054,2 +1178,6 @@ const ret = getObject(arg0).toString(); | ||
}; | ||
imports.wbg.__wbg_values_099fd000c271c313 = function(arg0) { | ||
const ret = Object.values(getObject(arg0)); | ||
return addHeapObject(ret); | ||
}; | ||
imports.wbg.__wbg_new_2b55e405e4af4986 = function(arg0, arg1) { | ||
@@ -1062,3 +1190,3 @@ try { | ||
try { | ||
return __wbg_adapter_159(a, state0.b, arg0, arg1); | ||
return __wbg_adapter_171(a, state0.b, arg0, arg1); | ||
} finally { | ||
@@ -1197,4 +1325,4 @@ state0.a = a; | ||
}; | ||
imports.wbg.__wbindgen_closure_wrapper1401 = function(arg0, arg1, arg2) { | ||
const ret = makeMutClosure(arg0, arg1, 486, __wbg_adapter_52); | ||
imports.wbg.__wbindgen_closure_wrapper2124 = function(arg0, arg1, arg2) { | ||
const ret = makeMutClosure(arg0, arg1, 724, __wbg_adapter_52); | ||
return addHeapObject(ret); | ||
@@ -1201,0 +1329,0 @@ }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2999
5913006