@dfns/dfns-key-export-bundler
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -7,22 +7,2 @@ let wasm; | ||
const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; | ||
let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); | ||
cachedTextDecoder.decode(); | ||
let cachedUint8Memory0 = null; | ||
function getUint8Memory0() { | ||
if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { | ||
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); | ||
} | ||
return cachedUint8Memory0; | ||
} | ||
function getStringFromWasm0(ptr, len) { | ||
ptr = ptr >>> 0; | ||
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); | ||
} | ||
const heap = new Array(128).fill(undefined); | ||
@@ -32,15 +12,6 @@ | ||
function getObject(idx) { return heap[idx]; } | ||
let heap_next = heap.length; | ||
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; | ||
} | ||
function getObject(idx) { return heap[idx]; } | ||
function dropObject(idx) { | ||
@@ -60,2 +31,11 @@ if (idx < 132) return; | ||
let cachedUint8Memory0 = null; | ||
function getUint8Memory0() { | ||
if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { | ||
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); | ||
} | ||
return cachedUint8Memory0; | ||
} | ||
const lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder; | ||
@@ -129,2 +109,22 @@ | ||
const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; | ||
let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); | ||
cachedTextDecoder.decode(); | ||
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 cachedFloat64Memory0 = null; | ||
@@ -334,3 +334,3 @@ | ||
* @param {any} response | ||
* @returns {SecretKey} | ||
* @returns {SecretScalar} | ||
*/ | ||
@@ -347,3 +347,3 @@ recoverSecretKey(response) { | ||
} | ||
return SecretKey.__wrap(r0); | ||
return SecretScalar.__wrap(r0); | ||
} finally { | ||
@@ -357,7 +357,7 @@ wasm.__wbindgen_add_to_stack_pointer(16); | ||
*/ | ||
export class SecretKey { | ||
export class SecretScalar { | ||
static __wrap(ptr) { | ||
ptr = ptr >>> 0; | ||
const obj = Object.create(SecretKey.prototype); | ||
const obj = Object.create(SecretScalar.prototype); | ||
obj.__wbg_ptr = ptr; | ||
@@ -377,3 +377,3 @@ | ||
const ptr = this.__destroy_into_raw(); | ||
wasm.__wbg_secretkey_free(ptr); | ||
wasm.__wbg_secretscalar_free(ptr); | ||
} | ||
@@ -387,3 +387,3 @@ /** | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
wasm.secretkey_toBytesBE(retptr, this.__wbg_ptr); | ||
wasm.secretscalar_toBytesBE(retptr, this.__wbg_ptr); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
@@ -400,7 +400,2 @@ var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
export function __wbindgen_error_new(arg0, arg1) { | ||
const ret = new Error(getStringFromWasm0(arg0, arg1)); | ||
return addHeapObject(ret); | ||
}; | ||
export function __wbindgen_object_drop_ref(arg0) { | ||
@@ -419,2 +414,7 @@ takeObject(arg0); | ||
export function __wbindgen_error_new(arg0, arg1) { | ||
const ret = new Error(getStringFromWasm0(arg0, arg1)); | ||
return addHeapObject(ret); | ||
}; | ||
export function __wbindgen_is_string(arg0) { | ||
@@ -441,2 +441,7 @@ const ret = typeof(getObject(arg0)) === 'string'; | ||
export function __wbindgen_string_new(arg0, arg1) { | ||
const ret = getStringFromWasm0(arg0, arg1); | ||
return addHeapObject(ret); | ||
}; | ||
export function __wbindgen_jsval_loose_eq(arg0, arg1) { | ||
@@ -460,2 +465,10 @@ const ret = getObject(arg0) == getObject(arg1); | ||
export function __wbg_String_4370c5505c674d30(arg0, arg1) { | ||
const ret = String(getObject(arg1)); | ||
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
const len1 = WASM_VECTOR_LEN; | ||
getInt32Memory0()[arg0 / 4 + 1] = len1; | ||
getInt32Memory0()[arg0 / 4 + 0] = ptr1; | ||
}; | ||
export function __wbindgen_object_clone_ref(arg0) { | ||
@@ -466,7 +479,2 @@ const ret = getObject(arg0); | ||
export function __wbindgen_string_new(arg0, arg1) { | ||
const ret = getStringFromWasm0(arg0, arg1); | ||
return addHeapObject(ret); | ||
}; | ||
export function __wbg_getwithrefkey_d1f0d12f1f1b63ea(arg0, arg1) { | ||
@@ -481,10 +489,2 @@ const ret = getObject(arg0)[getObject(arg1)]; | ||
export function __wbg_String_4370c5505c674d30(arg0, arg1) { | ||
const ret = String(getObject(arg1)); | ||
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
const len1 = WASM_VECTOR_LEN; | ||
getInt32Memory0()[arg0 / 4 + 1] = len1; | ||
getInt32Memory0()[arg0 / 4 + 0] = ptr1; | ||
}; | ||
export function __wbg_crypto_c48a774b022d20ac(arg0) { | ||
@@ -491,0 +491,0 @@ const ret = getObject(arg0).crypto; |
@@ -76,5 +76,5 @@ /* tslint:disable */ | ||
* @param {any} response | ||
* @returns {SecretKey} | ||
* @returns {SecretScalar} | ||
*/ | ||
recoverSecretKey(response: any): SecretKey; | ||
recoverSecretKey(response: any): SecretScalar; | ||
} | ||
@@ -84,3 +84,3 @@ /** | ||
*/ | ||
export class SecretKey { | ||
export class SecretScalar { | ||
free(): void; | ||
@@ -87,0 +87,0 @@ /** |
@@ -5,3 +5,3 @@ { | ||
"description": "Cryptography code for exporting a key from Dfns", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"license": "MIT OR Apache-2.0", | ||
@@ -8,0 +8,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
414990