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

@concordium/rust-bindings

Package Overview
Dependencies
Maintainers
4
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@concordium/rust-bindings - npm Package Compare versions

Comparing version

to
0.1.1

6

package.json
{
"name": "@concordium/rust-bindings",
"version": "0.1.0",
"version": "0.1.1",
"license": "Apache-2.0",

@@ -9,3 +9,3 @@ "engines": {

"main": "pkg/node/concordium_rust_bindings.js",
"module": "pkg/bundler/concordium_rust_bindings.js",
"browser": "pkg/bundler/concordium_rust_bindings.js",
"types": "pkg/bundler/concordium_rust_bindings.d.ts",

@@ -18,4 +18,4 @@ "files": [

"lint-fix": "cargo +nightly-2021-06-09-x86_64-unknown-linux-gnu fmt",
"build": "wasm-pack build --target bundler --out-dir pkg/bundler && wasm-pack build --target nodejs --out-dir pkg/node"
"build": "wasm-pack build --target web --out-dir pkg/bundler && wasm-pack build --target nodejs --out-dir pkg/node"
}
}

@@ -28,1 +28,55 @@ /* tslint:disable */

export function deserializeState(contract_name: string, state_bytes: string, schema: string): string;
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
export interface InitOutput {
readonly memory: WebAssembly.Memory;
readonly generateUnsignedCredential: (a: number, b: number, c: number) => void;
readonly getDeploymentDetails: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
readonly getDeploymentInfo: (a: number, b: number, c: number, d: number) => void;
readonly deserializeState: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
readonly verify_initial_cdi_ffi: (a: number, b: number, c: number, d: number) => number;
readonly verify_cdi_ffi: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
readonly pedersen_key_gen: () => number;
readonly ip_info_ip_identity: (a: number) => number;
readonly dummy_generate_global_context: () => number;
readonly ar_info_ar_identity: (a: number) => number;
readonly pedersen_key_from_bytes: (a: number, b: number) => number;
readonly pedersen_key_to_bytes: (a: number, b: number) => number;
readonly pedersen_key_free: (a: number) => void;
readonly ps_sig_key_from_bytes: (a: number, b: number) => number;
readonly ps_sig_key_to_bytes: (a: number, b: number) => number;
readonly ps_sig_key_free: (a: number) => void;
readonly ps_sig_key_gen: (a: number) => number;
readonly ip_info_free: (a: number) => void;
readonly ip_info_from_bytes: (a: number, b: number) => number;
readonly ip_info_to_bytes: (a: number, b: number) => number;
readonly ip_info_from_json: (a: number, b: number) => number;
readonly ip_info_to_json: (a: number, b: number) => number;
readonly global_context_free: (a: number) => void;
readonly global_context_from_bytes: (a: number, b: number) => number;
readonly global_context_to_bytes: (a: number, b: number) => number;
readonly global_context_from_json: (a: number, b: number) => number;
readonly global_context_to_json: (a: number, b: number) => number;
readonly ar_info_free: (a: number) => void;
readonly ar_info_from_bytes: (a: number, b: number) => number;
readonly ar_info_to_bytes: (a: number, b: number) => number;
readonly ar_info_from_json: (a: number, b: number) => number;
readonly ar_info_to_json: (a: number, b: number) => number;
readonly free_array_len: (a: number, b: number) => void;
readonly __wbindgen_malloc: (a: number) => number;
readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
readonly __wbindgen_free: (a: number, b: number) => void;
readonly __wbindgen_exn_store: (a: number) => void;
}
/**
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
* for everything else, calls `WebAssembly.instantiate` directly.
*
* @param {InitInput | Promise<InitInput>} module_or_path
*
* @returns {Promise<InitOutput>}
*/
export default function init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;

@@ -1,2 +0,352 @@

import * as wasm from "./concordium_rust_bindings_bg.wasm";
export * from "./concordium_rust_bindings_bg.js";
let wasm;
const heap = new Array(32).fill(undefined);
heap.push(undefined, null, true, false);
function getObject(idx) { return heap[idx]; }
let WASM_VECTOR_LEN = 0;
let cachegetUint8Memory0 = null;
function getUint8Memory0() {
if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {
cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);
}
return cachegetUint8Memory0;
}
const cachedTextEncoder = new TextEncoder('utf-8');
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
? function (arg, view) {
return cachedTextEncoder.encodeInto(arg, view);
}
: function (arg, view) {
const buf = cachedTextEncoder.encode(arg);
view.set(buf);
return {
read: arg.length,
written: buf.length
};
});
function passStringToWasm0(arg, malloc, realloc) {
if (realloc === undefined) {
const buf = cachedTextEncoder.encode(arg);
const ptr = malloc(buf.length);
getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
WASM_VECTOR_LEN = buf.length;
return ptr;
}
let len = arg.length;
let ptr = malloc(len);
const mem = getUint8Memory0();
let offset = 0;
for (; offset < len; offset++) {
const code = arg.charCodeAt(offset);
if (code > 0x7F) break;
mem[ptr + offset] = code;
}
if (offset !== len) {
if (offset !== 0) {
arg = arg.slice(offset);
}
ptr = realloc(ptr, len, len = offset + arg.length * 3);
const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
const ret = encodeString(arg, view);
offset += ret.written;
}
WASM_VECTOR_LEN = offset;
return ptr;
}
let cachegetInt32Memory0 = null;
function getInt32Memory0() {
if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {
cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);
}
return cachegetInt32Memory0;
}
let heap_next = heap.length;
function dropObject(idx) {
if (idx < 36) return;
heap[idx] = heap_next;
heap_next = idx;
}
function takeObject(idx) {
const ret = getObject(idx);
dropObject(idx);
return ret;
}
const cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
cachedTextDecoder.decode();
function getStringFromWasm0(ptr, len) {
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;
}
/**
* @param {string} input
* @returns {string}
*/
export function generateUnsignedCredential(input) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.generateUnsignedCredential(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
return getStringFromWasm0(r0, r1);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
wasm.__wbindgen_free(r0, r1);
}
}
let stack_pointer = 32;
function addBorrowedObject(obj) {
if (stack_pointer == 1) throw new Error('out of js stack');
heap[--stack_pointer] = obj;
return stack_pointer;
}
const u32CvtShim = new Uint32Array(2);
const uint64CvtShim = new BigUint64Array(u32CvtShim.buffer);
/**
* @param {any} signatures
* @param {string} unsigned_info
* @param {BigInt} expiry
* @returns {string}
*/
export function getDeploymentDetails(signatures, unsigned_info, expiry) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passStringToWasm0(unsigned_info, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
uint64CvtShim[0] = expiry;
const low1 = u32CvtShim[0];
const high1 = u32CvtShim[1];
wasm.getDeploymentDetails(retptr, addBorrowedObject(signatures), ptr0, len0, low1, high1);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
return getStringFromWasm0(r0, r1);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
heap[stack_pointer++] = undefined;
wasm.__wbindgen_free(r0, r1);
}
}
/**
* @param {any} signatures
* @param {string} unsigned_info
* @returns {string}
*/
export function getDeploymentInfo(signatures, unsigned_info) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passStringToWasm0(unsigned_info, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.getDeploymentInfo(retptr, addBorrowedObject(signatures), ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
return getStringFromWasm0(r0, r1);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
heap[stack_pointer++] = undefined;
wasm.__wbindgen_free(r0, r1);
}
}
/**
* @param {string} contract_name
* @param {string} state_bytes
* @param {string} schema
* @returns {string}
*/
export function deserializeState(contract_name, state_bytes, schema) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passStringToWasm0(contract_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
const ptr1 = passStringToWasm0(state_bytes, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len1 = WASM_VECTOR_LEN;
const ptr2 = passStringToWasm0(schema, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len2 = WASM_VECTOR_LEN;
wasm.deserializeState(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
return getStringFromWasm0(r0, r1);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
wasm.__wbindgen_free(r0, r1);
}
}
function handleError(f, args) {
try {
return f.apply(this, args);
} catch (e) {
wasm.__wbindgen_exn_store(addHeapObject(e));
}
}
function getArrayU8FromWasm0(ptr, len) {
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
}
async function load(module, imports) {
if (typeof Response === 'function' && module instanceof Response) {
if (typeof WebAssembly.instantiateStreaming === 'function') {
try {
return await WebAssembly.instantiateStreaming(module, imports);
} catch (e) {
if (module.headers.get('Content-Type') != 'application/wasm') {
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
} else {
throw e;
}
}
}
const bytes = await module.arrayBuffer();
return await WebAssembly.instantiate(bytes, imports);
} else {
const instance = await WebAssembly.instantiate(module, imports);
if (instance instanceof WebAssembly.Instance) {
return { instance, module };
} else {
return instance;
}
}
}
async function init(input) {
if (typeof input === 'undefined') {
input = new URL('concordium_rust_bindings_bg.wasm', import.meta.url);
}
const imports = {};
imports.wbg = {};
imports.wbg.__wbindgen_json_serialize = function(arg0, arg1) {
const obj = getObject(arg1);
const ret = JSON.stringify(obj === undefined ? null : obj);
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
};
imports.wbg.__wbg_self_86b4b13392c7af56 = function() { return handleError(function () {
const ret = self.self;
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
takeObject(arg0);
};
imports.wbg.__wbg_static_accessor_MODULE_452b4680e8614c81 = function() {
const ret = module;
return addHeapObject(ret);
};
imports.wbg.__wbg_require_f5521a5b85ad2542 = function(arg0, arg1, arg2) {
const ret = getObject(arg0).require(getStringFromWasm0(arg1, arg2));
return addHeapObject(ret);
};
imports.wbg.__wbg_crypto_b8c92eaac23d0d80 = function(arg0) {
const ret = getObject(arg0).crypto;
return addHeapObject(ret);
};
imports.wbg.__wbg_msCrypto_9ad6677321a08dd8 = function(arg0) {
const ret = getObject(arg0).msCrypto;
return addHeapObject(ret);
};
imports.wbg.__wbindgen_is_undefined = function(arg0) {
const ret = getObject(arg0) === undefined;
return ret;
};
imports.wbg.__wbg_getRandomValues_dd27e6b0652b3236 = function(arg0) {
const ret = getObject(arg0).getRandomValues;
return addHeapObject(ret);
};
imports.wbg.__wbg_getRandomValues_e57c9b75ddead065 = function(arg0, arg1) {
getObject(arg0).getRandomValues(getObject(arg1));
};
imports.wbg.__wbg_randomFillSync_d2ba53160aec6aba = function(arg0, arg1, arg2) {
getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
};
imports.wbg.__wbg_buffer_397eaa4d72ee94dd = function(arg0) {
const ret = getObject(arg0).buffer;
return addHeapObject(ret);
};
imports.wbg.__wbg_new_a7ce447f15ff496f = function(arg0) {
const ret = new Uint8Array(getObject(arg0));
return addHeapObject(ret);
};
imports.wbg.__wbg_set_969ad0a60e51d320 = function(arg0, arg1, arg2) {
getObject(arg0).set(getObject(arg1), arg2 >>> 0);
};
imports.wbg.__wbg_length_1eb8fc608a0d4cdb = function(arg0) {
const ret = getObject(arg0).length;
return ret;
};
imports.wbg.__wbg_newwithlength_929232475839a482 = function(arg0) {
const ret = new Uint8Array(arg0 >>> 0);
return addHeapObject(ret);
};
imports.wbg.__wbg_subarray_8b658422a224f479 = function(arg0, arg1, arg2) {
const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
return addHeapObject(ret);
};
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
throw new Error(getStringFromWasm0(arg0, arg1));
};
imports.wbg.__wbindgen_memory = function() {
const ret = wasm.memory;
return addHeapObject(ret);
};
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
input = fetch(input);
}
const { instance, module } = await load(await input, imports);
wasm = instance.exports;
init.__wbindgen_wasm_module = module;
return wasm;
}
export default init;

@@ -120,4 +120,4 @@ let imports = {};

const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
var ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.generateUnsignedCredential(retptr, ptr0, len0);

@@ -153,4 +153,4 @@ var r0 = getInt32Memory0()[retptr / 4 + 0];

const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
var ptr0 = passStringToWasm0(unsigned_info, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
const ptr0 = passStringToWasm0(unsigned_info, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
uint64CvtShim[0] = expiry;

@@ -178,4 +178,4 @@ const low1 = u32CvtShim[0];

const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
var ptr0 = passStringToWasm0(unsigned_info, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
const ptr0 = passStringToWasm0(unsigned_info, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.getDeploymentInfo(retptr, addBorrowedObject(signatures), ptr0, len0);

@@ -201,8 +201,8 @@ var r0 = getInt32Memory0()[retptr / 4 + 0];

const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
var ptr0 = passStringToWasm0(contract_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
var ptr1 = passStringToWasm0(state_bytes, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len1 = WASM_VECTOR_LEN;
var ptr2 = passStringToWasm0(schema, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len2 = WASM_VECTOR_LEN;
const ptr0 = passStringToWasm0(contract_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
const ptr1 = passStringToWasm0(state_bytes, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len1 = WASM_VECTOR_LEN;
const ptr2 = passStringToWasm0(schema, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len2 = WASM_VECTOR_LEN;
wasm.deserializeState(retptr, ptr0, len0, ptr1, len1, ptr2, len2);

@@ -232,5 +232,5 @@ var r0 = getInt32Memory0()[retptr / 4 + 0];

const obj = getObject(arg1);
var ret = JSON.stringify(obj === undefined ? null : obj);
var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
const ret = JSON.stringify(obj === undefined ? null : obj);
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;

@@ -241,3 +241,3 @@ getInt32Memory0()[arg0 / 4 + 0] = ptr0;

module.exports.__wbg_self_86b4b13392c7af56 = function() { return handleError(function () {
var ret = self.self;
const ret = self.self;
return addHeapObject(ret);

@@ -251,3 +251,3 @@ }, arguments) };

module.exports.__wbg_static_accessor_MODULE_452b4680e8614c81 = function() {
var ret = module;
const ret = module;
return addHeapObject(ret);

@@ -257,3 +257,3 @@ };

module.exports.__wbg_require_f5521a5b85ad2542 = function(arg0, arg1, arg2) {
var ret = getObject(arg0).require(getStringFromWasm0(arg1, arg2));
const ret = getObject(arg0).require(getStringFromWasm0(arg1, arg2));
return addHeapObject(ret);

@@ -263,3 +263,3 @@ };

module.exports.__wbg_crypto_b8c92eaac23d0d80 = function(arg0) {
var ret = getObject(arg0).crypto;
const ret = getObject(arg0).crypto;
return addHeapObject(ret);

@@ -269,3 +269,3 @@ };

module.exports.__wbg_msCrypto_9ad6677321a08dd8 = function(arg0) {
var ret = getObject(arg0).msCrypto;
const ret = getObject(arg0).msCrypto;
return addHeapObject(ret);

@@ -275,3 +275,3 @@ };

module.exports.__wbindgen_is_undefined = function(arg0) {
var ret = getObject(arg0) === undefined;
const ret = getObject(arg0) === undefined;
return ret;

@@ -281,3 +281,3 @@ };

module.exports.__wbg_getRandomValues_dd27e6b0652b3236 = function(arg0) {
var ret = getObject(arg0).getRandomValues;
const ret = getObject(arg0).getRandomValues;
return addHeapObject(ret);

@@ -295,3 +295,3 @@ };

module.exports.__wbg_buffer_397eaa4d72ee94dd = function(arg0) {
var ret = getObject(arg0).buffer;
const ret = getObject(arg0).buffer;
return addHeapObject(ret);

@@ -301,3 +301,3 @@ };

module.exports.__wbg_new_a7ce447f15ff496f = function(arg0) {
var ret = new Uint8Array(getObject(arg0));
const ret = new Uint8Array(getObject(arg0));
return addHeapObject(ret);

@@ -311,3 +311,3 @@ };

module.exports.__wbg_length_1eb8fc608a0d4cdb = function(arg0) {
var ret = getObject(arg0).length;
const ret = getObject(arg0).length;
return ret;

@@ -317,3 +317,3 @@ };

module.exports.__wbg_newwithlength_929232475839a482 = function(arg0) {
var ret = new Uint8Array(arg0 >>> 0);
const ret = new Uint8Array(arg0 >>> 0);
return addHeapObject(ret);

@@ -323,3 +323,3 @@ };

module.exports.__wbg_subarray_8b658422a224f479 = function(arg0, arg1, arg2) {
var ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
return addHeapObject(ret);

@@ -333,3 +333,3 @@ };

module.exports.__wbindgen_memory = function() {
var ret = wasm.memory;
const ret = wasm.memory;
return addHeapObject(ret);

@@ -336,0 +336,0 @@ };

@@ -19,4 +19,4 @@ # concordium-rust-bindings

```
yarn publish
yarn npm publish
```
and step through the steps precented to you.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet