1.3.10 • Published 4 years ago

cnm-tools v1.3.10

Weekly downloads
1
License
ISC
Repository
-
Last release
4 years ago

CNM-tools

This project holds some little tools that I currently rewrite in many of my projects, I so decided to make them a package

Default

The default exported object holds these functions:

  • requireAll: a function that takes all the files, except for index.js, in a folder and exports them. This is meant to be used in an index.js file
  • requiredArg: used for RORO javascript pattern

Security

There are also several security utilities:

  • cnm-tools/security/jwt is based on the node jsonwebtoken implementation but has the advantage to be fully configurable through environment variables, it exports an object with 2 functions:

    • sign : same as in jwt but you don't have to give any secret or private key
    • verify : same as in jwt but you don't have to give any secret or private key This sub-package is configurable through different environment variables:
  • cnm-tools/security/hasher is based on node bcrypt implementation but has the advantage that you can configure the number of salt rounds through the variable HASHER_SALT_ROUNDS

  • cnm-tools/security/random is based on node random implementation, please check the doc since this package only exports a object from this package configured to use the MersenneTwister19937 algorithm
Configuration

The packages in security are all customisable through environment variables:

  • cnm-tools/security/jwt:
    • JWT_ALGORITHM - presented in object as algorithm - parsed into type string (default : "RS512")
    • JWT_SECRET - presented in object as secret - parsed into type string
    • JWT_KEY_PATH - presented in object as keyPath - parsed into type string
    • JWT_KEY_PASSPHRASE - presented in object as passphrase - parsed into type string
    • JWT_AUDIENCE - presented in object as audience - parsed into type list
    • JWT_DURATION - presented in object as expiration - parsed into type string
    • JWT_ISSUER - presented in object as issuer - parsed into type string
    • JWT_SUBJECT - presented in object as subject - parsed into type string
  • cnm-tools/security/hasher:
    • HASHER_SALT_ROUNDS - the cost of creating the hash
  • cnm-tools/security/random
1.3.10

4 years ago

1.3.9

4 years ago

1.3.8

4 years ago

1.3.7

4 years ago

1.3.6

4 years ago

1.3.5

4 years ago

1.3.4

4 years ago

1.3.3

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.7

4 years ago

1.2.6

4 years ago

1.2.5

4 years ago

1.2.4

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.0

4 years ago

1.2.1

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago