@dfns/dfns-key-export-nodejs
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -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 @@ /** |
let imports = {}; | ||
imports['__wbindgen_placeholder__'] = module.exports; | ||
let wasm; | ||
const { TextDecoder, TextEncoder } = require(`util`); | ||
const { TextEncoder, TextDecoder } = require(`util`); | ||
let cachedTextDecoder = new TextDecoder('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); | ||
@@ -28,15 +10,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) { | ||
@@ -56,2 +29,11 @@ if (idx < 132) return; | ||
let cachedUint8Memory0 = null; | ||
function getUint8Memory0() { | ||
if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { | ||
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); | ||
} | ||
return cachedUint8Memory0; | ||
} | ||
let cachedTextEncoder = new TextEncoder('utf-8'); | ||
@@ -123,2 +105,20 @@ | ||
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)); | ||
} | ||
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; | ||
@@ -328,3 +328,3 @@ | ||
* @param {any} response | ||
* @returns {SecretKey} | ||
* @returns {SecretScalar} | ||
*/ | ||
@@ -341,3 +341,3 @@ recoverSecretKey(response) { | ||
} | ||
return SecretKey.__wrap(r0); | ||
return SecretScalar.__wrap(r0); | ||
} finally { | ||
@@ -352,7 +352,7 @@ wasm.__wbindgen_add_to_stack_pointer(16); | ||
*/ | ||
class SecretKey { | ||
class SecretScalar { | ||
static __wrap(ptr) { | ||
ptr = ptr >>> 0; | ||
const obj = Object.create(SecretKey.prototype); | ||
const obj = Object.create(SecretScalar.prototype); | ||
obj.__wbg_ptr = ptr; | ||
@@ -372,3 +372,3 @@ | ||
const ptr = this.__destroy_into_raw(); | ||
wasm.__wbg_secretkey_free(ptr); | ||
wasm.__wbg_secretscalar_free(ptr); | ||
} | ||
@@ -382,3 +382,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]; | ||
@@ -394,9 +394,4 @@ var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
} | ||
module.exports.SecretKey = SecretKey; | ||
module.exports.SecretScalar = SecretScalar; | ||
module.exports.__wbindgen_error_new = function(arg0, arg1) { | ||
const ret = new Error(getStringFromWasm0(arg0, arg1)); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbindgen_object_drop_ref = function(arg0) { | ||
@@ -415,2 +410,7 @@ takeObject(arg0); | ||
module.exports.__wbindgen_error_new = function(arg0, arg1) { | ||
const ret = new Error(getStringFromWasm0(arg0, arg1)); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbindgen_is_string = function(arg0) { | ||
@@ -437,2 +437,7 @@ const ret = typeof(getObject(arg0)) === 'string'; | ||
module.exports.__wbindgen_string_new = function(arg0, arg1) { | ||
const ret = getStringFromWasm0(arg0, arg1); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbindgen_jsval_loose_eq = function(arg0, arg1) { | ||
@@ -456,2 +461,10 @@ const ret = getObject(arg0) == getObject(arg1); | ||
module.exports.__wbg_String_4370c5505c674d30 = function(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; | ||
}; | ||
module.exports.__wbindgen_object_clone_ref = function(arg0) { | ||
@@ -462,7 +475,2 @@ const ret = getObject(arg0); | ||
module.exports.__wbindgen_string_new = function(arg0, arg1) { | ||
const ret = getStringFromWasm0(arg0, arg1); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbg_getwithrefkey_d1f0d12f1f1b63ea = function(arg0, arg1) { | ||
@@ -477,10 +485,2 @@ const ret = getObject(arg0)[getObject(arg1)]; | ||
module.exports.__wbg_String_4370c5505c674d30 = function(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; | ||
}; | ||
module.exports.__wbg_crypto_c48a774b022d20ac = function(arg0) { | ||
@@ -487,0 +487,0 @@ const ret = getObject(arg0).crypto; |
{ | ||
"name": "@dfns/dfns-key-export-nodejs", | ||
"description": "Cryptography code for exporting a key from Dfns", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"license": "MIT OR Apache-2.0", | ||
@@ -6,0 +6,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
415549