Skip to content
Generates keypairs and addresses for the XRP Ledger using elliptic (JS)
JavaScript
Branch: master
Clone or download
Latest commit 9402975 Oct 23, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
test Fix eslint errors Sep 8, 2017
.babelrc Use es7 decorator syntax for cached methods Aug 7, 2015
.gitignore Fix error in README Sep 23, 2015
HISTORY.md Bump version to 0.10.1 and add HISTORY.md Nov 10, 2017
LICENSE Add LICENSE Dec 3, 2017
README.md
circle.yml Specify messages as hex and fix bug in ed25519 signing Oct 14, 2015
package.json Merge pull request #28 from paullinator/patch-1 Oct 24, 2018

README.md

ripple-keypairs NPM Build Status codecov.io

An implementation of ripple keypairs & wallet generation using elliptic which supports rfc6979 and eddsa deterministic signatures.

API Methods

generateSeed({entropy?: Array<integer>, algorithm?: string}) -> string

Generate a seed that can be used to generate keypairs. Entropy can be provided as an array of bytes expressed as integers in the range 0-255. If provided, it must be at least 16 bytes long. If not provided, entropy will be automatically generated. The "algorithm" defaults to "ecdsa-secp256k1", but can also be set to "ed25519". The result is a seed encoded in base58, starting with "s".

deriveKeypair(seed: string) -> {privateKey: string, publicKey: string}

Derive a public and private key from a seed. The keys are represented as 33-byte hexadecimal strings.

sign(messageHex: string, privateKey: string) -> string

Sign an arbitrary hex-encoded message with a private key. Returns the signature as a hexadecimal string.

verify(messageHex: string, signature: string, publicKey: string) -> boolean

Verify a signature for a given hex-encoded message and public key. Returns true if the signature is valid, false otherwise.

deriveAddress(publicKey: string) -> string

Derive a Ripple address from a public key.

deriveNodeAddress(publicKey: string) -> string

Derive a node address from a public key.

Generate a random Ripple address

const seed = generateSeed();
const keypair = deriveKeypair(seed);
const address = deriveAddress(keypair.publicKey);
You can’t perform that action at this time.