masky

mask sensitive json

Usage no npm install needed!

<script type="module">
  import masky from 'https://cdn.skypack.dev/masky';
</script>

README

:asterisk:

masky

mask sensitive data



masky is a simple, no-fuss, value masker.

masky automatically masks all values in an object, recursively.

masky allows you to omit "safe" values and even caters for emails.

masky doesn't offer much in the way of customisations, it's content being what it is.



const masky = require("masky");

const mySecrets = {
  name: "Superman",
  alias: "Clarke Kent",
  contact: {
    phone: "0123999911",
    email: "clarke.kent@fortressofsolitude.com"
  }
};

const safeSecrets = masky.mask(mySecrets, ["name"]);

console.log(safeSecrets);
{
  "name": "Superman",
  "alias": "C********t",
  "contact": {
    "phone": "0*******1",
    "email": "c********t@fortressofsolitude.com"
  }
}

or mask a single value:

masky.maskString("04fad440-aae2-4596-b9cc-800204eaf8ac");
"04fad4e***********************af8ac"