cnm-tools v1.3.10
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 forindex.js
, in a folder and exports them. This is meant to be used in anindex.js
filerequiredArg
: 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: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 variableHASHER_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 theMersenneTwister19937
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 stringJWT_KEY_PATH
- presented in object as keyPath - parsed into type stringJWT_KEY_PASSPHRASE
- presented in object as passphrase - parsed into type stringJWT_AUDIENCE
- presented in object as audience - parsed into type listJWT_DURATION
- presented in object as expiration - parsed into type stringJWT_ISSUER
- presented in object as issuer - parsed into type stringJWT_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
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago