Socket
Socket
Sign inDemoInstall

stellar-auth-server

Package Overview
Dependencies
47
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    stellar-auth-server

Server side library for Stellar SEP 0010 implementation


Version published
Maintainers
1
Install size
59.3 MB
Created

Readme

Source

Stellar Auth server library

Version Build Status Coverage Status David David Try on RunKit

Server side library for Stellar SEP 0010 implementation.

Installation

Install the package with:

npm install stellar-auth-server --save

Usage

Initialization

const StellarAuth = require('stellar-auth-server');

const serverKeyPair = StellarSdk.Keypair.fromSecret('SDL...A2J');

// optional param
const options = {
  challengeExpiresIn: 300, // 5 minutes
  invalidSequence: '0',
  anchorName: 'Anchor server'
}

const stellarAuth = new StellarAuth(serverKeyPair, options);
  • serverKeyPair
    Server Keypair object.
    Required: true
  • options
    Object with optional params .
    Required: false
    • challengeExpiresIn
      time in seconds in which the challenge expires.
      Default value: 300 (5 minutes)
      Required: false
    • invalidSequence
      Invalid sequence for stellar transaction.
      Default value: '0'
      Required: false
    • anchorName
      Default anchor name.
      Default value: 'Anchor server'
      Required: false

Challenge

const clientPublicKey = 'GBF...3UZ';
const txBase64 = stellarAuth.challenge(clientPublicKey);
return { transaction: txBase64 };

Verify

stellarAuth.verify(txBase64SignedByClient)
.then(result => { token: buildToken(result.hash, result.clientPublicKey) })
.catch(e => { error: translate(e.message) || e.message })

Development

Run all tests:

$ npm install
$ npm test

Run a single test suite:

$ npm run mocha -- test/lib/challenge.spec.js

Run a single test (case sensitive):

$ npm run mocha -- test/lib/challenge.spec.js --grep 'Should have valid timebounds'

Library based on Stellar SEP-0010 implementation

Keywords

FAQs

Last updated on 31 Dec 2019

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc