Class

UserKey

UserKey

User key

The user key is used as the user identity in the Nillion network. The key can be generated from a seed or from a base58 string.

View Source nillion_client_wasm.js, line 2180

Example
const key = new UserKey.from_seed("my_seed");

Methods

# public_key() → {string}

Returns the public key corresponding to this key.

View Source nillion_client_wasm.js, line 2254

The public key as an UTF-8 encoded string.

string
Example
const key = new UserKey.from_seed("my_seed");
const public_key = key.public_key();

# to_base58() → {string}

Returns the key in Base58 encoded form.

View Source nillion_client_wasm.js, line 2306

the key encoded as a Base58 string

string
Example
const key = new UserKey.from_seed("my_seed");
const base58_key = key.to_base58();

# static from_base58(contents) → {UserKey}

Decodes a UserKey from a Base58-encoded String

Parameters:
Name Type Description
contents string

The private key encoded in Base58 format

View Source nillion_client_wasm.js, line 2280

The decoded instance of UserKey

UserKey
Example
const key = new UserKey.from_base58(<base 58 encoded data>);

# static from_seed(seed) → {UserKey}

Generate a new public/private key. Uses a seed to generate the keys via a cryptographically secure pseudo-random number generator.

Parameters:
Name Type Description
seed string

The seed that will be used to generate the key

View Source nillion_client_wasm.js, line 2227

The user key generated using the seed provided

UserKey
Example
const key = new UserKey.from_seed("my_seed");

# static generate() → {UserKey}

Generate a new random public/private key. Uses a cryptographically secure pseudo-random number generator.

View Source nillion_client_wasm.js, line 2211

a new instance of UserKey

UserKey
Example
const key = new UserKey.generate();