Chris Price and Eduardo Diaz
75b897b11d
Remove joi to shrink module size ( #348 )
...
* Add cost-of-modules report to npm test
Results before any changes
┌─────────────┬────────────┬───────┐
│ name │ children │ size │
├─────────────┼────────────┼───────┤
│ joi │ 4 │ 3.12M │ <--!!!
├─────────────┼────────────┼───────┤
│ jws │ 5 │ 0.18M │
├─────────────┼────────────┼───────┤
│ lodash.once │ 0 │ 0.01M │
├─────────────┼────────────┼───────┤
│ ms │ 0 │ 0.01M │
├─────────────┼────────────┼───────┤
│ xtend │ 0 │ 0.00M │
├─────────────┼────────────┼───────┤
│ 5 modules │ 9 children │ 3.32M │
└─────────────┴────────────┴───────┘
* Replace joi with bespoke validator based on lodash
Dramatically reduces the module size without breaking ES5 compatability -
┌──────────────────────┬────────────┬───────┐
│ name │ children │ size │
├──────────────────────┼────────────┼───────┤
│ jws │ 5 │ 0.18M │
├──────────────────────┼────────────┼───────┤
│ lodash.includes │ 0 │ 0.02M │
├──────────────────────┼────────────┼───────┤
│ lodash.once │ 0 │ 0.01M │
├──────────────────────┼────────────┼───────┤
│ lodash.isinteger │ 0 │ 0.01M │
├──────────────────────┼────────────┼───────┤
│ ms │ 0 │ 0.01M │
├──────────────────────┼────────────┼───────┤
│ lodash.isplainobject │ 0 │ 0.01M │
├──────────────────────┼────────────┼───────┤
│ xtend │ 0 │ 0.00M │
├──────────────────────┼────────────┼───────┤
│ lodash.isstring │ 0 │ 0.00M │
├──────────────────────┼────────────┼───────┤
│ lodash.isboolean │ 0 │ 0.00M │
├──────────────────────┼────────────┼───────┤
│ lodash.isnumber │ 0 │ 0.00M │
├──────────────────────┼────────────┼───────┤
│ lodash.isarray │ 0 │ 0.00M │
├──────────────────────┼────────────┼───────┤
│ 11 modules │ 5 children │ 0.25M │
└──────────────────────┴────────────┴───────┘
* Enhance validator error messages and add tests
2017-09-06 16:24:55 +02:00
José F. Romaniello
53c3987b3c
Improved the sign method
...
Notable changes:
1. `expiresInMinutes` and `expiresInSeconds` are deprecated and no longer supported.
2. `notBeforeInMinutes` and `notBeforeInSeconds` are deprecated and no longer supported.
3. options are properly validated.
4. `options.expiresIn`, `options.notBefore`, `options.audience`, `options.issuer`, `options.subject` and `options.jwtid` are mutually exclusive with `payload.exp`, `payload.nbf`, `payload.aud`, `payload.iss`, `payload.sub` and `payload.jti` respectively.
5. `options.algorithm` is properly validated.
6. `options.headers` is renamed to `options.header`.
2016-04-27 12:40:28 -03:00