deadbolt-client
TypeScript icon, indicating that this package has built-in type declarations

1.0.7 • Public • Published

Deadbolt Client

Client for the deadbolt user service.

Usage example

import { DeadboltClient } from 'deadbolt-client';
import { DeadboltUser, NewUserData } from './Users/User';

const client = new DeadboltClient({ endpoint: 'http://deadbolt:3000' });

const data: NewUserData = {
  email: 'test@example.com',
  username: 'testo',
  password: 'shinyshoesfor5sheckles',
};

//Add a user
client.addUser(data).then(user => {
  console.log("User created!", user.uuid);
});

//Login
// Note that Identifier can be uuid, email or username.
const identifier = 'test@example.com';
const password = 'shinyshoesfor5sheckles';
client.login({ identifier, password }).then(result => {
  console.log("Login ok?: ", result.success);
  console.log("User object", result.user);
  console.log("Session token", result.user.session.token);
});

Todo

[ ] Most of the documentation [ ] Setup automated testing [ ] Publish on npm [ ] Link to specific version of Deadbolt (current 2.1.1) [ ] Redo deadbolt :see-no-evil:

Readme

Keywords

none

Package Sidebar

Install

npm i deadbolt-client

Weekly Downloads

2

Version

1.0.7

License

MIT

Unpacked Size

105 kB

Total Files

42

Last publish

Collaborators

  • ceremco