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

@noir-lang/acvm_js

Package Overview
Dependencies
Maintainers
0
Versions
352
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@noir-lang/acvm_js - npm Package Compare versions

Comparing version 1.0.0-beta.1-ebc4d2c.nightly to 1.0.0-beta.1-ed9977a.nightly

20

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

@@ -19,13 +12,20 @@ export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;

export function decompressWitnessStack(a: number, b: number, c: number): void;
export function and(a: number, b: number): number;
export function xor(a: number, b: number): number;
export function sha256_compression(a: number, b: number, c: number, d: number, e: number): void;
export function blake2s256(a: number, b: number, c: number): void;
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 executeCircuit(a: number, b: number, c: number, d: number): number;
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
export function executeProgram(a: number, b: number, c: number, d: number): number;
export function initLogLevel(a: number, b: number, c: number): void;
export function __wbindgen_malloc(a: number): number;
export function __wbindgen_realloc(a: number, b: number, c: number): number;
export const __wbindgen_export_2: WebAssembly.Table;
export function _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h624a3dfbf78ca22a(a: number, b: number, c: number): void;
export function wasm_bindgen__convert__closures__invoke1_mut__h7f1511a2915e72e7(a: number, b: number, c: number): void;
export function __wbindgen_add_to_stack_pointer(a: number): number;
export function __wbindgen_free(a: number, b: number): void;
export function wasm_bindgen__convert__closures__invoke3_mut__h45040feada3ebb25(a: number, b: number, c: number, d: number, e: number): void;
export function wasm_bindgen__convert__closures__invoke3_mut__h0ccbefcb4d729e69(a: number, b: number, c: number, d: number, e: number): void;
export function __wbindgen_exn_store(a: number): void;
export function wasm_bindgen__convert__closures__invoke2_mut__h3f07259b3eb55784(a: number, b: number, c: number, d: number): void;
export function wasm_bindgen__convert__closures__invoke2_mut__h2ed79be2e23ac22f(a: number, b: number, c: number, d: number): void;
/* tslint:disable */
/* eslint-disable */
/**
* Performs a bitwise AND operation between `lhs` and `rhs`
* @param {string} lhs
* @param {string} rhs
* @returns {string}
*/
export function and(lhs: string, rhs: string): string;
/**
* Performs a bitwise XOR operation between `lhs` and `rhs`
* @param {string} lhs
* @param {string} rhs
* @returns {string}
*/
export function xor(lhs: string, rhs: string): string;
/**
* Sha256 compression function
* @param {Uint32Array} inputs
* @param {Uint32Array} state
* @returns {Uint32Array}
*/
export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
/**
* Calculates the Blake2s256 hash of the input bytes
* @param {Uint8Array} inputs
* @returns {Uint8Array}
*/
export function blake2s256(inputs: Uint8Array): Uint8Array;
/**
* Verifies a ECDSA signature over the secp256k1 curve.
* @param {Uint8Array} hashed_msg
* @param {Uint8Array} public_key_x_bytes
* @param {Uint8Array} public_key_y_bytes
* @param {Uint8Array} signature
* @returns {boolean}
*/
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
/**
* Verifies a ECDSA signature over the secp256r1 curve.
* @param {Uint8Array} hashed_msg
* @param {Uint8Array} public_key_x_bytes
* @param {Uint8Array} public_key_y_bytes
* @param {Uint8Array} signature
* @returns {boolean}
*/
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
/**
* Returns the `BuildInfo` object containing information about how the installed package was built.

@@ -54,8 +9,2 @@ * @returns {BuildInfo} - Information on how the installed package was built.

/**
* 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.

@@ -123,2 +72,47 @@ *

/**
* 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;
/**
* Sha256 compression function
* @param {Uint32Array} inputs
* @param {Uint32Array} state
* @returns {Uint32Array}
*/
export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
/**
* Calculates the Blake2s256 hash of the input bytes
* @param {Uint8Array} inputs
* @returns {Uint8Array}
*/
export function blake2s256(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;
/**
* Executes an ACIR circuit to generate the solved witness from the initial witness.

@@ -151,4 +145,25 @@ *

export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
/**
* Sets the package's logging level.
*
* @param {LogLevel} level - The maximum level of logging to be emitted.
*/
export function initLogLevel(filter: string): void;
// 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

@@ -167,16 +182,2 @@ * @property {string} gitHash - The hash of the git commit from which the package was built.

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

@@ -204,15 +205,14 @@ selector: string;

// Map from witness index to hex string value of witness.
export type WitnessMap = Map<number, string>;
export type ForeignCallInput = string[]
export type ForeignCallOutput = string | 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;
}
* A callback which performs an foreign call and returns the response.
* @callback ForeignCallHandler
* @param {string} name - The identifier for the type of foreign call being performed.
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
*/
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;

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

function isLikeNone(x) {
return x === undefined || x === null;
}
function addHeapObject(obj) {
if (heap_next === heap.length) heap.push(heap.length + 1);
const idx = heap_next;
heap_next = heap[idx];
let cachedFloat64Memory0 = null;
function getFloat64Memory0() {
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
}
return cachedFloat64Memory0;
heap[idx] = obj;
return idx;
}
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 });

@@ -67,11 +54,2 @@

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;

@@ -132,2 +110,24 @@

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

@@ -223,71 +223,14 @@ // primitive types

function __wbg_adapter_22(arg0, arg1, arg2) {
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h624a3dfbf78ca22a(arg0, arg1, addHeapObject(arg2));
wasm.wasm_bindgen__convert__closures__invoke1_mut__h7f1511a2915e72e7(arg0, arg1, addHeapObject(arg2));
}
/**
* Performs a bitwise AND operation between `lhs` and `rhs`
* @param {string} lhs
* @param {string} rhs
* @returns {string}
* Returns the `BuildInfo` object containing information about how the installed package was built.
* @returns {BuildInfo} - Information on how the installed package was built.
*/
module.exports.and = function(lhs, rhs) {
const ret = wasm.and(addHeapObject(lhs), addHeapObject(rhs));
module.exports.buildInfo = function() {
const ret = wasm.buildInfo();
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);
};
let cachedUint32Memory0 = null;
function getUint32Memory0() {
if (cachedUint32Memory0 === null || cachedUint32Memory0.byteLength === 0) {
cachedUint32Memory0 = new Uint32Array(wasm.memory.buffer);
}
return cachedUint32Memory0;
}
function passArray32ToWasm0(arg, malloc) {
const ptr = malloc(arg.length * 4) >>> 0;
getUint32Memory0().set(arg, ptr / 4);
WASM_VECTOR_LEN = arg.length;
return ptr;
}
function getArrayU32FromWasm0(ptr, len) {
ptr = ptr >>> 0;
return getUint32Memory0().subarray(ptr / 4, ptr / 4 + len);
}
/**
* Sha256 compression function
* @param {Uint32Array} inputs
* @param {Uint32Array} state
* @returns {Uint32Array}
*/
module.exports.sha256_compression = function(inputs, state) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
const len1 = WASM_VECTOR_LEN;
wasm.sha256_compression(retptr, ptr0, len0, ptr1, len1);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v3 = getArrayU32FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 4);
return v3;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
function passArray8ToWasm0(arg, malloc) {

@@ -299,101 +242,3 @@ const ptr = malloc(arg.length * 1) >>> 0;

}
function getArrayU8FromWasm0(ptr, len) {
ptr = ptr >>> 0;
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
}
/**
* Calculates the Blake2s256 hash of the input bytes
* @param {Uint8Array} inputs
* @returns {Uint8Array}
*/
module.exports.blake2s256 = function(inputs) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.blake2s256(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v2 = getArrayU8FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 1);
return v2;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* Verifies a ECDSA signature over the secp256k1 curve.
* @param {Uint8Array} hashed_msg
* @param {Uint8Array} public_key_x_bytes
* @param {Uint8Array} public_key_y_bytes
* @param {Uint8Array} signature
* @returns {boolean}
*/
module.exports.ecdsa_secp256k1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
const len1 = WASM_VECTOR_LEN;
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
const len2 = WASM_VECTOR_LEN;
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
const len3 = WASM_VECTOR_LEN;
const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
return ret !== 0;
};
/**
* Verifies a ECDSA signature over the secp256r1 curve.
* @param {Uint8Array} hashed_msg
* @param {Uint8Array} public_key_x_bytes
* @param {Uint8Array} public_key_y_bytes
* @param {Uint8Array} signature
* @returns {boolean}
*/
module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
const len1 = WASM_VECTOR_LEN;
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
const len2 = WASM_VECTOR_LEN;
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
const len3 = WASM_VECTOR_LEN;
const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
return ret !== 0;
};
/**
* Returns the `BuildInfo` object containing information about how the installed package was built.
* @returns {BuildInfo} - Information on how the installed package was built.
*/
module.exports.buildInfo = function() {
const ret = wasm.buildInfo();
return takeObject(ret);
};
/**
* Sets the package's logging level.
*
* @param {LogLevel} level - The maximum level of logging to be emitted.
*/
module.exports.initLogLevel = function(filter) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.initLogLevel(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
if (r1) {
throw takeObject(r0);
}
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.

@@ -482,2 +327,6 @@ *

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

@@ -583,2 +432,131 @@ * Compresses a `WitnessMap` into the binary format outputted by Nargo.

/**
* 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);
};
let cachedUint32Memory0 = null;
function getUint32Memory0() {
if (cachedUint32Memory0 === null || cachedUint32Memory0.byteLength === 0) {
cachedUint32Memory0 = new Uint32Array(wasm.memory.buffer);
}
return cachedUint32Memory0;
}
function passArray32ToWasm0(arg, malloc) {
const ptr = malloc(arg.length * 4) >>> 0;
getUint32Memory0().set(arg, ptr / 4);
WASM_VECTOR_LEN = arg.length;
return ptr;
}
function getArrayU32FromWasm0(ptr, len) {
ptr = ptr >>> 0;
return getUint32Memory0().subarray(ptr / 4, ptr / 4 + len);
}
/**
* Sha256 compression function
* @param {Uint32Array} inputs
* @param {Uint32Array} state
* @returns {Uint32Array}
*/
module.exports.sha256_compression = function(inputs, state) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
const len1 = WASM_VECTOR_LEN;
wasm.sha256_compression(retptr, ptr0, len0, ptr1, len1);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v3 = getArrayU32FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 4);
return v3;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* Calculates the Blake2s256 hash of the input bytes
* @param {Uint8Array} inputs
* @returns {Uint8Array}
*/
module.exports.blake2s256 = function(inputs) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.blake2s256(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v2 = getArrayU8FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 1);
return v2;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* 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;
};
/**
* Executes an ACIR circuit to generate the solved witness from the initial witness.

@@ -629,4 +607,25 @@ *

/**
* Sets the package's logging level.
*
* @param {LogLevel} level - The maximum level of logging to be emitted.
*/
module.exports.initLogLevel = function(filter) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.initLogLevel(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
if (r1) {
throw takeObject(r0);
}
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
function __wbg_adapter_75(arg0, arg1, arg2, arg3, arg4) {
wasm.wasm_bindgen__convert__closures__invoke3_mut__h45040feada3ebb25(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
wasm.wasm_bindgen__convert__closures__invoke3_mut__h0ccbefcb4d729e69(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
}

@@ -642,16 +641,5 @@

function __wbg_adapter_92(arg0, arg1, arg2, arg3) {
wasm.wasm_bindgen__convert__closures__invoke2_mut__h3f07259b3eb55784(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
wasm.wasm_bindgen__convert__closures__invoke2_mut__h2ed79be2e23ac22f(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
}
module.exports.__wbindgen_object_drop_ref = function(arg0) {
takeObject(arg0);
};
module.exports.__wbindgen_number_get = function(arg0, arg1) {
const obj = getObject(arg1);
const ret = typeof(obj) === 'number' ? obj : undefined;
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
};
module.exports.__wbindgen_cb_drop = function(arg0) {

@@ -667,14 +655,18 @@ const obj = takeObject(arg0).original;

module.exports.__wbg_constructor_a10f2b77c63b8d5e = function(arg0) {
const ret = new Error(takeObject(arg0));
return addHeapObject(ret);
module.exports.__wbindgen_object_drop_ref = function(arg0) {
takeObject(arg0);
};
module.exports.__wbindgen_string_new = function(arg0, arg1) {
const ret = getStringFromWasm0(arg0, arg1);
return addHeapObject(ret);
module.exports.__wbindgen_is_string = function(arg0) {
const ret = typeof(getObject(arg0)) === 'string';
return ret;
};
module.exports.__wbg_new_a16954212d33afab = function() {
const ret = new Array();
module.exports.__wbindgen_is_array = function(arg0) {
const ret = Array.isArray(getObject(arg0));
return ret;
};
module.exports.__wbg_new_d86d15722f6b14a4 = function() {
const ret = new Map();
return addHeapObject(ret);

@@ -688,14 +680,4 @@ };

module.exports.__wbindgen_is_array = function(arg0) {
const ret = Array.isArray(getObject(arg0));
return ret;
};
module.exports.__wbindgen_is_string = function(arg0) {
const ret = typeof(getObject(arg0)) === 'string';
return ret;
};
module.exports.__wbg_new_d86d15722f6b14a4 = function() {
const ret = new Map();
module.exports.__wbindgen_string_new = function(arg0, arg1) {
const ret = getStringFromWasm0(arg0, arg1);
return addHeapObject(ret);

@@ -713,2 +695,19 @@ };

module.exports.__wbg_constructor_a10f2b77c63b8d5e = function(arg0) {
const ret = new Error(takeObject(arg0));
return addHeapObject(ret);
};
module.exports.__wbg_new_a16954212d33afab = function() {
const ret = new Array();
return addHeapObject(ret);
};
module.exports.__wbindgen_number_get = function(arg0, arg1) {
const obj = getObject(arg1);
const ret = typeof(obj) === 'number' ? obj : undefined;
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
};
module.exports.__wbg_new_abda76e883ba8a5f = function() {

@@ -932,4 +931,4 @@ const ret = new Error();

module.exports.__wbindgen_closure_wrapper729 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 267, __wbg_adapter_22);
module.exports.__wbindgen_closure_wrapper763 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 297, __wbg_adapter_22);
return addHeapObject(ret);

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

{
"name": "@noir-lang/acvm_js",
"version": "1.0.0-beta.1-ebc4d2c.nightly",
"version": "1.0.0-beta.1-ed9977a.nightly",
"publishConfig": {

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

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

@@ -19,13 +12,20 @@ export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;

export function decompressWitnessStack(a: number, b: number, c: number): void;
export function and(a: number, b: number): number;
export function xor(a: number, b: number): number;
export function sha256_compression(a: number, b: number, c: number, d: number, e: number): void;
export function blake2s256(a: number, b: number, c: number): void;
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 executeCircuit(a: number, b: number, c: number, d: number): number;
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
export function executeProgram(a: number, b: number, c: number, d: number): number;
export function initLogLevel(a: number, b: number, c: number): void;
export function __wbindgen_malloc(a: number): number;
export function __wbindgen_realloc(a: number, b: number, c: number): number;
export const __wbindgen_export_2: WebAssembly.Table;
export function _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h624a3dfbf78ca22a(a: number, b: number, c: number): void;
export function wasm_bindgen__convert__closures__invoke1_mut__h7f1511a2915e72e7(a: number, b: number, c: number): void;
export function __wbindgen_add_to_stack_pointer(a: number): number;
export function __wbindgen_free(a: number, b: number): void;
export function wasm_bindgen__convert__closures__invoke3_mut__h45040feada3ebb25(a: number, b: number, c: number, d: number, e: number): void;
export function wasm_bindgen__convert__closures__invoke3_mut__h0ccbefcb4d729e69(a: number, b: number, c: number, d: number, e: number): void;
export function __wbindgen_exn_store(a: number): void;
export function wasm_bindgen__convert__closures__invoke2_mut__h3f07259b3eb55784(a: number, b: number, c: number, d: number): void;
export function wasm_bindgen__convert__closures__invoke2_mut__h2ed79be2e23ac22f(a: number, b: number, c: number, d: number): void;
/* tslint:disable */
/* eslint-disable */
/**
* Performs a bitwise AND operation between `lhs` and `rhs`
* @param {string} lhs
* @param {string} rhs
* @returns {string}
*/
export function and(lhs: string, rhs: string): string;
/**
* Performs a bitwise XOR operation between `lhs` and `rhs`
* @param {string} lhs
* @param {string} rhs
* @returns {string}
*/
export function xor(lhs: string, rhs: string): string;
/**
* Sha256 compression function
* @param {Uint32Array} inputs
* @param {Uint32Array} state
* @returns {Uint32Array}
*/
export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
/**
* Calculates the Blake2s256 hash of the input bytes
* @param {Uint8Array} inputs
* @returns {Uint8Array}
*/
export function blake2s256(inputs: Uint8Array): Uint8Array;
/**
* Verifies a ECDSA signature over the secp256k1 curve.
* @param {Uint8Array} hashed_msg
* @param {Uint8Array} public_key_x_bytes
* @param {Uint8Array} public_key_y_bytes
* @param {Uint8Array} signature
* @returns {boolean}
*/
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
/**
* Verifies a ECDSA signature over the secp256r1 curve.
* @param {Uint8Array} hashed_msg
* @param {Uint8Array} public_key_x_bytes
* @param {Uint8Array} public_key_y_bytes
* @param {Uint8Array} signature
* @returns {boolean}
*/
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
/**
* Returns the `BuildInfo` object containing information about how the installed package was built.

@@ -54,8 +9,2 @@ * @returns {BuildInfo} - Information on how the installed package was built.

/**
* 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.

@@ -123,2 +72,47 @@ *

/**
* 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;
/**
* Sha256 compression function
* @param {Uint32Array} inputs
* @param {Uint32Array} state
* @returns {Uint32Array}
*/
export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
/**
* Calculates the Blake2s256 hash of the input bytes
* @param {Uint8Array} inputs
* @returns {Uint8Array}
*/
export function blake2s256(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;
/**
* Executes an ACIR circuit to generate the solved witness from the initial witness.

@@ -151,4 +145,25 @@ *

export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
/**
* Sets the package's logging level.
*
* @param {LogLevel} level - The maximum level of logging to be emitted.
*/
export function initLogLevel(filter: string): void;
// 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

@@ -167,16 +182,2 @@ * @property {string} gitHash - The hash of the git commit from which the package was built.

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

@@ -204,14 +205,13 @@ selector: string;

// Map from witness index to hex string value of witness.
export type WitnessMap = Map<number, string>;
export type ForeignCallInput = string[]
export type ForeignCallOutput = string | 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;
}
* A callback which performs an foreign call and returns the response.
* @callback ForeignCallHandler
* @param {string} name - The identifier for the type of foreign call being performed.
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
*/
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;

@@ -224,10 +224,3 @@

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

@@ -240,14 +233,21 @@ readonly getPublicParametersWitness: (a: number, b: number, c: number, d: number) => void;

readonly decompressWitnessStack: (a: number, b: number, c: number) => void;
readonly and: (a: number, b: number) => number;
readonly xor: (a: number, b: number) => number;
readonly sha256_compression: (a: number, b: number, c: number, d: number, e: number) => void;
readonly blake2s256: (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 executeCircuit: (a: number, b: number, c: number, d: number) => number;
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: number, d: number) => number;
readonly executeProgram: (a: number, b: number, c: number, d: number) => number;
readonly initLogLevel: (a: number, b: number, c: number) => void;
readonly __wbindgen_malloc: (a: number) => number;
readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
readonly __wbindgen_export_2: WebAssembly.Table;
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h624a3dfbf78ca22a: (a: number, b: number, c: number) => void;
readonly wasm_bindgen__convert__closures__invoke1_mut__h7f1511a2915e72e7: (a: number, b: number, c: number) => void;
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
readonly __wbindgen_free: (a: number, b: number) => void;
readonly wasm_bindgen__convert__closures__invoke3_mut__h45040feada3ebb25: (a: number, b: number, c: number, d: number, e: number) => void;
readonly wasm_bindgen__convert__closures__invoke3_mut__h0ccbefcb4d729e69: (a: number, b: number, c: number, d: number, e: number) => void;
readonly __wbindgen_exn_store: (a: number) => void;
readonly wasm_bindgen__convert__closures__invoke2_mut__h3f07259b3eb55784: (a: number, b: number, c: number, d: number) => void;
readonly wasm_bindgen__convert__closures__invoke2_mut__h2ed79be2e23ac22f: (a: number, b: number, c: number, d: number) => void;
}

@@ -254,0 +254,0 @@

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

function isLikeNone(x) {
return x === undefined || x === null;
}
function addHeapObject(obj) {
if (heap_next === heap.length) heap.push(heap.length + 1);
const idx = heap_next;
heap_next = heap[idx];
let cachedFloat64Memory0 = null;
function getFloat64Memory0() {
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
}
return cachedFloat64Memory0;
heap[idx] = obj;
return idx;
}
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') } } );

@@ -64,11 +51,2 @@

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;

@@ -129,2 +107,24 @@

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

@@ -220,71 +220,14 @@ // primitive types

function __wbg_adapter_22(arg0, arg1, arg2) {
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h624a3dfbf78ca22a(arg0, arg1, addHeapObject(arg2));
wasm.wasm_bindgen__convert__closures__invoke1_mut__h7f1511a2915e72e7(arg0, arg1, addHeapObject(arg2));
}
/**
* Performs a bitwise AND operation between `lhs` and `rhs`
* @param {string} lhs
* @param {string} rhs
* @returns {string}
* Returns the `BuildInfo` object containing information about how the installed package was built.
* @returns {BuildInfo} - Information on how the installed package was built.
*/
export function and(lhs, rhs) {
const ret = wasm.and(addHeapObject(lhs), addHeapObject(rhs));
export function buildInfo() {
const ret = wasm.buildInfo();
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);
}
let cachedUint32Memory0 = null;
function getUint32Memory0() {
if (cachedUint32Memory0 === null || cachedUint32Memory0.byteLength === 0) {
cachedUint32Memory0 = new Uint32Array(wasm.memory.buffer);
}
return cachedUint32Memory0;
}
function passArray32ToWasm0(arg, malloc) {
const ptr = malloc(arg.length * 4) >>> 0;
getUint32Memory0().set(arg, ptr / 4);
WASM_VECTOR_LEN = arg.length;
return ptr;
}
function getArrayU32FromWasm0(ptr, len) {
ptr = ptr >>> 0;
return getUint32Memory0().subarray(ptr / 4, ptr / 4 + len);
}
/**
* Sha256 compression function
* @param {Uint32Array} inputs
* @param {Uint32Array} state
* @returns {Uint32Array}
*/
export function sha256_compression(inputs, state) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
const len1 = WASM_VECTOR_LEN;
wasm.sha256_compression(retptr, ptr0, len0, ptr1, len1);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v3 = getArrayU32FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 4);
return v3;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
function passArray8ToWasm0(arg, malloc) {

@@ -296,101 +239,3 @@ const ptr = malloc(arg.length * 1) >>> 0;

}
function getArrayU8FromWasm0(ptr, len) {
ptr = ptr >>> 0;
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
}
/**
* Calculates the Blake2s256 hash of the input bytes
* @param {Uint8Array} inputs
* @returns {Uint8Array}
*/
export function blake2s256(inputs) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.blake2s256(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v2 = getArrayU8FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 1);
return v2;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
/**
* Verifies a ECDSA signature over the secp256k1 curve.
* @param {Uint8Array} hashed_msg
* @param {Uint8Array} public_key_x_bytes
* @param {Uint8Array} public_key_y_bytes
* @param {Uint8Array} signature
* @returns {boolean}
*/
export function ecdsa_secp256k1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
const len1 = WASM_VECTOR_LEN;
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
const len2 = WASM_VECTOR_LEN;
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
const len3 = WASM_VECTOR_LEN;
const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
return ret !== 0;
}
/**
* Verifies a ECDSA signature over the secp256r1 curve.
* @param {Uint8Array} hashed_msg
* @param {Uint8Array} public_key_x_bytes
* @param {Uint8Array} public_key_y_bytes
* @param {Uint8Array} signature
* @returns {boolean}
*/
export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
const len1 = WASM_VECTOR_LEN;
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
const len2 = WASM_VECTOR_LEN;
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
const len3 = WASM_VECTOR_LEN;
const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
return ret !== 0;
}
/**
* Returns the `BuildInfo` object containing information about how the installed package was built.
* @returns {BuildInfo} - Information on how the installed package was built.
*/
export function buildInfo() {
const ret = wasm.buildInfo();
return takeObject(ret);
}
/**
* Sets the package's logging level.
*
* @param {LogLevel} level - The maximum level of logging to be emitted.
*/
export function initLogLevel(filter) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.initLogLevel(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
if (r1) {
throw takeObject(r0);
}
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
/**
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.

@@ -479,2 +324,6 @@ *

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

@@ -580,2 +429,131 @@ * Compresses a `WitnessMap` into the binary format outputted by Nargo.

/**
* 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);
}
let cachedUint32Memory0 = null;
function getUint32Memory0() {
if (cachedUint32Memory0 === null || cachedUint32Memory0.byteLength === 0) {
cachedUint32Memory0 = new Uint32Array(wasm.memory.buffer);
}
return cachedUint32Memory0;
}
function passArray32ToWasm0(arg, malloc) {
const ptr = malloc(arg.length * 4) >>> 0;
getUint32Memory0().set(arg, ptr / 4);
WASM_VECTOR_LEN = arg.length;
return ptr;
}
function getArrayU32FromWasm0(ptr, len) {
ptr = ptr >>> 0;
return getUint32Memory0().subarray(ptr / 4, ptr / 4 + len);
}
/**
* Sha256 compression function
* @param {Uint32Array} inputs
* @param {Uint32Array} state
* @returns {Uint32Array}
*/
export function sha256_compression(inputs, state) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
const len1 = WASM_VECTOR_LEN;
wasm.sha256_compression(retptr, ptr0, len0, ptr1, len1);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v3 = getArrayU32FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 4);
return v3;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
/**
* Calculates the Blake2s256 hash of the input bytes
* @param {Uint8Array} inputs
* @returns {Uint8Array}
*/
export function blake2s256(inputs) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.blake2s256(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v2 = getArrayU8FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 1);
return v2;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
/**
* 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;
}
/**
* Executes an ACIR circuit to generate the solved witness from the initial witness.

@@ -626,4 +604,25 @@ *

/**
* Sets the package's logging level.
*
* @param {LogLevel} level - The maximum level of logging to be emitted.
*/
export function initLogLevel(filter) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.initLogLevel(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
if (r1) {
throw takeObject(r0);
}
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
function __wbg_adapter_75(arg0, arg1, arg2, arg3, arg4) {
wasm.wasm_bindgen__convert__closures__invoke3_mut__h45040feada3ebb25(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
wasm.wasm_bindgen__convert__closures__invoke3_mut__h0ccbefcb4d729e69(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
}

@@ -639,3 +638,3 @@

function __wbg_adapter_92(arg0, arg1, arg2, arg3) {
wasm.wasm_bindgen__convert__closures__invoke2_mut__h3f07259b3eb55784(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
wasm.wasm_bindgen__convert__closures__invoke2_mut__h2ed79be2e23ac22f(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
}

@@ -677,11 +676,2 @@

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

@@ -696,18 +686,9 @@ const obj = takeObject(arg0).original;

};
imports.wbg.__wbg_constructor_a10f2b77c63b8d5e = function(arg0) {
const ret = new Error(takeObject(arg0));
return addHeapObject(ret);
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
takeObject(arg0);
};
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
const ret = getStringFromWasm0(arg0, arg1);
return addHeapObject(ret);
imports.wbg.__wbindgen_is_string = function(arg0) {
const ret = typeof(getObject(arg0)) === 'string';
return ret;
};
imports.wbg.__wbg_new_a16954212d33afab = function() {
const ret = new Array();
return addHeapObject(ret);
};
imports.wbg.__wbindgen_number_new = function(arg0) {
const ret = arg0;
return addHeapObject(ret);
};
imports.wbg.__wbindgen_is_array = function(arg0) {

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

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

@@ -726,2 +703,10 @@ const ret = new Map();

};
imports.wbg.__wbindgen_number_new = function(arg0) {
const ret = arg0;
return addHeapObject(ret);
};
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
const ret = getStringFromWasm0(arg0, arg1);
return addHeapObject(ret);
};
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {

@@ -735,2 +720,16 @@ const obj = getObject(arg1);

};
imports.wbg.__wbg_constructor_a10f2b77c63b8d5e = function(arg0) {
const ret = new Error(takeObject(arg0));
return addHeapObject(ret);
};
imports.wbg.__wbg_new_a16954212d33afab = function() {
const ret = new Array();
return addHeapObject(ret);
};
imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
const obj = getObject(arg1);
const ret = typeof(obj) === 'number' ? obj : undefined;
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
};
imports.wbg.__wbg_new_abda76e883ba8a5f = function() {

@@ -919,4 +918,4 @@ const ret = new Error();

};
imports.wbg.__wbindgen_closure_wrapper729 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 267, __wbg_adapter_22);
imports.wbg.__wbindgen_closure_wrapper763 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 297, __wbg_adapter_22);
return addHeapObject(ret);

@@ -923,0 +922,0 @@ };

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc