{"_id":"@dsegovia90/redacted","_rev":"4-011ae41457f4b15dafa6d4e5e67f23e4","name":"@dsegovia90/redacted","dist-tags":{"latest":"0.0.6"},"versions":{"0.0.3":{"name":"@dsegovia90/redacted","version":"0.0.3","license":"MIT","_id":"@dsegovia90/redacted@0.0.3","maintainers":[{"name":"dsegovia90","email":"segoarce90@gmail.com"}],"homepage":"https://github.com/dsegovia90/redacted#readme","bugs":{"url":"https://github.com/dsegovia90/redacted/issues"},"dist":{"shasum":"03ebf91a3e2c4624a11bc8ebca73aa5bc623787a","tarball":"https://registry.npmjs.org/@dsegovia90/redacted/-/redacted-0.0.3.tgz","fileCount":17,"integrity":"sha512-yR4Xof4aqfOWwLpuCYqR+jJaJJNyrQXwUChwrQoWxfEaVbiqLFFIAGlRVjdwZLsTV9+7oKxQqymvBopp6dlpQA==","signatures":[{"sig":"MEQCICT+3faoLQMHHZypTWu32nP3b+GHVxznY84oGXe5b12CAiA9+kX6OXZflbjI2Ty+fmVFIreyBpo/soHBAi50/ORGjg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":23345},"main":"./script/mod.js","types":"./script/mod.d.ts","module":"./esm/mod.js","exports":{".":{"import":"./esm/mod.js","require":"./script/mod.js"}},"gitHead":"ce139daa1d28f08859d82b0971c155af62e0716f","scripts":{"test":"node test_runner.js"},"_npmUser":{"name":"dsegovia90","email":"segoarce90@gmail.com"},"repository":{"url":"git+https://github.com/dsegovia90/redacted.git","type":"git"},"_npmVersion":"10.8.2","description":"Explicit access to sensitive data. Wraps values in a Redacted class to protect them from being leaked into loggers (ie: console.log) and serializers. Works with zod.","directories":{},"_nodeVersion":"22.5.1","_hasShrinkwrap":false,"devDependencies":{"zod":"^3.24.3","picocolors":"^1.0.0","@types/node":"^20.9.0"},"_npmOperationalInternal":{"tmp":"tmp/redacted_0.0.3_1745290570251_0.07031845657703695","host":"s3://npm-registry-packages-npm-production"}},"0.0.4":{"name":"@dsegovia90/redacted","version":"0.0.4","license":"MIT","_id":"@dsegovia90/redacted@0.0.4","maintainers":[{"name":"dsegovia90","email":"segoarce90@gmail.com"}],"homepage":"https://github.com/dsegovia90/redacted#readme","bugs":{"url":"https://github.com/dsegovia90/redacted/issues"},"dist":{"shasum":"48548c64375e956e53b6aeb555590537c3041011","tarball":"https://registry.npmjs.org/@dsegovia90/redacted/-/redacted-0.0.4.tgz","fileCount":17,"integrity":"sha512-cbaZLGyawV6Zn+OHRkdwdclxchygDd8YnINikerEzfDuyRRdmHSJMCKVNi0wMTb4tj0c9OMVeSrcnRoBUeRbJw==","signatures":[{"sig":"MEUCIERRkVOYP2Z0QnFz6bnXXoIbowR+q5+TkS3Nn+u1gpoOAiEA5B8x5HNrOgVWm8RNPXI19H6LyMXCJZmwHtN23u8cn/E=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":23665},"main":"./script/mod.js","types":"./script/mod.d.ts","module":"./esm/mod.js","exports":{".":{"import":"./esm/mod.js","require":"./script/mod.js"}},"gitHead":"95874c2122eb813f6d5ca4d07c17e976bcd88480","scripts":{"test":"node test_runner.js"},"_npmUser":{"name":"dsegovia90","email":"segoarce90@gmail.com"},"repository":{"url":"git+https://github.com/dsegovia90/redacted.git","type":"git"},"_npmVersion":"10.8.2","description":"Explicit access to sensitive data. Wraps values in a Redacted class to protect them from being leaked into loggers (ie: console.log) and serializers. Works with zod.","directories":{},"_nodeVersion":"22.5.1","_hasShrinkwrap":false,"devDependencies":{"zod":"^3.24.3","picocolors":"^1.0.0","@types/node":"^20.9.0"},"_npmOperationalInternal":{"tmp":"tmp/redacted_0.0.4_1745336978723_0.9186913500680665","host":"s3://npm-registry-packages-npm-production"}},"0.0.5":{"name":"@dsegovia90/redacted","version":"0.0.5","license":"MIT","_id":"@dsegovia90/redacted@0.0.5","maintainers":[{"name":"dsegovia90","email":"segoarce90@gmail.com"}],"homepage":"https://github.com/dsegovia90/redacted#readme","bugs":{"url":"https://github.com/dsegovia90/redacted/issues"},"dist":{"shasum":"885a4260763bcf4fafef73e11be6267910c250c8","tarball":"https://registry.npmjs.org/@dsegovia90/redacted/-/redacted-0.0.5.tgz","fileCount":17,"integrity":"sha512-J2N/bsOwGsiP++IUsA3AzanQsAxIK8XZXJkDswFp07XhJXoVUeZbxD2jwfl2jCOOCuzjI25/g4cOs8hoqmWkmg==","signatures":[{"sig":"MEYCIQDqWhJZhQOXw0VoVdcAJnj9P21tnYwkAZjDAJ0OP96+kwIhAPUbWYADcDGC7XGtyIY4KUWwKOs3YJypZ6fjmMaGZYrT","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":23687},"main":"./script/mod.js","types":"./script/mod.d.ts","module":"./esm/mod.js","exports":{".":{"import":"./esm/mod.js","require":"./script/mod.js"}},"gitHead":"040efb73d56179006880a978fd0f37e8974a11ef","scripts":{"test":"node test_runner.js"},"_npmUser":{"name":"dsegovia90","email":"segoarce90@gmail.com"},"repository":{"url":"git+https://github.com/dsegovia90/redacted.git","type":"git"},"_npmVersion":"10.8.2","description":"Explicit access to sensitive data. Wraps values in a Redacted class to protect them from being leaked into loggers (ie: console.log) and serializers. Works with zod.","directories":{},"_nodeVersion":"22.5.1","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"zod":"^3.24.3","picocolors":"^1.0.0","@types/node":"^20.9.0"},"_npmOperationalInternal":{"tmp":"tmp/redacted_0.0.5_1745375623074_0.41318461022988595","host":"s3://npm-registry-packages-npm-production"}},"0.0.6":{"name":"@dsegovia90/redacted","version":"0.0.6","description":"Explicit access to sensitive data. Wraps values in a Redacted class to protect them from being leaked into loggers (ie: console.log) and serializers. Works with zod.","keywords":["redaction","sensitive data","logging","serialization","secrecy"],"repository":{"type":"git","url":"git+https://github.com/dsegovia90/redacted.git"},"license":"MIT","bugs":{"url":"https://github.com/dsegovia90/redacted/issues"},"main":"./script/mod.js","module":"./esm/mod.js","exports":{".":{"import":"./esm/mod.js","require":"./script/mod.js"}},"scripts":{"test":"node test_runner.js"},"dependencies":{},"devDependencies":{"zod":"^3.24.3","@types/node":"^20.9.0","picocolors":"^1.0.0"},"_id":"@dsegovia90/redacted@0.0.6","gitHead":"a06264bd787c253eae9528fe19ed8e2190edbeca","types":"./script/mod.d.ts","homepage":"https://github.com/dsegovia90/redacted#readme","_nodeVersion":"22.5.1","_npmVersion":"10.8.2","dist":{"integrity":"sha512-m9bqc4b0U1aMZdMPkuNwSVaewpzRZcIZva6Pof7cH0ObTffN7r4i81ueREj/aeJXhLSqFZT/fgIdgHAUNlcHfA==","shasum":"2c163ffb236057e8d7635a03fadf0aa27d96242d","tarball":"https://registry.npmjs.org/@dsegovia90/redacted/-/redacted-0.0.6.tgz","fileCount":17,"unpackedSize":23797,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCWaibQMEZoC2YkmNJhJ83d+cZDZTptC85JcJ3ZKSLX+gIgDsYI+QNO5bA73XYOeNWbuPwYYzUCdSzOq5FKHeTr2zg="}]},"_npmUser":{"name":"dsegovia90","email":"segoarce90@gmail.com"},"directories":{},"maintainers":[{"name":"dsegovia90","email":"segoarce90@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/redacted_0.0.6_1745375803226_0.26786266597914876"},"_hasShrinkwrap":false}},"time":{"created":"2025-04-22T02:56:10.189Z","modified":"2025-04-23T02:36:43.644Z","0.0.3":"2025-04-22T02:56:10.445Z","0.0.4":"2025-04-22T15:49:38.887Z","0.0.5":"2025-04-23T02:33:43.283Z","0.0.6":"2025-04-23T02:36:43.474Z"},"bugs":{"url":"https://github.com/dsegovia90/redacted/issues"},"license":"MIT","homepage":"https://github.com/dsegovia90/redacted#readme","repository":{"type":"git","url":"git+https://github.com/dsegovia90/redacted.git"},"description":"Explicit access to sensitive data. Wraps values in a Redacted class to protect them from being leaked into loggers (ie: console.log) and serializers. Works with zod.","maintainers":[{"name":"dsegovia90","email":"segoarce90@gmail.com"}],"readme":"```zsh\n### GO FROM THIS ❌\n\nconsole.log(userPrivateInfo)\n{\n  id: \"1234567890\",\n  email: \"user@example.com\",\n  name: \"John Doe\",\n  address: \"123 Main St\",\n  phone: \"555-555-5555\",\n  public_thing: \"public value\"\n}\n\n### TO THIS ✅\nconsole.log(userPrivateInfo)\n{\n  id: Redacted {},\n  email: Redacted {},\n  name: Redacted {},\n  address: Redacted {},\n  phone: Redacted {},\n  public_thing: \"public value\",\n  public_thing2: \"public value2\"\n}\n```\n\n# Inspiration\nHeavily inspired by rust [secrecy crate](https://crates.io/crates/secrecy).\n\n# Usage\n\n## JavaScript\n```js\nconst userData = {\n  privateData: Redacted(\"user@example.com\")\n}\n\nconsole.log(userData.privateData) // outputs: Redacted {}\n\n// Access private fields explicitly with:\nconst privateData = userData.privateData.exposeSecret();\n```\n\n## TypeScript\n```ts\ninterface UserData {\n  privateData: Redacted<string>;\n}\n\nconst userData = {\n  privateData: Redacted(\"user@example.com\")\n}\n\nconsole.log(userData.privateData) // outputs: Redacted {}\n\n// Access private fields explicitly with:\nconst privateData = userData.privateData.exposeSecret();\n```\n\n## With Zod\n\nNote that fields that not meet the zod schema will fail on `parse()`.\n```ts\nimport { z } from \"zod\";\nimport { redactedZodV3 } from \"@dsegovia/redacted\";\n\nconst userSchema = z.object({\n  id: redactedZodV3(z.string().uuid()),\n  email: redactedZodV3(z.string().email()),\n  name: redactedZodV3(z.string().min(2).max(100)),\n  address: redactedZodV3(z.string().min(5).max(200)),\n  phone: redactedZodV3(z.string().min(10).max(20)),\n  public_thing: z.string().min(1).max(100),\n  public_thing2: z.string().min(1).max(100),\n});\n\nconst json = { // This can come from a file or API response\n  id: \"1234567890\",\n  email: \"user@example.com\",\n  name: \"John Doe\",\n  address: \"123 Main St\",\n  phone: \"555-555-5555\",\n  public_thing: \"public value\",\n  public_thing2: \"public value2\"\n}\n\nconst parsed = userSchema.parse(json);\nparsed.id.exposeSecret(); // explicitly access the secret value\n\n// or\n\nconst safeParsed = userSchema.safeParse(json);\n```\n","readmeFilename":"README.md","keywords":["redaction","sensitive data","logging","serialization","secrecy"]}