Skip to main content

KeytoolStorage

@iota/identity-wasm API documentation


Class: KeytoolStorage

IOTA Keytool CLI wrapper.

Constructors​

new KeytoolStorage()​

new KeytoolStorage(iota_bin?): KeytoolStorage

Creates a new KeytoolStorage that wraps the given iota binary. Attempts to use the one in PATH if none is provided.

Parameters​

iota_bin?​

null | string

Returns​

KeytoolStorage

Methods​

signer()​

signer(address?): KeytoolSigner

Returns a KeytoolSigner that will use the provided address to sign transactions. If no address is provided the current active one will be used.

Parameters​

address?​

null | string

Returns​

KeytoolSigner


generateKey()​

generateKey(key_scheme): [PublicKey, string]

Creates a new key of type key_scheme. Returns the tuple (PublicKey, alias).

Parameters​

key_scheme​

"ed25519" | "secp256r1" | "secp256k1"

Returns​

[PublicKey, string]


insertKey()​

insertKey(bech32_secret_key): string

Inserts a Bech32-encoded private key in the keystore. The key must use the prefix iotaprivkey.

Returns the key's alias.

Parameters​

bech32_secret_key​

string

Returns​

string


signRaw()​

signRaw(address, data): Uint8Array

Signs data with address's secret key.

Parameters​

address​

string

data​

Uint8Array

Returns​

Uint8Array


updateAlias()​

updateAlias(old_alias, new_alias?): void

Updates an alias from old_alias to new_alias If no value for new_alias is provided, a randomly generated one will be used.

Parameters​

old_alias​

string

new_alias?​

null | string

Returns​

void


getKey()​

getKey(address): [PublicKey, string]

Returns the PublicKey for the given address together with its alias.

Parameters​

address​

string

Returns​

[PublicKey, string]


getKeyByAlias()​

getKeyByAlias(alias): PublicKey

Returns the PublicKey that has the given alias.

Parameters​

alias​

string

Returns​

PublicKey