@terra-money/key-utils
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

Terra Key Utils

This library contains several utilities related to keys used by Terra official tools.

Contents

Keystore

Utilities for storing keys as an encrypted string (used for mnemonics).

import { encrypt, decrypt } from "@terra-money/key-utils/keystore"

const encrypted = encrypt("mnemonic", "password")
const decrypted = decrypt(encrypted, "password")

// decrypted === "mnemonic"

Mnemonic

Utilities for restoring mnemonics.

import {
  validateMnemonic,
  getMnemonicKeys
} from "@terra-money/key-utils/mnemonic"

const test1 =
  "satisfy adjust timber high purchase tuition stool faith fine install that you unaware feed domain license impose boss human eager hat rent enjoy dawn"

const wrong =
  "symbol force gallery make bulk round subway violin worry mixture penalty kingdom"
// should be true
validateMnemonic(test1)
// should be false (only 12 words)
validateMnemonic(test2)

// get assets
getMnemonicKeys(test1, {
  chainID: "columbus-4",
  URL: "https://lcd.terra.dev"
}).then(keys => console.log(keys[118].assets, keys[330].assets))

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.2
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.2
    2
  • 1.0.1
    1
  • 1.0.0
    1

Package Sidebar

Install

npm i @terra-money/key-utils

Weekly Downloads

4

Version

1.0.2

License

MIT

Unpacked Size

315 kB

Total Files

17

Last publish

Collaborators

  • terra-engineering
  • simke9445
  • alecande
  • mwmerz
  • terra-devops