Nonviolent Pigeon Manifestation

npm

Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript.Learn more »

xrpl-secret-numbers

0.1.0 • Public • Published

XRPL Secret Numbers npm version

Generate XRPL Accounts with a number-based secret: 8 chunks of 6 digits.

The common formats for XRPL account secrets are (at the time of writing this, July 2019):

  • Family Seed, eg. sh1HiK7SwjS1VxFdXi7qeMHRedrYX
  • Mnemonic, eg. car banana apple road ...

These formats are prone to typo's and not that user friendly. They may be especially intimidating for the public that's relatively new to cryptocurrencies / blockchain technology.

This library encodes the entropy to generate accounts into 8 chunks of 6 digits, of which 5 digits are 1/8th of the entropy, and a 6th digit contains a checksum allowing realtime typo detection.

A secret now looks like:
554872 394230 209376 323698
140250 387423 652803 258676

For compatibility with existing clients, this library supports exporting the family seed for a generated / entered "Secret Number"-set as well.

API

The JS code to use resides in ./dist/. See the ./samples/ folder for some simple JS samples.

Generating a new account:
const {Account} = require('xrpl-secret-numbers')
const account = new Account()
Importing an existing account:
const {Account} = require('xrpl-secret-numbers')
const secret = '399150 474506 009147 088773 432160 282843 253738 605430'
const account = new Account(secret)
After generating / importing:

You can fetch the account details (address, secret, etc.) using these methods:

console.log(account.getAddress())
console.log(account.getSecret())
Available methods:
  • getSecret(): Array[8]
  • getSecretString(): string 012345 456789 ...
  • getAddress(): string rXXXXXXXX...
  • getFamilySeed(): string sXXXXXXXX...
  • getKeypair(): Keypair({privateKey, publicKey}

Development

Run npm run prepublish to clean, lint, test and build. Or just run npm run build, npm run test or npm run lint.

Tests are in ./test/

Credits

This concept is based on an idea by @nbougalis.

install

npm i xrpl-secret-numbers

Downloadsweekly downloads

2

version

0.1.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability