{"id":13660686,"url":"https://github.com/pallad-ts/secret","last_synced_at":"2025-09-10T05:40:16.033Z","repository":{"id":36933813,"uuid":"231466439","full_name":"pallad-ts/secret","owner":"pallad-ts","description":"Prevent your secrets from accidental leak","archived":false,"fork":false,"pushed_at":"2023-03-04T05:34:30.000Z","size":774,"stargazers_count":7,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-12T11:04:32.256Z","etag":null,"topics":["config","credentials","logging","logs","nodejs","password","passwords","secret","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pallad-ts.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-01-02T22:01:34.000Z","updated_at":"2025-01-07T05:47:53.000Z","dependencies_parsed_at":"2024-01-15T20:50:41.508Z","dependency_job_id":"1cc0ba3c-b8ad-4dd0-9528-5f9b01be9eba","html_url":"https://github.com/pallad-ts/secret","commit_stats":{"total_commits":10,"total_committers":2,"mean_commits":5.0,"dds":0.09999999999999998,"last_synced_commit":"f87a674235e9c54aa61e274e4431d774ae453988"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pallad-ts/secret","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pallad-ts%2Fsecret","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pallad-ts%2Fsecret/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pallad-ts%2Fsecret/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pallad-ts%2Fsecret/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pallad-ts","download_url":"https://codeload.github.com/pallad-ts/secret/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pallad-ts%2Fsecret/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265883680,"owners_count":23843800,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["config","credentials","logging","logs","nodejs","password","passwords","secret","typescript"],"created_at":"2024-08-02T05:01:24.577Z","updated_at":"2025-07-19T03:37:14.085Z","avatar_url":"https://github.com/pallad-ts.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\u003ch1\u003eSecret 🤫\u003c/h1\u003e\n\n\u003cp\u003ePrevent your secrets from accidental leak\u003c/p\u003e\n\u003c/div\u003e\n\n---\n[![CircleCI](https://circleci.com/gh/pallad-ts/secret/tree/master.svg?style=svg)](https://circleci.com/gh/pallad-ts/secret/tree/master)\n[![npm version](https://badge.fury.io/js/@pallad%2Fsecret.svg)](https://badge.fury.io/js/@pallad%2Fsecret)\n[![Coverage Status](https://coveralls.io/repos/github/pallad-ts/secret/badge.svg?branch=master)](https://coveralls.io/github/pallad-ts/secret?branch=master)\n[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)\n---\n\n![Example code](./assets/intro-code.png)\n\nWraps any value and prevents it to:\n\n* be converted to string\n* serialized (for example by `JSON.stringify`)\n* inspected (through `util.inspect`)\n* logged (through `console.log`) or debugged.\n\n# Use cases\n\n* Passing around un/encrypted passwords\n* Storing confidential credentials (api keys, database passwords)\n* Wrapping config values\n\n# Features\n\n* 👷 Built with Typescript - full type friendly\n* ✅ Supports auto wrapping functions results with Secret\n* 😍 Easy integration with literally any library/framework\n\n# Community\n\nJoin our [discord server](https://discord.gg/paTBKBxXnA)\n\n# Installation\n\n```shell\nnpm install @pallad/secret\n```\n\n# Usage\n\nJust wrap it with `secret` or `new Secret`. It order to retrieve value you need to explicitly call `getValue` method\n\n```typescript\nimport {Secret, secret} from '@pallad/secret';\n\nconst SECRET = 'someProtectedValue!3234#@#%4';\n\nconst protectedValue = new Secret(SECRET);\n// or \nconst protectedValue2 = secret(SECRET);\n\nprotectedValue + ''; // '**SECRET**'\nprotectedValue.toString(); // '**SECRET**'\nutil.inspect(protectedValue); // **SECRET**\nconsole.log(protectedValue); // **SECRET**\nutil.inspect(protectedValue, {customInspect: false}); // Secret [**SECRET**] {}\n\nconsole.log(protectedValue.getValue()); // 'someProtectedValue!3234#@#%4'\n```\n\n## Custom description\n\nInstead of `'**SECRET**'` you can print something else.\n\n```typescript\nimport {Secret} from '@pallad/secret';\n\nconst protectedValue = new Secret(SECRET, 'CustomDescription');\n\nString(protectedValue); // 'CustomDescription'\n\nconsole.log(protectedValue); // CustomDescription\nutil.inspect(protectedValue, {customInspect: false}); // CustomDescription\n```\n\n## Wrapping function result\n\n`protect` wraps a function with another function that wraps returned value with secret for you.\n\n```typescript\nimport {protect, Secret} from '@pallad/secret';\n\nconst result1 = protect(x =\u003e 'protectedValue')();\nSecret.is(result1); // true\nresult1.getValue(); // 'protectedValue')\n```\n\nPromises are also handled (full type support)\n\n```typescript\nconst result2 = protect(x =\u003e Promise.resolve('protectedValue'))();\n\nresult2.then(x =\u003e {\n  Secret.is(x); // true\n  x.getValue(); // 'protectedValue'\n})\n```\n\n## Checking if value is Secret\n\n```typescript\nimport {Secret, secret} from '@pallad/secret';\n\nSecret.is(new Secret('test')) // true\nSecret.is(secret('test')) // true\nSecret.is(protect(() =\u003e 'test')()) // true\nSecret.is('secret') // false\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpallad-ts%2Fsecret","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpallad-ts%2Fsecret","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpallad-ts%2Fsecret/lists"}