{"id":32558339,"url":"https://github.com/shellicar/core-config","last_synced_at":"2026-01-20T16:58:44.728Z","repository":{"id":271271320,"uuid":"912914086","full_name":"shellicar/core-config","owner":"shellicar","description":null,"archived":false,"fork":false,"pushed_at":"2025-10-24T08:45:52.000Z","size":50,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-26T20:56:01.477Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/shellicar.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,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-01-06T16:45:56.000Z","updated_at":"2025-10-24T08:45:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"d9253f29-e02b-4414-b003-89a3d7d76fa7","html_url":"https://github.com/shellicar/core-config","commit_stats":null,"previous_names":["shellicar/core-config"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/shellicar/core-config","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellicar%2Fcore-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellicar%2Fcore-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellicar%2Fcore-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellicar%2Fcore-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shellicar","download_url":"https://codeload.github.com/shellicar/core-config/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellicar%2Fcore-config/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281533443,"owners_count":26517827,"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","status":"online","status_checked_at":"2025-10-28T02:00:06.022Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2025-10-28T23:54:23.073Z","updated_at":"2025-10-28T23:55:22.354Z","avatar_url":"https://github.com/shellicar.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @shellicar/core-config\n\n\u003e A library for securely handling sensitive configuration values like connection strings, URLs, and secrets.\n\n[![npm package](https://img.shields.io/npm/v/@shellicar/core-config.svg)](https://npmjs.com/package/@shellicar/core-config)\n[![build status](https://github.com/shellicar/core-config/actions/workflows/node.js.yml/badge.svg)](https://github.com/shellicar/core-config/actions/workflows/node.js.yml)\n\n## Features\n\n- 🔐 **SecureString** - Safely handle sensitive string values with automatic hashing for logs and serialisation\n- 🔗 **SecureConnectionString** - Parse and protect connection strings with configurable secret key detection\n- 🌐 **SecureURL** - Handle URLs while protecting sensitive components like passwords\n\n## Installation \u0026 Quick Start\n\n```sh\nnpm i --save @shellicar/core-config\n```\n\n```sh\npnpm add @shellicar/core-config\n```\n\n```ts\nimport { createFactory } from '@shellicar/core-config';\n\nconst factory = createFactory();\n\nconsole.log(factory.string('myPassword123'));\nconsole.log(factory.connectionString('Server=myserver.uri;Password=myPassword123'));\nconsole.log(factory.url(new URL('http://myuser:myPassword123@myserver.uri')));\n```\n\n\u003c!-- BEGIN_ECOSYSTEM --\u003e\n\n## @shellicar TypeScript Ecosystem\n\n### Core Libraries\n\n- [`@shellicar/core-config`](https://github.com/shellicar/core-config) - A library for securely handling sensitive configuration values like connection strings, URLs, and secrets.\n- [`@shellicar/core-di`](https://github.com/shellicar/core-di) - A basic dependency injection library.\n\n### Reference Architectures\n\n- [`@shellicar/reference-foundation`](https://github.com/shellicar/reference-foundation) - A comprehensive starter repository. Illustrates individual concepts.\n- [`@shellicar/reference-enterprise`](https://github.com/shellicar/reference-enterprise) - A comprehensive starter repository. Can be used as the basis for creating a new Azure application workload.\n\n### Build Tools\n\n- [`@shellicar/build-clean`](https://github.com/shellicar/build-clean) - Build plugin that automatically cleans unused files from output directories.\n- [`@shellicar/build-version`](https://github.com/shellicar/build-version) - Build plugin that calculates and exposes version information through a virtual module import.\n- [`@shellicar/build-graphql`](https://github.com/shellicar/build-graphql) - Build plugin that loads GraphQL files and makes them available through a virtual module import.\n\n### Framework Adapters\n\n- [`@shellicar/svelte-adapter-azure-functions`](https://github.com/shellicar/svelte-adapter-azure-functions) - A [SvelteKit adapter](https://kit.svelte.dev/docs/adapters) that builds your app into an Azure Function.\n- [`@shellicar/cosmos-query-builder`](https://github.com/shellicar/cosmos-query-builder) - Helper class for type safe advanced queries for Cosmos DB (Sql Core).\n\n### Logging \u0026 Monitoring\n\n- [`@shellicar/winston-azure-application-insights`](https://github.com/shellicar/winston-azure-application-insights) - An [Azure Application Insights](https://azure.microsoft.com/en-us/services/application-insights/) transport for [Winston](https://github.com/winstonjs/winston) logging library.\n- [`@shellicar/pino-applicationinsights-transport`](https://github.com/shellicar/pino-applicationinsights-transport) - [Azure Application Insights](https://azure.microsoft.com/en-us/services/application-insights) transport for [pino](https://github.com/pinojs/pino)\n\n\u003c!-- END_ECOSYSTEM --\u003e\n\n## Motivation\n\nTo make storing and comparing configuration including secrets easy and simple.\n\nYou can easily output or display your configuration, even secret/secure values, without having to manually hash them or extract them.\n\n## Feature Examples\n\nThree main classes, `SecureString`, `SecureConnectionString`, and `SecureURL`.\n\nSee [readme examples](./examples/readme/src) for example source code.\n\n- Handle strings.\n\n```typescript\nimport { createFactory } from '@shellicar/core-config';\n\nconst factory = createFactory();\nconst secret = factory.string('myPassword123');\n\nconsole.log(secret.toString()); \n// sha256:71d4ec024886c1c8e4707fb02b46fd568df44e77dd5055cadc3451747f0f2716\n\nconsole.log(JSON.stringify({ secret }));\n// {\"secret\":\"sha256:71d4ec024886c1c8e4707fb02b46fd568df44e77dd5055cadc3451747f0f2716\"}\n```\n\n- Handle connection strings (`Key=Value[;Key=Value...]`).\n\n```typescript\nimport { createFactory } from '@shellicar/core-config';\n\nconst factory = createFactory();\nconst conn = factory.connectionString('Server=myserver;Password=myPassword123');\nconsole.log(conn.toString());\n// Server=myserver;Password=sha256:71d4ec024886c1c8e4707fb02b46fd568df44e77dd5055cadc3451747f0f2716\n\n// Custom secret keys\nconsole.log(factory.connectionString('Server=myserver;SuperSecretKey=myPassword123', ['SuperSecretKey']));\n// {\n//   Server: 'myserver',\n//   SuperSecretKey: 'sha256:71d4ec024886c1c8e4707fb02b46fd568df44e77dd5055cadc3451747f0f2716'\n// }\n```\n\n- Handle URLs with passwords.information:\n\n```typescript\nimport { createFactory } from '@shellicar/core-config';\n\nconst factory = createFactory();\nconst url = new URL('https://user:myPassword123@example.com?key=value');\nconst secureUrl = factory.url(url);\n\nconsole.log(secureUrl.toString());\n// https://user:sha256%3A71d4ec024886c1c8e4707fb02b46fd568df44e77dd5055cadc3451747f0f2716@example.com/?key=value\n\nconsole.log(secureUrl);\n// {\n//   href: 'https://user@example.com/',\n//   password: 'sha256:71d4ec024886c1c8e4707fb02b46fd568df44e77dd5055cadc3451747f0f2716',\n//   searchParams: { key: 'value' }\n// }\n```\n\n- Use HMAC.\n\n```ts\nimport { createFactory } from '@shellicar/core-config';\n\nconst factory = createFactory({ secret: 'mySecret' });\nconst secret = factory.string('myPassword123');\n\nconsole.log(secret.toString()); \n// sha256:71d4ec024886c1c8e4707fb02b46fd568df44e77dd5055cadc3451747f0f2716\n\nconsole.log(JSON.stringify({ secret }));\n// {\"secret\":\"sha256:71d4ec024886c1c8e4707fb02b46fd568df44e77dd5055cadc3451747f0f2716\"}\n```\n\n### Default Secure Keys\n\nFor a list of default secure keys for connection strings, see [defaults.ts](./packages/core-config/src/defaults.ts).\n\n### Secure Output\n\nAll secure types implement proper toString(), toJSON(), and inspect() methods to ensure sensitive data is never accidentally exposed through logs or serialisation.\n\n### Real World Example\n\nUsing with Zod for environment variable validation:\n\n```typescript\nimport { env } from 'node:process';\nimport { createFactory } from '@shellicar/core-config';\nimport { z } from 'zod';\n\nconst factory = createFactory();\n\nconst envSchema = z.object({\n  // MongoDB connection string with username/password\n  MONGODB_URL: z.url().transform((x) =\u003e factory.url(new URL(x))),\n\n  // API key for external service\n  API_KEY: z\n    .string()\n    .min(1)\n    .transform((x) =\u003e factory.string(x)),\n\n  // SQL Server connection string\n  SQL_CONNECTION: z.string().transform((x) =\u003e factory.connectionString(x)),\n});\n\n// Parse environment variables\nconst config = envSchema.parse(env);\n\n// Values are now strongly typed and secured\nconsole.log(config.MONGODB_URL.toString());\n// mongodb://myuser:sha256%3A...@mongodb.example.com/\n\nconsole.log(config.API_KEY.toString());\n// sha256:...\n\nconsole.log(config.SQL_CONNECTION.toString());\n// Server=myserver;Database=mydb;User Id=admin;Password=sha256:...\n```\n\nAll sensitive values are automatically hashed in logs and serialisation, while still being accessible via the `secretValue` property when needed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshellicar%2Fcore-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshellicar%2Fcore-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshellicar%2Fcore-config/lists"}