Sumukha1496 / maskdata

maskdata is a node.js module to mask various kinds of data
MIT License
92 stars 7 forks source link

Fixed mask string #46

Closed lukematthews closed 1 month ago

lukematthews commented 1 month ago

I've just started using your library and it's really good.

Something I haven't been able to find yet is how to have a standard mask response. In our use case, any field that is masked should be masked with '**' (6 characters * character) What this allows you to do is just show that there is a value. Length of the string could potentially be identifying.

Any advice would be appreciated. Thanks.

Sumukha1496 commented 1 month ago

Hi @lukematthews , Yes this is possible. You need to set maxMaskedCharacters to 6 which will result in at max 6 masked characters in the output. Example: https://www.npmjs.com/package/maskdata#mask-password https://www.npmjs.com/package/maskdata#generic-string-masking

lukematthews commented 1 month ago

Thanks for the quick reply, that limits it to 6. What that means though is that if the masked string is only 3 characters, you get ***

I was hoping for 6 character long mask regardless of string length.

Not a deal breaker though. The feature request would be something like

As a user When I have a field that needs to be masked I want to be able to specify a single constant value that will be used as the masked value response So that I cannot expose that values have a length less than the maxMaskedCharacters

{ fixedMaskValue: '******' }

Thoughts?

Sumukha1496 commented 1 month ago

@lukematthews , Got it. Let me include this in the next version.

Sumukha1496 commented 1 month ago

Hello @lukematthews , Please check this: https://www.npmjs.com/package/maskdata#release-features Hope this is what you were looking for