maskdata 1.2.5 → 1.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -107,6 +107,7 @@ Usage: [JSON fields masking](./README.md#mask-json)
107
107
  ```
108
108
  ### 8. Mask JWT
109
109
  Usage: [JWT masking](./README.md#mask-jwt-token)
110
+ ```javascript
110
111
  const defaultJwtMaskOptions = {
111
112
  maskWith: '*',
112
113
  maxMaskedCharacters: 512,
@@ -115,7 +116,7 @@ const defaultJwtMaskOptions = {
115
116
  maskPayload: true,
116
117
  maskSignature: true
117
118
  };
118
-
119
+ ```
119
120
  <br/>
120
121
 
121
122
  ## Available functions to import along with their configs
package/README.md CHANGED
@@ -4,7 +4,7 @@ maskdata is a Node.js module to mask various kinds of data. With the help of mas
4
4
  # Table of Contents
5
5
  - [Features](#features)
6
6
  - [Install maskdata](#install-maskdata)
7
- - [Version 1.2.5 Features](#release-features)
7
+ - [Version 1.2.6 Features](#release-features)
8
8
  - [How to Use](#how-to-use)
9
9
  - [Maskdata for Typescript](#maskdata-for-typescript)
10
10
  - [Mask Card number](#mask-card-number)
@@ -43,7 +43,7 @@ maskdata is a Node.js module to mask various kinds of data. With the help of mas
43
43
  > npm i maskdata
44
44
 
45
45
  # Release Features
46
- ### Version 1.2.5
46
+ ### Version 1.2.6
47
47
  - JWT token masking: Mask JWT tokens with configs to mask as per your need. More details: [Mask JWT Token](#mask-jwt-token)
48
48
  - Mask Json now supports JWT token masking also. More details: [Mask JWT in a JSON](#mask-json)
49
49
  - Bug fix in maskJson2 where it was not checking for the empty/null/undefined fields and was resulting in error `"TypeError: validatedConfig[typeToFunctionMap[key][1]] is not iterable"`
@@ -195,13 +195,13 @@ const defaultjsonMask2Configs = {
195
195
  stringFields: [], // List of String fields to be masked
196
196
 
197
197
  uuidMaskOptions: defaultUuidMaskOptions, // Optional
198
- uuidFields: [] // List of UUID fields to be masked
198
+ uuidFields: [], // List of UUID fields to be masked
199
199
 
200
200
  jwtMaskOptions: defaultJwtMaskOptions, // Optional
201
201
  jwtFields: [] // List of JWT fields to be masked
202
202
  };
203
203
  ```
204
- <b>NOTE: For defaultCardMaskOptions, defaultEmailMask2Options, defaultPasswordMaskOptions, defaultPhoneMaskOptions, defaultStringMaskOptions and defaultUuidMaskOptions refer the corresponding masking features. </b>
204
+ <b>NOTE: For defaultCardMaskOptions, defaultEmailMask2Options, defaultPasswordMaskOptions, defaultPhoneMaskOptions, defaultStringMaskOptions, defaultUuidMaskOptions and defaultJwtMaskOptions refer corresponding masking features. </b>
205
205
 
206
206
  ```javascript
207
207
  const defaultjsonMask2Configs = {
@@ -249,7 +249,17 @@ const defaultjsonMask2Configs = {
249
249
  unmaskedStartCharacters: 0,
250
250
  unmaskedEndCharacters: 0
251
251
  },
252
- uuidFields: []
252
+ uuidFields: [],
253
+
254
+ jwtMaskOptions: {
255
+ maskWith: '*',
256
+ maxMaskedCharacters: 512,
257
+ maskDot: true,
258
+ maskHeader: true,
259
+ maskPayload: true,
260
+ maskSignature: true
261
+ },
262
+ jwtFields: [],
253
263
  };
254
264
 
255
265
  ```
@@ -387,7 +397,8 @@ const jsonInput2 = {
387
397
  },
388
398
  uuids: {
389
399
  uuid1: '123e4567-e89b-12d3-a456-426614174000'
390
- }
400
+ },
401
+ jwt: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1MTYyMzkwMjJ9.tbDepxpstvGdW8TC3G8zg4B6rUYAOvfzdceoH48wgRQ'
391
402
  };
392
403
 
393
404
  const jsonMaskConfig2 = {
@@ -414,6 +425,10 @@ const jsonMaskConfig2 = {
414
425
  // UUID
415
426
  uuidMaskOptions: { maskWith: "*", unmaskedStartCharacters: 4, unmaskedEndCharacters: 2 },
416
427
  uuidFields: ['uuids.uuid1']
428
+
429
+ // JWT
430
+ jwtMaskOptions: { maskWith: '*', maxMaskedCharacters: 512, maskDot: true, maskHeader: true, maskPayload: true, maskSignature: true},
431
+ jwtFields: ['jwt']
417
432
  };
418
433
 
419
434
  const maskedJsonOutput2 = MaskData.maskJSON2(jsonInput2, jsonMaskConfig2);
@@ -433,7 +448,8 @@ const maskedJsonOutput2 = MaskData.maskJSON2(jsonInput2, jsonMaskConfig2);
433
448
  addressLine1: '**** ** ** *********** ** **** ** ** ****',
434
449
  addressLine2: '*********** *'
435
450
  },
436
- uuids: { uuid1: '123e****-****-****-****-**********00' }
451
+ uuids: { uuid1: '123e****-****-****-****-**********00' },
452
+ jwt: '*********************************************************************************************************'
437
453
  }
438
454
 
439
455
  ```
@@ -65,7 +65,9 @@ const defaultjsonMask2Configs = {
65
65
  stringMaskOptions: defaultStringMaskOptions,
66
66
  stringFields: [],
67
67
  uuidMaskOptions: defaultUuidMaskOptions,
68
- uuidFields: []
68
+ uuidFields: [],
69
+ jwtMaskOptions: defaultJwtMaskOptions,
70
+ jwtFields: []
69
71
  };
70
72
 
71
73
  module.exports = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maskdata",
3
- "version": "1.2.5",
3
+ "version": "1.2.6",
4
4
  "description": "Node module to mask various kinds of data in the required formats",
5
5
  "main": "index.js",
6
6
  "typings": "index.d.ts",