Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

blockstarter-wl

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

blockstarter-wl

Blockstarter white-label API for integration

  • 0.0.49
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Blockstarter White Label API (Blockstarter Enterprise)

This is library helps to integrate blockstarter with client's dashboard

Image

Install

npm i blockstarter-wl

Available functions

  • auth
  • logout
  • confirmEmail
  • forgotPassword
  • resetPassword
  • changePassword
  • updateProfile
  • panel
  • address
  • contributors

Usage

First of all define a storage


var storage = {
    isBrowser: true,  //=> you cannot duplicate requests for browser
    baseUrl: "http://server.url",
    sessionId: null,
    apiKey: 'TEST-APIKEY',
    dashboard: null
  };

Auth

Login or Register


var blockstarter = require('blockstarter-wl');

if (storage.apiKey == null) {
  throw "API Key is required";
}

blockstarter.auth({
  isBrowser: storage.isBrowser,
  baseUrl: storage.baseUrl,
  email: 'test@test.com',
  password: 'unique password',
  confirmUrl: "http://redirect-on-confirm" // will redirect here http://redirect-on-confirm?confirmation-id=XXXXX
  project: 'KickCity',
  reference: 'traffic-source',
  apiKey: storage.apiKey

}, function(err, session){
      if (err != null) {
        throw err;
      }
      
      if (session.sessionId == null) {
        throw "Session ID is missing";
      }
      
      storage.sessionId = session.sessionId;
      console.log(session.sessionId);
});

Logout

Remove sessionId from the system

Confirm Email

Send confirmation-id and session-id to confirm email

Documentation is not ready

Forgot password

if (storage.apiKey == null) {
      throw "API Key is required";
}

var request = {
    isBrowser: storage.isBrowser,
    baseUrl: storage.baseUrl,
    apiKey: storage.apiKey,
    email: "your@email.com",
    project: "KickCity",
    transport: "postmaster@test.mailgun.org",
    returnUrl: "http://restore-password.com" //server will invoke http://restore-password.com?restore-key=SOME_RANDON_KEY
}
    
blockstarter.forgotPassword(request, function(err, dashboard){
  if (err != null) {
    throw err;
  }
  
  console.log("done");
});
Reset password

User obtains email message with restore password link and then user fills the form. You should obtain restore-key from query params and send it to the server

  

if (storage.apiKey == null) {
      throw "API Key is required";
}

var request = { 
    isBrowser: storage.isBrowser,
    baseUrl: storage.baseUrl,
    apiKey: storage.apiKey,
    newPassword: "newPassword",
    transport: "postmaster@test.mailgun.org",
    restoreKey: "Obtain restore key from ?restore-key=SOME_RANDON_KEY"
}
    
blockstarter.resetPassword(request, function(err, dashboard){
  if (err != null) {
    throw err;
  }
  
  console.log("done");
});
Change password

Change password when session is created and user is online

  
if (storage.apiKey == null) {
      throw "API Key is required";
}

if (storage.sessionId == null) {
      throw "Session is required";
}

var request = {
    isBrowser: storage.isBrowser,
    baseUrl: storage.baseUrl,
    apiKey: storage.apiKey,
    sessionId: storage.sessionId,
    newPassword: "newPassword",
    oldPassword: "oldPassword",
    transport: "postmaster@test.mailgun.org"
}
    
blockstarter.changePassword(request, function(err, dashboard){
  if (err != null) {
    throw err;
  }
  
  console.log("done");
});
Update Profile

Almost like changePassword but can update email, username, address optionaly

Documentation is not ready

Get Dashboard

Information about Totals, Rates, Currencies, etc. in order to build a main screen where contributor can

  1. get address to send money
  2. check his transactions
  3. check common information about project
  4. get total raised (progress)
  
if (storage.sessionId == null) {
      throw "Session is required";
}

if (storage.apiKey == null) {
      throw "API Key is required";
}
    
blockstarter.panel(storage, function(err, dashboard){
  if (err != null) {
    throw err;
  }
  
  storage.dashboard = dashboard;
  
  console.log(dashboard);
});
Get Address

Get [btc, ltc, eth, waves, dash, zec] address


if (storage.sessionId == null) {
  throw "Session is required";
}

if (storage.apiKey == null) {
  throw "API Key is required";
}

if (storage.dashboard == null) {
  throw "Dashboard is required";
}

var request = {
   isBrowser: storage.isBrowser,
   baseUrl: storage.baseUrl,
   apiKey: storage.apiKey,
   sessionId: storage.sessionId,
   dashboard: storage.dashboard,
   type: 'ltc'
}   

blockstarter.address(request, function(err, addressInfo){
  if (err != null) {
    throw err;
  }
  console.log(addressInfo);
});

Ask for help

User can ask for help and admin will contact him by email


if (storage.sessionId == null) {
  throw "Session is required";
}

if (storage.apiKey == null) {
  throw "API Key is required";
}

blockstarter.helpMe(storage, function(err, info){
  if (err != null) {
    throw err;
  }
  console.log('done')
});

List of contributors

Get list of contributors for administrator


if (storage.apiKey == null) {
  throw "API Key is required";
}

var request = { 
   isBrowser: storage.isBrowser,
   baseUrl: storage.baseUrl,
   apiKey: storage.apiKey,  
   project: "KickCity"
}

blockstarter.contributors(request, function(err, list){
  if (err != null) {
    throw err;
  }
  console.log(list)
});

Keywords

FAQs

Package last updated on 14 Oct 2017

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