Methods
# public_key() → {string}
Returns the public key corresponding to this key.
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.
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 |
The decoded instance of 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 |
The user key generated using the seed provided
Example
const key = new UserKey.from_seed("my_seed");