tari_crypto
Advanced tools
Comparing version 0.14.0 to 0.16.1
@@ -7,3 +7,3 @@ { | ||
"description": "Tari Cryptography library", | ||
"version": "0.14.0", | ||
"version": "0.16.1", | ||
"license": "BSD-3-Clause", | ||
@@ -10,0 +10,0 @@ "repository": { |
@@ -14,3 +14,3 @@ # Tari Crypto | ||
- Generic Public and Secret Keys | ||
- [Musig!](https://blockstream.com/2018/01/23/musig-key-aggregation-schnorr-signatures/) | ||
- [Musig!](https://blockstream.com/2018/01/23/musig-key-aggregation-schnorr-signatures/) **NOT PRODUCTION READY** | ||
@@ -17,0 +17,0 @@ The `tari_crypto` crate makes heavy use of the excellent [Dalek](https://github.com/dalek-cryptography/curve25519-dalek) |
/* tslint:disable */ | ||
/* eslint-disable */ | ||
/** | ||
* Commits a value and blinding factor (private key) using a Pedersen commitment. Returns a | ||
* [JsValue] containing a serialized [CommitmentResult] | ||
* @param {string} key | ||
* @param {bigint} value | ||
* @returns {any} | ||
*/ | ||
export function commit(key: string, value: bigint): any; | ||
/** | ||
* Commits two private keys into a Pedersen commitment. | ||
* @param {string} key_1 | ||
* @param {string} key_2 | ||
* @returns {any} | ||
*/ | ||
export function commit_private_keys(key_1: string, key_2: string): any; | ||
/** | ||
* Checks whether the given key and value opens the commitment | ||
* @param {string} key | ||
* @param {bigint} value | ||
* @param {string} commitment | ||
* @returns {boolean} | ||
*/ | ||
export function opens(key: string, value: bigint, commitment: string): boolean; | ||
/** | ||
* Create an return a new private- public key pair | ||
@@ -40,3 +63,3 @@ * @returns {any} | ||
/** | ||
* Checks the validity of a Schnorr signature | ||
* Checks the validity of a Schnorr signature. Returns a [JsValue] of a serialized [SignatureVerifyResult] | ||
* @param {string} pub_nonce | ||
@@ -58,4 +81,4 @@ * @param {string} signature | ||
/** | ||
* Generate a Schnorr signature of a challenge (that has already been hashed) using the given private | ||
* key and a specified private nonce. DO NOT reuse nonces. This method is provide for cases where a | ||
* Generate a Commitment signature of a challenge (that has already been hashed) using the given private | ||
* key and a specified private nonce. DO NOT reuse nonces. This method is provided for cases where a | ||
* public nonce has been used | ||
@@ -72,3 +95,3 @@ * in the message. | ||
/** | ||
* Checks the validity of a Schnorr signature | ||
* Checks the validity of a Commitment signature | ||
* @param {string} pub_nonce_commitment | ||
@@ -83,2 +106,38 @@ * @param {string} signature_u | ||
/** | ||
* Generate a commitment and public key signature of the message using the given private keys | ||
* @param {string} private_key_a | ||
* @param {string} private_key_x | ||
* @param {string} private_key_y | ||
* @param {string} msg | ||
* @returns {any} | ||
*/ | ||
export function sign_comandpubsig(private_key_a: string, private_key_x: string, private_key_y: string, msg: string): any; | ||
/** | ||
* Generate a commitment and public key signature of a challenge (that has already been hashed) | ||
* using the given private keys and specified private nonces. DO NOT reuse nonces. This method | ||
* is provided for cases where public nonces have been used in the message. | ||
* @param {string} private_key_a | ||
* @param {string} private_key_x | ||
* @param {string} private_key_y | ||
* @param {string} private_nonce_a | ||
* @param {string} private_nonce_x | ||
* @param {string} private_nonce_y | ||
* @param {string} challenge_as_hex | ||
* @returns {any} | ||
*/ | ||
export function sign_comandpubsig_challenge_with_nonce(private_key_a: string, private_key_x: string, private_key_y: string, private_nonce_a: string, private_nonce_x: string, private_nonce_y: string, challenge_as_hex: string): any; | ||
/** | ||
* Checks the validity of a Commitment signature | ||
* @param {string} ephemeral_commitment | ||
* @param {string} ephemeral_pubkey | ||
* @param {string} u_a | ||
* @param {string} u_x | ||
* @param {string} u_y | ||
* @param {string} commitment | ||
* @param {string} pubkey | ||
* @param {string} msg | ||
* @returns {any} | ||
*/ | ||
export function check_comandpubsig_signature(ephemeral_commitment: string, ephemeral_pubkey: string, u_a: string, u_x: string, u_y: string, commitment: string, pubkey: string, msg: string): any; | ||
/** | ||
* Create a secret key modulo the Ristretto prime group order using the given little-endian byte array represented as a | ||
@@ -115,24 +174,3 @@ * hex string. If the hex string does not represent 32 bytes the function will return false | ||
/** | ||
* Commits a value and blinding factor (private key) using a Pedersen commitment. | ||
* @param {string} key | ||
* @param {BigInt} value | ||
* @returns {any} | ||
*/ | ||
export function commit(key: string, value: BigInt): any; | ||
/** | ||
* Commits two private keys into a Pedersen commitment. | ||
* @param {string} key_1 | ||
* @param {string} key_2 | ||
* @returns {any} | ||
*/ | ||
export function commit_private_keys(key_1: string, key_2: string): any; | ||
/** | ||
* Checks whether the given key and value opens the commitment | ||
* @param {string} key | ||
* @param {BigInt} value | ||
* @param {string} commitment | ||
* @returns {boolean} | ||
*/ | ||
export function opens(key: string, value: BigInt, commitment: string): boolean; | ||
/** | ||
* The version of this library | ||
* @returns {string} | ||
@@ -142,2 +180,3 @@ */ | ||
/** | ||
* A factory to prove and verify extended range proofs | ||
*/ | ||
@@ -154,6 +193,6 @@ export class ExtendedRangeProofFactory { | ||
* @param {string} key | ||
* @param {BigInt} value | ||
* @param {bigint} value | ||
* @returns {any} | ||
*/ | ||
create_proof(key: string, value: BigInt): any; | ||
create_proof(key: string, value: bigint): any; | ||
/** | ||
@@ -167,9 +206,11 @@ * Verifies the given range proof and commitment. | ||
/** | ||
* Construct a proof with a recovery seed nonce | ||
* @param {string} mask | ||
* @param {BigInt} value | ||
* @param {bigint} value | ||
* @param {string} seed_nonce | ||
* @returns {any} | ||
*/ | ||
construct_proof_with_recovery_seed_nonce(mask: string, value: BigInt, seed_nonce: string): any; | ||
construct_proof_with_recovery_seed_nonce(mask: string, value: bigint, seed_nonce: string): any; | ||
/** | ||
* Recover a mask from a proof | ||
* @param {string} proof | ||
@@ -182,8 +223,9 @@ * @param {string} commitment | ||
/** | ||
* Verify that a mask and value is the one used in a proof | ||
* @param {string} commitment | ||
* @param {string} mask | ||
* @param {BigInt} value | ||
* @param {bigint} value | ||
* @returns {any} | ||
*/ | ||
verify_mask(commitment: string, mask: string, value: BigInt): any; | ||
verify_mask(commitment: string, mask: string, value: bigint): any; | ||
} | ||
@@ -265,16 +307,17 @@ /** | ||
* @param {string} id | ||
* @param {BigInt} value | ||
* @param {bigint} value | ||
* @returns {any} | ||
*/ | ||
commit(id: string, value: BigInt): any; | ||
commit(id: string, value: bigint): any; | ||
/** | ||
* Checks whether the key for the given id and value opens the commitment | ||
* @param {string} id | ||
* @param {BigInt} value | ||
* @param {bigint} value | ||
* @param {string} commitment | ||
* @returns {boolean} | ||
*/ | ||
opens(id: string, value: BigInt, commitment: string): boolean; | ||
opens(id: string, value: bigint, commitment: string): boolean; | ||
} | ||
/** | ||
* A factory to prove and verify range proofs | ||
*/ | ||
@@ -289,10 +332,11 @@ export class RangeProofFactory { | ||
/** | ||
* Creates a new range proof for the given key-value pair. | ||
* Creates a new range proof for the given key-value pair. Returns a [JsValue] of a serialized | ||
* [RangeProofResult] | ||
* @param {string} key | ||
* @param {BigInt} value | ||
* @param {bigint} value | ||
* @returns {any} | ||
*/ | ||
create_proof(key: string, value: BigInt): any; | ||
create_proof(key: string, value: bigint): any; | ||
/** | ||
* Verifies the given range proof and commitment. | ||
* Verifies the given range proof and commitment. Returns a [JsValue] of a serialized [VerificationResult] | ||
* @param {string} commitment | ||
@@ -299,0 +343,0 @@ * @param {string} proof |
@@ -10,8 +10,9 @@ let imports = {}; | ||
let cachegetUint8Memory0 = null; | ||
let cachedUint8Memory0 = new Uint8Array(); | ||
function getUint8Memory0() { | ||
if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) { | ||
cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer); | ||
if (cachedUint8Memory0.byteLength === 0) { | ||
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); | ||
} | ||
return cachegetUint8Memory0; | ||
return cachedUint8Memory0; | ||
} | ||
@@ -51,11 +52,68 @@ | ||
} | ||
/** | ||
* Create an return a new private- public key pair | ||
* @returns {any} | ||
*/ | ||
module.exports.generate_keypair = function() { | ||
const ret = wasm.generate_keypair(); | ||
return takeObject(ret); | ||
}; | ||
function debugString(val) { | ||
// primitive types | ||
const type = typeof val; | ||
if (type == 'number' || type == 'boolean' || val == null) { | ||
return `${val}`; | ||
} | ||
if (type == 'string') { | ||
return `"${val}"`; | ||
} | ||
if (type == 'symbol') { | ||
const description = val.description; | ||
if (description == null) { | ||
return 'Symbol'; | ||
} else { | ||
return `Symbol(${description})`; | ||
} | ||
} | ||
if (type == 'function') { | ||
const name = val.name; | ||
if (typeof name == 'string' && name.length > 0) { | ||
return `Function(${name})`; | ||
} else { | ||
return 'Function'; | ||
} | ||
} | ||
// objects | ||
if (Array.isArray(val)) { | ||
const length = val.length; | ||
let debug = '['; | ||
if (length > 0) { | ||
debug += debugString(val[0]); | ||
} | ||
for(let i = 1; i < length; i++) { | ||
debug += ', ' + debugString(val[i]); | ||
} | ||
debug += ']'; | ||
return debug; | ||
} | ||
// Test for built-in | ||
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val)); | ||
let className; | ||
if (builtInMatches.length > 1) { | ||
className = builtInMatches[1]; | ||
} else { | ||
// Failed to match the standard '[object ClassName]' | ||
return toString.call(val); | ||
} | ||
if (className == 'Object') { | ||
// we're a user defined class or Object | ||
// JSON.stringify avoids problems with cycles, and is generally much | ||
// easier than looping through ownProperties of `val`. | ||
try { | ||
return 'Object(' + JSON.stringify(val) + ')'; | ||
} catch (_) { | ||
return 'Object'; | ||
} | ||
} | ||
// errors | ||
if (val instanceof Error) { | ||
return `${val.name}: ${val.message}\n${val.stack}`; | ||
} | ||
// TODO we could test for more things here, like `Set`s and `Map`s. | ||
return className; | ||
} | ||
let WASM_VECTOR_LEN = 0; | ||
@@ -115,3 +173,66 @@ | ||
} | ||
let cachedInt32Memory0 = new Int32Array(); | ||
function getInt32Memory0() { | ||
if (cachedInt32Memory0.byteLength === 0) { | ||
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer); | ||
} | ||
return cachedInt32Memory0; | ||
} | ||
/** | ||
* Commits a value and blinding factor (private key) using a Pedersen commitment. Returns a | ||
* [JsValue] containing a serialized [CommitmentResult] | ||
* @param {string} key | ||
* @param {bigint} value | ||
* @returns {any} | ||
*/ | ||
module.exports.commit = function(key, value) { | ||
const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
const ret = wasm.commit(ptr0, len0, value); | ||
return takeObject(ret); | ||
}; | ||
/** | ||
* Commits two private keys into a Pedersen commitment. | ||
* @param {string} key_1 | ||
* @param {string} key_2 | ||
* @returns {any} | ||
*/ | ||
module.exports.commit_private_keys = function(key_1, key_2) { | ||
const ptr0 = passStringToWasm0(key_1, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
const ptr1 = passStringToWasm0(key_2, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
const len1 = WASM_VECTOR_LEN; | ||
const ret = wasm.commit_private_keys(ptr0, len0, ptr1, len1); | ||
return takeObject(ret); | ||
}; | ||
/** | ||
* Checks whether the given key and value opens the commitment | ||
* @param {string} key | ||
* @param {bigint} value | ||
* @param {string} commitment | ||
* @returns {boolean} | ||
*/ | ||
module.exports.opens = function(key, value, commitment) { | ||
const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
const ptr1 = passStringToWasm0(commitment, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
const len1 = WASM_VECTOR_LEN; | ||
const ret = wasm.opens(ptr0, len0, value, ptr1, len1); | ||
return ret !== 0; | ||
}; | ||
/** | ||
* Create an return a new private- public key pair | ||
* @returns {any} | ||
*/ | ||
module.exports.generate_keypair = function() { | ||
const ret = wasm.generate_keypair(); | ||
return takeObject(ret); | ||
}; | ||
/** | ||
* Returns a public key object from a public key hex string, or false if the hex string does not represent a valid | ||
@@ -129,9 +250,2 @@ * public key | ||
let cachegetInt32Memory0 = null; | ||
function getInt32Memory0() { | ||
if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) { | ||
cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer); | ||
} | ||
return cachegetInt32Memory0; | ||
} | ||
/** | ||
@@ -198,3 +312,3 @@ * Calculate the public key associated with a private key. If the input is not a valid hex string representing a | ||
/** | ||
* Checks the validity of a Schnorr signature | ||
* Checks the validity of a Schnorr signature. Returns a [JsValue] of a serialized [SignatureVerifyResult] | ||
* @param {string} pub_nonce | ||
@@ -238,4 +352,4 @@ * @param {string} signature | ||
/** | ||
* Generate a Schnorr signature of a challenge (that has already been hashed) using the given private | ||
* key and a specified private nonce. DO NOT reuse nonces. This method is provide for cases where a | ||
* Generate a Commitment signature of a challenge (that has already been hashed) using the given private | ||
* key and a specified private nonce. DO NOT reuse nonces. This method is provided for cases where a | ||
* public nonce has been used | ||
@@ -266,3 +380,3 @@ * in the message. | ||
/** | ||
* Checks the validity of a Schnorr signature | ||
* Checks the validity of a Commitment signature | ||
* @param {string} pub_nonce_commitment | ||
@@ -291,2 +405,88 @@ * @param {string} signature_u | ||
/** | ||
* Generate a commitment and public key signature of the message using the given private keys | ||
* @param {string} private_key_a | ||
* @param {string} private_key_x | ||
* @param {string} private_key_y | ||
* @param {string} msg | ||
* @returns {any} | ||
*/ | ||
module.exports.sign_comandpubsig = function(private_key_a, private_key_x, private_key_y, msg) { | ||
const ptr0 = passStringToWasm0(private_key_a, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
const ptr1 = passStringToWasm0(private_key_x, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
const len1 = WASM_VECTOR_LEN; | ||
const ptr2 = passStringToWasm0(private_key_y, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
const len2 = WASM_VECTOR_LEN; | ||
const ptr3 = passStringToWasm0(msg, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
const len3 = WASM_VECTOR_LEN; | ||
const ret = wasm.sign_comandpubsig(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3); | ||
return takeObject(ret); | ||
}; | ||
/** | ||
* Generate a commitment and public key signature of a challenge (that has already been hashed) | ||
* using the given private keys and specified private nonces. DO NOT reuse nonces. This method | ||
* is provided for cases where public nonces have been used in the message. | ||
* @param {string} private_key_a | ||
* @param {string} private_key_x | ||
* @param {string} private_key_y | ||
* @param {string} private_nonce_a | ||
* @param {string} private_nonce_x | ||
* @param {string} private_nonce_y | ||
* @param {string} challenge_as_hex | ||
* @returns {any} | ||
*/ | ||
module.exports.sign_comandpubsig_challenge_with_nonce = function(private_key_a, private_key_x, private_key_y, private_nonce_a, private_nonce_x, private_nonce_y, challenge_as_hex) { | ||
const ptr0 = passStringToWasm0(private_key_a, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
const ptr1 = passStringToWasm0(private_key_x, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
const len1 = WASM_VECTOR_LEN; | ||
const ptr2 = passStringToWasm0(private_key_y, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
const len2 = WASM_VECTOR_LEN; | ||
const ptr3 = passStringToWasm0(private_nonce_a, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
const len3 = WASM_VECTOR_LEN; | ||
const ptr4 = passStringToWasm0(private_nonce_x, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
const len4 = WASM_VECTOR_LEN; | ||
const ptr5 = passStringToWasm0(private_nonce_y, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
const len5 = WASM_VECTOR_LEN; | ||
const ptr6 = passStringToWasm0(challenge_as_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
const len6 = WASM_VECTOR_LEN; | ||
const ret = wasm.sign_comandpubsig_challenge_with_nonce(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6); | ||
return takeObject(ret); | ||
}; | ||
/** | ||
* Checks the validity of a Commitment signature | ||
* @param {string} ephemeral_commitment | ||
* @param {string} ephemeral_pubkey | ||
* @param {string} u_a | ||
* @param {string} u_x | ||
* @param {string} u_y | ||
* @param {string} commitment | ||
* @param {string} pubkey | ||
* @param {string} msg | ||
* @returns {any} | ||
*/ | ||
module.exports.check_comandpubsig_signature = function(ephemeral_commitment, ephemeral_pubkey, u_a, u_x, u_y, commitment, pubkey, msg) { | ||
const ptr0 = passStringToWasm0(ephemeral_commitment, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
const ptr1 = passStringToWasm0(ephemeral_pubkey, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
const len1 = WASM_VECTOR_LEN; | ||
const ptr2 = passStringToWasm0(u_a, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
const len2 = WASM_VECTOR_LEN; | ||
const ptr3 = passStringToWasm0(u_x, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
const len3 = WASM_VECTOR_LEN; | ||
const ptr4 = passStringToWasm0(u_y, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
const len4 = WASM_VECTOR_LEN; | ||
const ptr5 = passStringToWasm0(commitment, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
const len5 = WASM_VECTOR_LEN; | ||
const ptr6 = passStringToWasm0(pubkey, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
const len6 = WASM_VECTOR_LEN; | ||
const ptr7 = passStringToWasm0(msg, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
const len7 = WASM_VECTOR_LEN; | ||
const ret = wasm.check_comandpubsig_signature(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7); | ||
return takeObject(ret); | ||
}; | ||
/** | ||
* Create a secret key modulo the Ristretto prime group order using the given little-endian byte array represented as a | ||
@@ -352,56 +552,4 @@ * hex string. If the hex string does not represent 32 bytes the function will return false | ||
const u32CvtShim = new Uint32Array(2); | ||
const uint64CvtShim = new BigUint64Array(u32CvtShim.buffer); | ||
/** | ||
* Commits a value and blinding factor (private key) using a Pedersen commitment. | ||
* @param {string} key | ||
* @param {BigInt} value | ||
* @returns {any} | ||
*/ | ||
module.exports.commit = function(key, value) { | ||
const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
uint64CvtShim[0] = value; | ||
const low1 = u32CvtShim[0]; | ||
const high1 = u32CvtShim[1]; | ||
const ret = wasm.commit(ptr0, len0, low1, high1); | ||
return takeObject(ret); | ||
}; | ||
/** | ||
* Commits two private keys into a Pedersen commitment. | ||
* @param {string} key_1 | ||
* @param {string} key_2 | ||
* @returns {any} | ||
*/ | ||
module.exports.commit_private_keys = function(key_1, key_2) { | ||
const ptr0 = passStringToWasm0(key_1, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
const ptr1 = passStringToWasm0(key_2, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
const len1 = WASM_VECTOR_LEN; | ||
const ret = wasm.commit_private_keys(ptr0, len0, ptr1, len1); | ||
return takeObject(ret); | ||
}; | ||
/** | ||
* Checks whether the given key and value opens the commitment | ||
* @param {string} key | ||
* @param {BigInt} value | ||
* @param {string} commitment | ||
* @returns {boolean} | ||
*/ | ||
module.exports.opens = function(key, value, commitment) { | ||
const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
uint64CvtShim[0] = value; | ||
const low1 = u32CvtShim[0]; | ||
const high1 = u32CvtShim[1]; | ||
const ptr2 = passStringToWasm0(commitment, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
const len2 = WASM_VECTOR_LEN; | ||
const ret = wasm.opens(ptr0, len0, low1, high1, ptr2, len2); | ||
return ret !== 0; | ||
}; | ||
/** | ||
* The version of this library | ||
* @returns {string} | ||
@@ -434,2 +582,3 @@ */ | ||
/** | ||
* A factory to prove and verify extended range proofs | ||
*/ | ||
@@ -467,3 +616,3 @@ class ExtendedRangeProofFactory { | ||
* @param {string} key | ||
* @param {BigInt} value | ||
* @param {bigint} value | ||
* @returns {any} | ||
@@ -474,6 +623,3 @@ */ | ||
const len0 = WASM_VECTOR_LEN; | ||
uint64CvtShim[0] = value; | ||
const low1 = u32CvtShim[0]; | ||
const high1 = u32CvtShim[1]; | ||
const ret = wasm.extendedrangeprooffactory_create_proof(this.ptr, ptr0, len0, low1, high1); | ||
const ret = wasm.extendedrangeprooffactory_create_proof(this.ptr, ptr0, len0, value); | ||
return takeObject(ret); | ||
@@ -496,4 +642,5 @@ } | ||
/** | ||
* Construct a proof with a recovery seed nonce | ||
* @param {string} mask | ||
* @param {BigInt} value | ||
* @param {bigint} value | ||
* @param {string} seed_nonce | ||
@@ -505,11 +652,9 @@ * @returns {any} | ||
const len0 = WASM_VECTOR_LEN; | ||
uint64CvtShim[0] = value; | ||
const low1 = u32CvtShim[0]; | ||
const high1 = u32CvtShim[1]; | ||
const ptr2 = passStringToWasm0(seed_nonce, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
const len2 = WASM_VECTOR_LEN; | ||
const ret = wasm.extendedrangeprooffactory_construct_proof_with_recovery_seed_nonce(this.ptr, ptr0, len0, low1, high1, ptr2, len2); | ||
const ptr1 = passStringToWasm0(seed_nonce, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
const len1 = WASM_VECTOR_LEN; | ||
const ret = wasm.extendedrangeprooffactory_construct_proof_with_recovery_seed_nonce(this.ptr, ptr0, len0, value, ptr1, len1); | ||
return takeObject(ret); | ||
} | ||
/** | ||
* Recover a mask from a proof | ||
* @param {string} proof | ||
@@ -531,5 +676,6 @@ * @param {string} commitment | ||
/** | ||
* Verify that a mask and value is the one used in a proof | ||
* @param {string} commitment | ||
* @param {string} mask | ||
* @param {BigInt} value | ||
* @param {bigint} value | ||
* @returns {any} | ||
@@ -542,6 +688,3 @@ */ | ||
const len1 = WASM_VECTOR_LEN; | ||
uint64CvtShim[0] = value; | ||
const low2 = u32CvtShim[0]; | ||
const high2 = u32CvtShim[1]; | ||
const ret = wasm.extendedrangeprooffactory_verify_mask(this.ptr, ptr0, len0, ptr1, len1, low2, high2); | ||
const ret = wasm.extendedrangeprooffactory_verify_mask(this.ptr, ptr0, len0, ptr1, len1, value); | ||
return takeObject(ret); | ||
@@ -708,3 +851,3 @@ } | ||
* @param {string} id | ||
* @param {BigInt} value | ||
* @param {bigint} value | ||
* @returns {any} | ||
@@ -715,6 +858,3 @@ */ | ||
const len0 = WASM_VECTOR_LEN; | ||
uint64CvtShim[0] = value; | ||
const low1 = u32CvtShim[0]; | ||
const high1 = u32CvtShim[1]; | ||
const ret = wasm.keyring_commit(this.ptr, ptr0, len0, low1, high1); | ||
const ret = wasm.keyring_commit(this.ptr, ptr0, len0, value); | ||
return takeObject(ret); | ||
@@ -725,3 +865,3 @@ } | ||
* @param {string} id | ||
* @param {BigInt} value | ||
* @param {bigint} value | ||
* @param {string} commitment | ||
@@ -733,8 +873,5 @@ * @returns {boolean} | ||
const len0 = WASM_VECTOR_LEN; | ||
uint64CvtShim[0] = value; | ||
const low1 = u32CvtShim[0]; | ||
const high1 = u32CvtShim[1]; | ||
const ptr2 = passStringToWasm0(commitment, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
const len2 = WASM_VECTOR_LEN; | ||
const ret = wasm.keyring_opens(this.ptr, ptr0, len0, low1, high1, ptr2, len2); | ||
const ptr1 = passStringToWasm0(commitment, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
const len1 = WASM_VECTOR_LEN; | ||
const ret = wasm.keyring_opens(this.ptr, ptr0, len0, value, ptr1, len1); | ||
return ret !== 0; | ||
@@ -745,2 +882,3 @@ } | ||
/** | ||
* A factory to prove and verify range proofs | ||
*/ | ||
@@ -776,5 +914,6 @@ class RangeProofFactory { | ||
/** | ||
* Creates a new range proof for the given key-value pair. | ||
* Creates a new range proof for the given key-value pair. Returns a [JsValue] of a serialized | ||
* [RangeProofResult] | ||
* @param {string} key | ||
* @param {BigInt} value | ||
* @param {bigint} value | ||
* @returns {any} | ||
@@ -785,10 +924,7 @@ */ | ||
const len0 = WASM_VECTOR_LEN; | ||
uint64CvtShim[0] = value; | ||
const low1 = u32CvtShim[0]; | ||
const high1 = u32CvtShim[1]; | ||
const ret = wasm.rangeprooffactory_create_proof(this.ptr, ptr0, len0, low1, high1); | ||
const ret = wasm.rangeprooffactory_create_proof(this.ptr, ptr0, len0, value); | ||
return takeObject(ret); | ||
} | ||
/** | ||
* Verifies the given range proof and commitment. | ||
* Verifies the given range proof and commitment. Returns a [JsValue] of a serialized [VerificationResult] | ||
* @param {string} commitment | ||
@@ -814,46 +950,34 @@ * @param {string} proof | ||
module.exports.__wbg_getRandomValues_98117e9a7e993920 = function() { return handleError(function (arg0, arg1) { | ||
getObject(arg0).getRandomValues(getObject(arg1)); | ||
}, arguments) }; | ||
module.exports.__wbindgen_object_drop_ref = function(arg0) { | ||
takeObject(arg0); | ||
}; | ||
module.exports.__wbg_randomFillSync_64cc7d048f228ca8 = function() { return handleError(function (arg0, arg1, arg2) { | ||
getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2)); | ||
}, arguments) }; | ||
module.exports.__wbg_process_2f24d6544ea7b200 = function(arg0) { | ||
const ret = getObject(arg0).process; | ||
module.exports.__wbindgen_object_clone_ref = function(arg0) { | ||
const ret = getObject(arg0); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbindgen_is_object = function(arg0) { | ||
const val = getObject(arg0); | ||
const ret = typeof(val) === 'object' && val !== null; | ||
return ret; | ||
}; | ||
module.exports.__wbg_versions_6164651e75405d4a = function(arg0) { | ||
const ret = getObject(arg0).versions; | ||
module.exports.__wbindgen_string_new = function(arg0, arg1) { | ||
const ret = getStringFromWasm0(arg0, arg1); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbindgen_object_drop_ref = function(arg0) { | ||
takeObject(arg0); | ||
module.exports.__wbg_set_20cbc34131e76824 = function(arg0, arg1, arg2) { | ||
getObject(arg0)[takeObject(arg1)] = takeObject(arg2); | ||
}; | ||
module.exports.__wbg_node_4b517d861cbcb3bc = function(arg0) { | ||
const ret = getObject(arg0).node; | ||
return addHeapObject(ret); | ||
module.exports.__wbg_randomFillSync_85b3f4c52c56c313 = function(arg0, arg1, arg2) { | ||
getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2)); | ||
}; | ||
module.exports.__wbindgen_is_string = function(arg0) { | ||
const ret = typeof(getObject(arg0)) === 'string'; | ||
return ret; | ||
module.exports.__wbg_getRandomValues_cd175915511f705e = function(arg0, arg1) { | ||
getObject(arg0).getRandomValues(getObject(arg1)); | ||
}; | ||
module.exports.__wbg_modulerequire_3440a4bcf44437db = function() { return handleError(function (arg0, arg1) { | ||
const ret = module.require(getStringFromWasm0(arg0, arg1)); | ||
module.exports.__wbg_self_7eede1f4488bf346 = function() { return handleError(function () { | ||
const ret = self.self; | ||
return addHeapObject(ret); | ||
}, arguments) }; | ||
module.exports.__wbg_crypto_98fc271021c7d2ad = function(arg0) { | ||
module.exports.__wbg_crypto_c909fb428dcbddb6 = function(arg0) { | ||
const ret = getObject(arg0).crypto; | ||
@@ -863,3 +987,3 @@ return addHeapObject(ret); | ||
module.exports.__wbg_msCrypto_a2cdb043d2bfe57f = function(arg0) { | ||
module.exports.__wbg_msCrypto_511eefefbfc70ae4 = function(arg0) { | ||
const ret = getObject(arg0).msCrypto; | ||
@@ -869,43 +993,37 @@ return addHeapObject(ret); | ||
module.exports.__wbg_newnoargs_e23b458e372830de = function(arg0, arg1) { | ||
const ret = new Function(getStringFromWasm0(arg0, arg1)); | ||
return addHeapObject(ret); | ||
module.exports.__wbindgen_is_undefined = function(arg0) { | ||
const ret = getObject(arg0) === undefined; | ||
return ret; | ||
}; | ||
module.exports.__wbg_call_ae78342adc33730a = function() { return handleError(function (arg0, arg1) { | ||
const ret = getObject(arg0).call(getObject(arg1)); | ||
module.exports.__wbg_static_accessor_MODULE_ef3aa2eb251158a5 = function() { | ||
const ret = module; | ||
return addHeapObject(ret); | ||
}, arguments) }; | ||
}; | ||
module.exports.__wbindgen_object_clone_ref = function(arg0) { | ||
const ret = getObject(arg0); | ||
module.exports.__wbg_require_900d5c3984fe7703 = function(arg0, arg1, arg2) { | ||
const ret = getObject(arg0).require(getStringFromWasm0(arg1, arg2)); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbg_self_99737b4dcdf6f0d8 = function() { return handleError(function () { | ||
const ret = self.self; | ||
module.exports.__wbg_getRandomValues_307049345d0bd88c = function(arg0) { | ||
const ret = getObject(arg0).getRandomValues; | ||
return addHeapObject(ret); | ||
}, arguments) }; | ||
}; | ||
module.exports.__wbg_window_9b61fbbf3564c4fb = function() { return handleError(function () { | ||
const ret = window.window; | ||
module.exports.__wbg_new_53ee626301534885 = function() { | ||
const ret = new Array(); | ||
return addHeapObject(ret); | ||
}, arguments) }; | ||
}; | ||
module.exports.__wbg_globalThis_8e275ef40caea3a3 = function() { return handleError(function () { | ||
const ret = globalThis.globalThis; | ||
module.exports.__wbg_new_08af39e773e3ddfb = function() { | ||
const ret = new Object(); | ||
return addHeapObject(ret); | ||
}, arguments) }; | ||
}; | ||
module.exports.__wbg_global_5de1e0f82bddcd27 = function() { return handleError(function () { | ||
const ret = global.global; | ||
return addHeapObject(ret); | ||
}, arguments) }; | ||
module.exports.__wbindgen_is_undefined = function(arg0) { | ||
const ret = getObject(arg0) === undefined; | ||
return ret; | ||
module.exports.__wbg_set_63dece82a2a32010 = function(arg0, arg1, arg2) { | ||
getObject(arg0)[arg1 >>> 0] = takeObject(arg2); | ||
}; | ||
module.exports.__wbg_buffer_7af23f65f6c64548 = function(arg0) { | ||
module.exports.__wbg_buffer_d81727464c886f26 = function(arg0) { | ||
const ret = getObject(arg0).buffer; | ||
@@ -915,3 +1033,3 @@ return addHeapObject(ret); | ||
module.exports.__wbg_new_cc9018bd6f283b6f = function(arg0) { | ||
module.exports.__wbg_new_a3125f766f3a92ac = function(arg0) { | ||
const ret = new Uint8Array(getObject(arg0)); | ||
@@ -921,7 +1039,7 @@ return addHeapObject(ret); | ||
module.exports.__wbg_set_f25e869e4565d2a2 = function(arg0, arg1, arg2) { | ||
module.exports.__wbg_set_51d981ee0f618b95 = function(arg0, arg1, arg2) { | ||
getObject(arg0).set(getObject(arg1), arg2 >>> 0); | ||
}; | ||
module.exports.__wbg_length_0acb1cf9bbaf8519 = function(arg0) { | ||
module.exports.__wbg_length_43d4584cbc8565d1 = function(arg0) { | ||
const ret = getObject(arg0).length; | ||
@@ -931,3 +1049,3 @@ return ret; | ||
module.exports.__wbg_newwithlength_8f0657faca9f1422 = function(arg0) { | ||
module.exports.__wbg_newwithlength_4928c68e52c56b6d = function(arg0) { | ||
const ret = new Uint8Array(arg0 >>> 0); | ||
@@ -937,3 +1055,3 @@ return addHeapObject(ret); | ||
module.exports.__wbg_subarray_da527dbd24eafb6b = function(arg0, arg1, arg2) { | ||
module.exports.__wbg_subarray_2f6b60a6e0c8bb7b = function(arg0, arg1, arg2) { | ||
const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0); | ||
@@ -943,2 +1061,10 @@ return addHeapObject(ret); | ||
module.exports.__wbindgen_debug_string = function(arg0, arg1) { | ||
const ret = debugString(getObject(arg1)); | ||
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; | ||
}; | ||
module.exports.__wbindgen_throw = function(arg0, arg1) { | ||
@@ -945,0 +1071,0 @@ throw new Error(getStringFromWasm0(arg0, arg1)); |
Sorry, the diff of this file is not supported yet
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
647826
6
1298
0