@nillion/client-wasm
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -1,3 +0,3 @@ | ||
fc616154927592db88c47048f7723b7acb6d13a8 | ||
v0.7.0-rc.55 | ||
Wed Nov 13 23:06:56 2024 +0000 | ||
1b8507a2d1e79155895f6d99808862a3e130bdf2 | ||
v0.9.0-rc.17 | ||
Wed Dec 16 14:43:02 2024 +0000 |
@@ -322,2 +322,70 @@ let wasm; | ||
const EcdsaSignatureFinalization = (typeof FinalizationRegistry === 'undefined') | ||
? { register: () => {}, unregister: () => {} } | ||
: new FinalizationRegistry(ptr => wasm.__wbg_ecdsasignature_free(ptr >>> 0)); | ||
/** | ||
* A ecdsa signature | ||
*/ | ||
export class EcdsaSignature { | ||
static __wrap(ptr) { | ||
ptr = ptr >>> 0; | ||
const obj = Object.create(EcdsaSignature.prototype); | ||
obj.__wbg_ptr = ptr; | ||
EcdsaSignatureFinalization.register(obj, obj.__wbg_ptr, obj); | ||
return obj; | ||
} | ||
toJSON() { | ||
return { | ||
}; | ||
} | ||
toString() { | ||
return JSON.stringify(this); | ||
} | ||
__destroy_into_raw() { | ||
const ptr = this.__wbg_ptr; | ||
this.__wbg_ptr = 0; | ||
EcdsaSignatureFinalization.unregister(this); | ||
return ptr; | ||
} | ||
free() { | ||
const ptr = this.__destroy_into_raw(); | ||
wasm.__wbg_ecdsasignature_free(ptr); | ||
} | ||
/** | ||
* Construct a new instance the components. | ||
* @param {Uint8Array} r | ||
* @param {Uint8Array} s | ||
*/ | ||
constructor(r, s) { | ||
const ptr0 = passArray8ToWasm0(r, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
const ptr1 = passArray8ToWasm0(s, wasm.__wbindgen_malloc); | ||
const len1 = WASM_VECTOR_LEN; | ||
const ret = wasm.ecdsasignature_new(ptr0, len0, ptr1, len1); | ||
this.__wbg_ptr = ret >>> 0; | ||
return this; | ||
} | ||
/** | ||
* Access r component of the signature | ||
* @returns {Uint8Array} | ||
*/ | ||
r() { | ||
const ret = wasm.ecdsasignature_r(this.__wbg_ptr); | ||
return takeObject(ret); | ||
} | ||
/** | ||
* Access s component of the signature | ||
* @returns {Uint8Array} | ||
*/ | ||
s() { | ||
const ret = wasm.ecdsasignature_s(this.__wbg_ptr); | ||
return takeObject(ret); | ||
} | ||
} | ||
const EncryptedNadaValuesFinalization = (typeof FinalizationRegistry === 'undefined') | ||
@@ -514,2 +582,83 @@ ? { register: () => {}, unregister: () => {} } | ||
/** | ||
* Create a new ecdsa private key | ||
* | ||
* @param {Uint8Array} value - The ecdsa private key in binary (byte array) encoded format | ||
* @return {NadaValue} The encoded secret corresponding to the value provided | ||
* | ||
* @example | ||
* const value = NadaValue.new_ecdsa_private_key([1,0,1,222,21,...]); | ||
*/ | ||
static new_ecdsa_private_key(value) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
const ptr0 = passArray8ToWasm0(value, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.nadavalue_new_ecdsa_private_key(retptr, ptr0, len0); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
if (r2) { | ||
throw takeObject(r1); | ||
} | ||
return NadaValue.__wrap(r0); | ||
} finally { | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
} | ||
} | ||
/** | ||
* Create a new ecdsa digest message. | ||
* | ||
* @param {Uint8Array} value - The ecdsa digest message in binary (byte array) encoded format | ||
* @return {NadaValue} The encoded secret corresponding to the value provided | ||
* | ||
* @example | ||
* const value = NadaValue.new_ecdsa_digest_message([1,0,1,222,21,...]); | ||
*/ | ||
static new_ecdsa_digest_message(value) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
const ptr0 = passArray8ToWasm0(value, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.nadavalue_new_ecdsa_digest_message(retptr, ptr0, len0); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
if (r2) { | ||
throw takeObject(r1); | ||
} | ||
return NadaValue.__wrap(r0); | ||
} finally { | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
} | ||
} | ||
/** | ||
* Create a new ecdsa signature. | ||
* | ||
* @param {Uint8Array} r - The r component of the signature in binary (byte array) encoded format | ||
* @param {Uint8Array} s - The s component of the signature in binary (byte array) encoded format | ||
* @return {NadaValue} The encoded secret corresponding to the value provided | ||
* | ||
* @example | ||
* const value = NadaValue::new_ecdsa_signature(EcdsaSignature { r, s }); | ||
*/ | ||
static new_ecdsa_signature(r, s) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
const ptr0 = passArray8ToWasm0(r, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
const ptr1 = passArray8ToWasm0(s, wasm.__wbindgen_malloc); | ||
const len1 = WASM_VECTOR_LEN; | ||
wasm.nadavalue_new_ecdsa_signature(retptr, ptr0, len0, ptr1, len1); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
if (r2) { | ||
throw takeObject(r1); | ||
} | ||
return NadaValue.__wrap(r0); | ||
} finally { | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
} | ||
} | ||
/** | ||
* Convert this value into a byte array. | ||
@@ -523,8 +672,9 @@ * | ||
* const value = NadaValue.new_secret_blob([1,0,1,222,21]); | ||
* const byteArray = value.to_byte_array(); | ||
* const byteArray = value.into_byte_array(); | ||
*/ | ||
to_byte_array() { | ||
into_byte_array() { | ||
try { | ||
const ptr = this.__destroy_into_raw(); | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
wasm.nadavalue_to_byte_array(retptr, this.__wbg_ptr); | ||
wasm.nadavalue_into_byte_array(retptr, ptr); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
@@ -545,2 +695,29 @@ var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
/** | ||
* Convert this value into a byte array. | ||
* | ||
* This is only valid for secret blob values. | ||
* @return {Uint8Array} the byte array contained in this value. | ||
* @throws {Error} if the value is not a secret blob. | ||
* | ||
* @example | ||
* const value = NadaValue.new_secret_blob([1,0,1,222,21]); | ||
* const byteArray = value.into_byte_array(); | ||
*/ | ||
try_into_signature() { | ||
try { | ||
const ptr = this.__destroy_into_raw(); | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
wasm.nadavalue_try_into_signature(retptr, ptr); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
if (r2) { | ||
throw takeObject(r1); | ||
} | ||
return EcdsaSignature.__wrap(r0); | ||
} finally { | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
} | ||
} | ||
/** | ||
* Convert this value into a string representation of the underlying numeric value. | ||
@@ -553,10 +730,11 @@ * | ||
* const value = NadaValue.new_public_integer("23"); | ||
* const integer_value = value.to_integer(); | ||
* const integer_value = value.into_integer(); | ||
*/ | ||
to_integer() { | ||
into_integer() { | ||
let deferred2_0; | ||
let deferred2_1; | ||
try { | ||
const ptr = this.__destroy_into_raw(); | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
wasm.nadavalue_to_integer(retptr, this.__wbg_ptr); | ||
wasm.nadavalue_into_integer(retptr, ptr); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
@@ -753,17 +931,2 @@ var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
/** | ||
* The number of particles | ||
* @returns {bigint} | ||
*/ | ||
get particles() { | ||
const ret = wasm.__wbg_get_nadavaluesclassification_particles(this.__wbg_ptr); | ||
return BigInt.asUintN(64, ret); | ||
} | ||
/** | ||
* The number of particles | ||
* @param {bigint} arg0 | ||
*/ | ||
set particles(arg0) { | ||
wasm.__wbg_set_nadavaluesclassification_particles(this.__wbg_ptr, arg0); | ||
} | ||
/** | ||
* The number of shares | ||
@@ -889,3 +1052,3 @@ * @returns {bigint} | ||
to_byte_array() { | ||
const ret = wasm.partyid_to_byte_array(this.__wbg_ptr); | ||
const ret = wasm.ecdsasignature_r(this.__wbg_ptr); | ||
return takeObject(ret); | ||
@@ -1257,2 +1420,7 @@ } | ||
export function __wbg_ecdsasignature_new(arg0) { | ||
const ret = EcdsaSignature.__wrap(arg0); | ||
return addHeapObject(ret); | ||
}; | ||
export function __wbg_partyshares_new(arg0) { | ||
@@ -1401,7 +1569,2 @@ const ret = PartyShares.__wrap(arg0); | ||
export function __wbg_partyid_unwrap(arg0) { | ||
const ret = PartyId.__unwrap(takeObject(arg0)); | ||
return ret; | ||
}; | ||
export function __wbg_new_d9bc3a0147634640() { | ||
@@ -1431,2 +1594,7 @@ const ret = new Map(); | ||
export function __wbg_partyid_unwrap(arg0) { | ||
const ret = PartyId.__unwrap(takeObject(arg0)); | ||
return ret; | ||
}; | ||
export function __wbg_String_b9412f8799faab3e(arg0, arg1) { | ||
@@ -1433,0 +1601,0 @@ const ret = String(getObject(arg1)); |
@@ -10,4 +10,8 @@ /* tslint:disable */ | ||
export function nadavalue_new_public_unsigned_integer(a: number, b: number, c: number): void; | ||
export function nadavalue_to_byte_array(a: number, b: number): void; | ||
export function nadavalue_to_integer(a: number, b: number): void; | ||
export function nadavalue_new_ecdsa_private_key(a: number, b: number, c: number): void; | ||
export function nadavalue_new_ecdsa_digest_message(a: number, b: number, c: number): void; | ||
export function nadavalue_new_ecdsa_signature(a: number, b: number, c: number, d: number, e: number): void; | ||
export function nadavalue_into_byte_array(a: number, b: number): void; | ||
export function nadavalue_try_into_signature(a: number, b: number): void; | ||
export function nadavalue_into_integer(a: number, b: number): void; | ||
export function nadavalue_type_name(a: number, b: number): void; | ||
@@ -19,5 +23,8 @@ export function __wbg_nadavalues_free(a: number): void; | ||
export function nadavalues_to_record(a: number, b: number): void; | ||
export function __wbg_ecdsasignature_free(a: number): void; | ||
export function ecdsasignature_new(a: number, b: number, c: number, d: number): number; | ||
export function ecdsasignature_r(a: number): number; | ||
export function ecdsasignature_s(a: number): number; | ||
export function __wbg_partyid_free(a: number): void; | ||
export function partyid_new(a: number, b: number): number; | ||
export function partyid_to_byte_array(a: number): number; | ||
export function __wbg_secretmasker_free(a: number): void; | ||
@@ -31,4 +38,2 @@ export function secretmasker_new_64_bit_safe_prime(a: number, b: number, c: number, d: number): void; | ||
export function __wbg_nadavaluesclassification_free(a: number): void; | ||
export function __wbg_get_nadavaluesclassification_particles(a: number): number; | ||
export function __wbg_set_nadavaluesclassification_particles(a: number, b: number): void; | ||
export function __wbg_get_nadavaluesclassification_shares(a: number): number; | ||
@@ -56,2 +61,3 @@ export function __wbg_set_nadavaluesclassification_shares(a: number, b: number): void; | ||
export function programmetadata_preprocessing_requirements(a: number, b: number): void; | ||
export function partyid_to_byte_array(a: number): number; | ||
export function __wbindgen_malloc(a: number, b: number): number; | ||
@@ -58,0 +64,0 @@ export function __wbindgen_realloc(a: number, b: number, c: number, d: number): number; |
@@ -22,2 +22,32 @@ /* tslint:disable */ | ||
/** | ||
* A ecdsa signature | ||
*/ | ||
export class EcdsaSignature { | ||
/** | ||
** Return copy of self without private attributes. | ||
*/ | ||
toJSON(): Object; | ||
/** | ||
* Return stringified version of self. | ||
*/ | ||
toString(): string; | ||
free(): void; | ||
/** | ||
* Construct a new instance the components. | ||
* @param {Uint8Array} r | ||
* @param {Uint8Array} s | ||
*/ | ||
constructor(r: Uint8Array, s: Uint8Array); | ||
/** | ||
* Access r component of the signature | ||
* @returns {Uint8Array} | ||
*/ | ||
r(): Uint8Array; | ||
/** | ||
* Access s component of the signature | ||
* @returns {Uint8Array} | ||
*/ | ||
s(): Uint8Array; | ||
} | ||
/** | ||
* A set of encrypted nada values. | ||
@@ -98,2 +128,33 @@ */ | ||
/** | ||
* Create a new ecdsa private key | ||
* | ||
* @param {Uint8Array} value - The ecdsa private key in binary (byte array) encoded format | ||
* @return {NadaValue} The encoded secret corresponding to the value provided | ||
* | ||
* @example | ||
* const value = NadaValue.new_ecdsa_private_key([1,0,1,222,21,...]); | ||
*/ | ||
static new_ecdsa_private_key(value: Uint8Array): NadaValue; | ||
/** | ||
* Create a new ecdsa digest message. | ||
* | ||
* @param {Uint8Array} value - The ecdsa digest message in binary (byte array) encoded format | ||
* @return {NadaValue} The encoded secret corresponding to the value provided | ||
* | ||
* @example | ||
* const value = NadaValue.new_ecdsa_digest_message([1,0,1,222,21,...]); | ||
*/ | ||
static new_ecdsa_digest_message(value: Uint8Array): NadaValue; | ||
/** | ||
* Create a new ecdsa signature. | ||
* | ||
* @param {Uint8Array} r - The r component of the signature in binary (byte array) encoded format | ||
* @param {Uint8Array} s - The s component of the signature in binary (byte array) encoded format | ||
* @return {NadaValue} The encoded secret corresponding to the value provided | ||
* | ||
* @example | ||
* const value = NadaValue::new_ecdsa_signature(EcdsaSignature { r, s }); | ||
*/ | ||
static new_ecdsa_signature(r: Uint8Array, s: Uint8Array): NadaValue; | ||
/** | ||
* Convert this value into a byte array. | ||
@@ -107,6 +168,18 @@ * | ||
* const value = NadaValue.new_secret_blob([1,0,1,222,21]); | ||
* const byteArray = value.to_byte_array(); | ||
* const byteArray = value.into_byte_array(); | ||
*/ | ||
to_byte_array(): Uint8Array; | ||
into_byte_array(): Uint8Array; | ||
/** | ||
* Convert this value into a byte array. | ||
* | ||
* This is only valid for secret blob values. | ||
* @return {Uint8Array} the byte array contained in this value. | ||
* @throws {Error} if the value is not a secret blob. | ||
* | ||
* @example | ||
* const value = NadaValue.new_secret_blob([1,0,1,222,21]); | ||
* const byteArray = value.into_byte_array(); | ||
*/ | ||
try_into_signature(): EcdsaSignature; | ||
/** | ||
* Convert this value into a string representation of the underlying numeric value. | ||
@@ -119,5 +192,5 @@ * | ||
* const value = NadaValue.new_public_integer("23"); | ||
* const integer_value = value.to_integer(); | ||
* const integer_value = value.into_integer(); | ||
*/ | ||
to_integer(): string; | ||
into_integer(): string; | ||
/** | ||
@@ -195,6 +268,2 @@ * Return the Nada type represented by this instance. | ||
/** | ||
* The number of particles | ||
*/ | ||
particles: bigint; | ||
/** | ||
* The number of public values | ||
@@ -201,0 +270,0 @@ */ |
{ | ||
"name": "@nillion/client-wasm", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"type": "module", | ||
@@ -19,4 +19,4 @@ "exports": { | ||
"build:watch": "echo 'no op'; exit 0", | ||
"build": "echo 'no op'; exit 0" | ||
"build": "cp src/index.js dist/index.js" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
1943
1652030
1