StoredKey

class StoredKey

Represents a key stored as an encrypted file.

Constructors

Link copied to clipboard
open fun StoredKey(name: String, password: Array<Byte>, encryptionLevel: StoredKeyEncryptionLevel)
Creates a new key, with given encryption strength level.
Link copied to clipboard
open fun StoredKey(name: String, password: Array<Byte>, encryptionLevel: StoredKeyEncryptionLevel, encryption: StoredKeyEncryption)
Creates a new key, with given encryption strength level.
Link copied to clipboard
open fun StoredKey(name: String, password: Array<Byte>)
Creates a new key.
Link copied to clipboard
open fun StoredKey(name: String, password: Array<Byte>, encryption: StoredKeyEncryption)
Creates a new key.

Functions

Link copied to clipboard
open fun account(index: Int): Account
Returns the account at a given index.
Link copied to clipboard
open fun accountCount(): Int
The number of accounts.
Link copied to clipboard
open fun accountForCoin(coin: CoinType, wallet: HDWallet): Account
Returns the account for a specific coin, creating it if necessary.
Link copied to clipboard
open fun accountForCoinDerivation(coin: CoinType, derivation: Derivation, wallet: HDWallet): Account
Returns the account for a specific coin + derivation, creating it if necessary.
Link copied to clipboard
open fun addAccount(address: String, coin: CoinType, derivationPath: String, publicKey: String, extendedPublicKey: String)
Adds a new account, using given derivation path.
Link copied to clipboard
open fun addAccountDerivation(address: String, coin: CoinType, derivation: Derivation, derivationPath: String, publicKey: String, extendedPublicKey: String)
Adds a new account, using given derivation (usually TWDerivationDefault) and derivation path (usually matches path from derivation, but custom possible).
Link copied to clipboard
open fun decryptMnemonic(password: Array<Byte>): String
Decrypts the mnemonic phrase.
Link copied to clipboard
open fun decryptPrivateKey(password: Array<Byte>): Array<Byte>
Decrypts the private key.
Link copied to clipboard
Retrieve stored key encoding parameters, as JSON string.
Link copied to clipboard
open fun exportJSON(): Array<Byte>
Exports the key as JSON
Link copied to clipboard
open fun fixAddresses(password: Array<Byte>): Boolean
Fills in empty and invalid addresses.
Link copied to clipboard
open fun identifier(): String
Stored key unique identifier.
Link copied to clipboard
open fun importHDWallet(mnemonic: String, name: String, password: Array<Byte>, coin: CoinType): StoredKey
Imports an HD wallet.
Link copied to clipboard
open fun importHDWalletWithEncryption(mnemonic: String, name: String, password: Array<Byte>, coin: CoinType, encryption: StoredKeyEncryption): StoredKey
Imports an HD wallet.
Link copied to clipboard
open fun importJSON(json: Array<Byte>): StoredKey
Imports a key from JSON.
Link copied to clipboard
open fun importPrivateKey(privateKey: Array<Byte>, name: String, password: Array<Byte>, coin: CoinType): StoredKey
Imports a private key.
Link copied to clipboard
open fun importPrivateKeyWithEncryption(privateKey: Array<Byte>, name: String, password: Array<Byte>, coin: CoinType, encryption: StoredKeyEncryption): StoredKey
Imports a private key.
Link copied to clipboard
open fun isMnemonic(): Boolean
Whether this key is a mnemonic phrase for a HD wallet.
Link copied to clipboard
open fun load(path: String): StoredKey
Loads a key from a file.
Link copied to clipboard
open fun name(): String
Stored key namer.
Link copied to clipboard
open fun privateKey(coin: CoinType, password: Array<Byte>): PrivateKey
Returns the private key for a specific coin.
Link copied to clipboard
open fun removeAccountForCoin(coin: CoinType)
Remove the account for a specific coin
Link copied to clipboard
open fun removeAccountForCoinDerivation(coin: CoinType, derivation: Derivation)
Remove the account for a specific coin with the given derivation.
Link copied to clipboard
open fun removeAccountForCoinDerivationPath(coin: CoinType, derivationPath: String)
Remove the account for a specific coin with the given derivation path.
Link copied to clipboard
open fun store(path: String): Boolean
Saves the key to a file.
Link copied to clipboard
open fun wallet(password: Array<Byte>): HDWallet
Decrypts and returns the HD Wallet for mnemonic phrase keys.