npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

xrpl-secret-numbers

v0.3.5

Published

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

Downloads

90,473

Readme

XRPL Secret Numbers npm version

For more background information, please read the proposed Standard.

A tool to convert Secret Nubmers to the widely used Family Seed s... format is available here

A Browserified version of this lib. is available at NPM (dist-folder, browserified.js), CDN: https://cdn.jsdelivr.net/npm/xrpl-secret-numbers/dist/browserified.js. Sample: https://jsfiddle.net/WietseWind/uo1zy0q7/

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. Using numbers means it's language (spoken, written) agnostic as well. 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)

Or importing with custom entropy (buffer, 16):

const {Account} = require('xrpl-secret-numbers')
const entropy = Buffer.from('0123456789ABCDEF0123456789ABCDEF', 'hex')
const account = new Account(entropy)
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}
To split/check/encode/decode some more:

There's a Utils export as well:

const {Account, Utils} = require('xrpl-secret-numbers')

Some Utils methods (that you may want to use in your UI / ... before using the Account constructor):

  • To calculate the 6th decimal for a group of 5 digits:
    calculateChecksum(position: number, value: number): number
  • To check a checksum (either sliced or the 6th char of a string containing numbers:
    checkChecksum(position: number, value: number | string, checksum?: number): Boolean

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.