New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

stellar-base

Package Overview
Dependencies
Maintainers
1
Versions
182
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stellar-base

Low level stellar support library

  • 0.3.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
25K
increased by18.48%
Maintainers
1
Weekly downloads
 
Created
Source

JS Stellar Base

Build Status Code Climate

The stellar-base library is the lowest-level stellar helper library. It consists of classes to read, write, hash, and sign the xdr structures that are used in stellar-core.

Installation

Using npm:

npm install --save stellar-base

Usage

Examples are here

In addition to the code generated from the XDR definition files (see js-xdr for example usage), this library also provides some stellar specific features. Let's look at some of them:

var StellarBase = require("stellar-base");

// Create a keypair from a stellar secret seed
var signer = StellarBase.Keypair.fromSeed("SDSIBVHCCWHK7MZSGWJRLYTAESAZ6O4OQU4QS4YJQAQ2EGJXRJW7PYD3");

// Create a keypair from a stellar address
var verifier = StellarBase.Keypair.fromAddress("GDADKSW7B4WZAKFZ7YHESAEZQ5JC7WYSLTUNRTBTAY3R3JRZWXMNKXPN")

// Produce a stellar compliant "decorated signature" that is compliant with stellar transactions
var sig = signer.signDecorated("Hello world!") 

console.log(sig.hint()) // displays the 4 byte buffer of the signatures public key "hint"
console.log(sig.signature()) // displays the 32 byte buffer of the signature

This library also provides an impementation of StrCheck encoding:

var StellarBase = require("stellar-base");

StellarBase.encodeCheck("accountId", [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]) // => "GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF"
StellarBase.encodeCheck("seed", [0,0,0]) // => "SAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABSU2"

// To prevent interpretation mistakes, you must pass the expected version byte
// when decoding a check-encoded value

var encoded = StellarBase.encodeCheck("accountId", [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])
StellarBase.decodeCheck("accountId", encoded) // => Buffer([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])
StellarBase.decodeCheck("seed", encoded) // => throws Error: invalid version byte.

Contributing

Please see CONTRIBUTING.md for details.

Keywords

FAQs

Package last updated on 22 Jul 2015

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc