GithubHelp home page GithubHelp logo

ziluvatar / node-baas Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dschenkelman/node-baas

0.0 1.0 0.0 220 KB

Node.js implementation of Bcrypt as a micro service.

License: MIT License

Makefile 3.99% JavaScript 94.87% Protocol Buffer 1.14%

node-baas's Introduction

Build Status

Bcrypt as a service (node.js)

This module is a client and server.

Server

Installation:

sudo npm i -g auth0/node-baas

Start a baas server on port 9485 and salt with 10 iterations:

baas -p 9485 -s 10

How it works?

The server listen in a TCP port. The protocol buffer is defined in /protocol.

The server start N workers by default N is the number of COREs on the system.

Every request (hash or compare) is assigned to a worker. A worker can handle one operation at the time. If all workers are "busy", the server will reply the request with "SERVER IS BUSY" error to the client. The client automatically retries the request in another connection.

Client

Install:

npm i auth0/node-baas

The client keeps api-level compatibility with node-bcrypt.

var BaasClient = require('baas').Client;

var baas = new BaasClient({
  port: 9485,
  host: 'my-baas-load-balancer'
  pool: {
    maxConnections: 20,
    maxRequestsPerConnection: 10
  }
});

//hash a password
baas.hash('plainTextPassword', function (err, hash) {
  console.log(hash)
});

//compare a password
baas.compare('plainTextPassword', 'bcryptHash', function (err, success) {
  console.log(success)
});

The client also support ssl:

var BaasClient = require('baas').Client;
var baas = new BaasClient({
  port: 9485,
  host: 'my-baas-load-balancer',
  protocol: 'baass'
  pool: {
    maxConnections: 20,
    maxRequestsPerConnection: 10
  }
});

//or
var baas = new BaasClient({
  uri: 'baass://my-baas-load-balancer',
  pool: {
    maxConnections: 20,
    maxRequestsPerConnection: 10
  }
});

To install on ubuntu/debian

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv F63E3D3A
sudo sh -c 'echo deb http://debs.auth0.com/ stable main > /etc/apt/sources.list.d/auth0.list'
sudo aptitude update
sudo aptitude install -y baas

Author

Auth0

License

This project is licensed under the MIT license. See the LICENSE file for more info.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.