@clevertech.biz/auth-core
TypeScript icon, indicating that this package has built-in type declarations

6.1.0 • Public • Published

CleverAuth Core

Generic auth library for Clevertech.

Testing

You have to run the tests with node v10 or newer clients.

docker-compose -f test/docker-compose.yml up -d
npm run test

Example

import {
  Core,
  KnexAdapter,
  MongoAdapter,
  DefaultEmailService,
  Crypto,
  JWT,
  Validations,
  TwilioSMSService
} from '@clevertech.biz/auth-core'

const db = new MongoAdapter('<uri>')
const db = new KnexAdapter({
  // knex config here
})
const sms = new TwilioSMSService(
  '<accountSid>',
  '<authToken>',
  '<numberFrom>'
})

const core = new Core({
  projectName: '<projectName>',
  db,
  email: new DefaultEmailService({
    projectName: '',
    confirmEmailURL: '',
    requestResetPasswordURL: '',
    resetPasswordURL: '',
    emailServiceConfig: {
      // config for pnp-email-service
    }
  }),
  crypto: new Crypto('<key>', '<algorithm> = aes-256-gcm'),
  jwt: new JWT('<algorithm>', '<secretOrPrivateKey>', '<secretOrPublicKey>', {
    // default options: see https://github.com/auth0/node-jsonwebtoken#usage
  }),
  validations: new Validations(['name', 'company'], true),
  sms,
  numberOfRecoverCodes: 10
})

Readme

Keywords

none

Package Sidebar

Install

npm i @clevertech.biz/auth-core

Weekly Downloads

6

Version

6.1.0

License

MIT

Unpacked Size

805 kB

Total Files

106

Last publish

Collaborators

  • gmotruk
  • gonrial
  • fredamsouza
  • jbmikk