Class

NadaValue

NadaValue

NadaValue

This type represents a value in the Nillion network. This class provides utilities to encode numerical and binary values. It also provides methods to decode the value into a numerical form.

Methods

# to_byte_array() → {Uint8Array}

Convert this value into a byte array.

This is only valid for secret blob values.

View Source nillion_client_wasm.js, line 633

if the value is not a secret blob.

Error

the byte array contained in this value.

Uint8Array
Example
const value = NadaValue.new_secret_blob([1,0,1,222,21]);
const byteArray = value.to_byte_array();

# to_integer() → {string}

Convert this value into a string representation of the underlying numeric value.

This only works for numeric secret values, such as integers and unsigned integers.

View Source nillion_client_wasm.js, line 661

a string representation of the underlying numeric value

string
Example
const value = NadaValue.new_public_integer("23");
const integer_value = value.to_integer();

# static new_public_integer(value) → {NadaValue}

Create a new public integer with the provided value.

Parameters:
Name Type Description
value string

The value must be a valid string representation of an integer.

View Source nillion_client_wasm.js, line 579

The encoded public variable corresponding to the value provided

NadaValue
Example
const value = NadaValue.new_public_integer("-23");

# static new_public_unsigned_integer(value) → {NadaValue}

Create a new public unsigned integer with the provided value.

Parameters:
Name Type Description
value string

The value must be a valid string representation of an unsigned integer.

View Source nillion_client_wasm.js, line 605

The encoded public variable corresponding to the value provided

NadaValue
Example
const value = NadaValue.new_public_unsigned_integer("23");

# static new_secret_blob(value) → {NadaValue}

Create a new secret blob.

Parameters:
Name Type Description
value Uint8Array

The blob in binary (byte array) encoded format

View Source nillion_client_wasm.js, line 564

The encoded secret corresponding to the value provided

NadaValue
Example
const value = NadaValue.new_secret_blob([1,0,1,222,21]);

# static new_secret_integer(value) → {NadaValue}

Create a new secret integer value.

Parameters:
Name Type Description
value string

The value must be a valid string representation of an integer.

View Source nillion_client_wasm.js, line 512

The encoded secret corresponding to the value provided

NadaValue
Example
const value = NadaValue.new_secret_integer("-23");

# static new_secret_unsigned_integer(value) → {NadaValue}

Create a new secret unsigned integer value.

Parameters:
Name Type Description
value string

The value must be a valid string representation of an unsigned integer.

View Source nillion_client_wasm.js, line 538

The encoded secret corresponding to the value provided

NadaValue
Example
const value = NadaValue.new_secret_unsigned_integer("23");