Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: Ability to custom set masking options #11

Closed
ericlau-solid opened this issue Jan 8, 2021 · 14 comments
Closed

Request: Ability to custom set masking options #11

ericlau-solid opened this issue Jan 8, 2021 · 14 comments

Comments

@ericlau-solid
Copy link

This library seems great so far. The only thing I would like to add is ability to custom set masking option, like masking all values with * but the last X chars (show those).

@Sumukha1496
Copy link
Owner

Hi @ericlau-solid , For which masking you want this option? The feature you are talking about is already there.
there is a configuration parameter "maskWith". With the help of this option, you can change the to "X" or other characters.

If you can tell me the exact use case, I can give the sample configuration.

@Sumukha1496
Copy link
Owner

Send me the use case, How you are using it currently with the dummy code. I can send you the corresponding documentation and a way to do it. In case the feature is not available, I can include it in the next version.

@Sumukha1496
Copy link
Owner

Sumukha1496 commented Jan 11, 2021

@ericlau-solid , Got it.
You want to mask all values and show only last X characters.

But which function you are using? There are mask string, card, password, email, phone, etc... functions.

There is an option "unmaskedEndDigits" which can be used for this purpose. But let me know your exact use case with some examples. I can help better

@ericlau-solid
Copy link
Author

@Sumukha1496 api keys, passwords. There are plenty of things like api keys that are secret, but we need to show the last XXXX characters so devs can compare and reasonably conclude whether key X or Y was recorded.

@Sumukha1496
Copy link
Owner

@ericlau-solid, Got it. Let me think about it. I will add this in this next version. You can expect the new version before the end of this week.

@Sumukha1496
Copy link
Owner

This is WIP. Some more testing and load testing is pending. I will roll out the new version once they are completed

@Sumukha1496
Copy link
Owner

Sumukha1496 commented Jan 18, 2021

@ericlau-solid, If I am not wrong, what you are looking for is something like this: https://www.npmjs.com/package/maskdata#release-features

Please check it and let me know. Once you confirm its working, I will close the ticket.

@Sumukha1496
Copy link
Owner

You can use the version: 1.1.3

@Sumukha1496
Copy link
Owner

Also, Please take a look into the configuration: "maxMaskedCharacters".
Use --> Assume your secret key/password is a big string. When we mask it, it will become simply *********************.......

But if you don't want as many characters as in the input string and want to limit it, set maxMaskedCharacters to some valid value. You can check the documentation for more info and example

@Sumukha1496
Copy link
Owner

@ericlau-solid, Let me know once you check the new version. This helps in closing the issue ticket

@ericlau-solid
Copy link
Author

@Sumukha1496 looks good. Consider it closed.

@Sumukha1496
Copy link
Owner

@ericlau-solid , Thanks for the verification

@Marufa-Mukadam
Copy link

how can i retrieve the original password for user login verification

@Sumukha1496
Copy link
Owner

@Marufa-Mukadam, This library masks a password and do not encrypt it. So, there is no way to retrieve the original password after masking it. If your usecase is securely storing the password and then do login verification, you need to encrypt the password and compare the hash to do login verification.

This library is mainly for logging, non-retrieve usecases. Hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants