Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
ripple-keypairs
Advanced tools
The ripple-keypairs npm package is a library for generating and managing cryptographic key pairs used in the Ripple (XRP) ecosystem. It provides functionalities for creating keys, deriving addresses, and signing/verifying messages, which are essential for interacting with the Ripple network.
Generate a new key pair
This feature allows you to generate a new cryptographic key pair consisting of a public and private key. The code sample demonstrates how to use the `generateKeypair` function to create a new key pair.
const rippleKeypairs = require('ripple-keypairs');
const keypair = rippleKeypairs.generateKeypair();
console.log(keypair);
Derive address from public key
This feature allows you to derive a Ripple address from a given public key. The code sample shows how to use the `deriveAddress` function to obtain the address associated with a public key.
const rippleKeypairs = require('ripple-keypairs');
const publicKey = 'yourPublicKeyHere';
const address = rippleKeypairs.deriveAddress(publicKey);
console.log(address);
Sign a message
This feature enables you to sign a message using a private key. The code sample demonstrates how to use the `sign` function to create a cryptographic signature for a message.
const rippleKeypairs = require('ripple-keypairs');
const privateKey = 'yourPrivateKeyHere';
const message = 'yourMessageHere';
const signature = rippleKeypairs.sign(message, privateKey);
console.log(signature);
Verify a signature
This feature allows you to verify a signature using a public key. The code sample shows how to use the `verify` function to check if a signature is valid for a given message and public key.
const rippleKeypairs = require('ripple-keypairs');
const message = 'yourMessageHere';
const signature = 'yourSignatureHere';
const publicKey = 'yourPublicKeyHere';
const isValid = rippleKeypairs.verify(message, signature, publicKey);
console.log(isValid);
ripple-lib is a comprehensive library for interacting with the Ripple network. It includes functionalities for key pair generation, signing, and verifying, similar to ripple-keypairs, but also provides additional features for connecting to the Ripple network, submitting transactions, and more. It is a more extensive library compared to ripple-keypairs, which focuses specifically on key management.
stellar-sdk is a library for interacting with the Stellar network, which is similar to Ripple. It provides functionalities for key pair generation, signing, and verifying, akin to ripple-keypairs, but is tailored for the Stellar ecosystem. While it serves a different blockchain, the cryptographic principles are similar, making it a comparable tool for developers working with Stellar.
An implementation of XRP Ledger keypairs & wallet generation using elliptic which supports rfc6979 and eddsa deterministic signatures.
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 16 bytes long (additional bytes are ignored). 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 an XRP Ledger classic address from a public key.
deriveNodeAddress(publicKey: string) -> string
Derive a node address from a public key.
const seed = generateSeed();
const keypair = deriveKeypair(seed);
const address = deriveAddress(keypair.publicKey);
FAQs
Cryptographic key pairs for the XRP Ledger
The npm package ripple-keypairs receives a total of 105,289 weekly downloads. As such, ripple-keypairs popularity was classified as popular.
We found that ripple-keypairs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 9 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.