{"id":24271773,"url":"https://github.com/soenneker/soenneker.validators.expiringkey","last_synced_at":"2026-06-09T22:00:37.139Z","repository":{"id":243961218,"uuid":"813884385","full_name":"soenneker/soenneker.validators.expiringkey","owner":"soenneker","description":"A validation module that checks for keys, stores them, expires them after an amount of time","archived":false,"fork":false,"pushed_at":"2026-06-06T16:42:23.000Z","size":1782,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-06-06T17:15:55.258Z","etag":null,"topics":["csharp","dotnet","expiration","expiring","expiringkey","expiringkeyvalidator","key","validator","validators"],"latest_commit_sha":null,"homepage":"https://soenneker.com","language":"C#","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/soenneker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"soenneker","thanks_dev":"soenneker"}},"created_at":"2024-06-11T23:47:47.000Z","updated_at":"2026-06-06T15:32:14.000Z","dependencies_parsed_at":"2024-08-06T23:16:55.643Z","dependency_job_id":"d4bcba67-1274-496a-8210-165caed44156","html_url":"https://github.com/soenneker/soenneker.validators.expiringkey","commit_stats":null,"previous_names":["soenneker/soenneker.validators.expiringkey"],"tags_count":68,"template":false,"template_full_name":null,"purl":"pkg:github/soenneker/soenneker.validators.expiringkey","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soenneker%2Fsoenneker.validators.expiringkey","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soenneker%2Fsoenneker.validators.expiringkey/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soenneker%2Fsoenneker.validators.expiringkey/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soenneker%2Fsoenneker.validators.expiringkey/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/soenneker","download_url":"https://codeload.github.com/soenneker/soenneker.validators.expiringkey/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soenneker%2Fsoenneker.validators.expiringkey/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34127345,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-09T02:00:06.510Z","response_time":63,"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":["csharp","dotnet","expiration","expiring","expiringkey","expiringkeyvalidator","key","validator","validators"],"created_at":"2025-01-15T17:59:30.261Z","updated_at":"2026-06-09T22:00:37.133Z","avatar_url":"https://github.com/soenneker.png","language":"C#","funding_links":["https://github.com/sponsors/soenneker","https://thanks.dev/soenneker"],"categories":[],"sub_categories":[],"readme":"[![](https://img.shields.io/nuget/v/soenneker.validators.expiringkey.svg?style=for-the-badge)](https://www.nuget.org/packages/soenneker.validators.expiringkey/)\n[![](https://img.shields.io/github/actions/workflow/status/soenneker/soenneker.validators.expiringkey/publish-package.yml?style=for-the-badge)](https://github.com/soenneker/soenneker.validators.expiringkey/actions/workflows/publish-package.yml)\n[![](https://img.shields.io/nuget/dt/soenneker.validators.expiringkey.svg?style=for-the-badge)](https://www.nuget.org/packages/soenneker.validators.expiringkey/)\n[![](https://img.shields.io/github/actions/workflow/status/soenneker/soenneker.validators.expiringkey/codeql.yml?label=CodeQL\u0026style=for-the-badge)](https://github.com/soenneker/soenneker.validators.expiringkey/actions/workflows/codeql.yml)\n\n# ![](https://user-images.githubusercontent.com/4441470/224455560-91ed3ee7-f510-4041-a8d2-3fc093025112.png) Soenneker.Validators.ExpiringKey\n### A validation module that checks for keys, stores them, expires them after an amount of time\n\nIdeal for caching, session management, and more.\n\n## ?? Features\n\n- **Validate Key**: Check if a key exists.\n- **Add Key**: Add a key with an expiration time.\n- **Validate and Add**: Validate if a key exists and add it if not.\n- **Remove Key**: Remove a key.\n\n## Installation\n\n```\ndotnet add package Soenneker.Validators.ExpiringKey\n```\n\n## ?? Usage\n\n`IExpiringKeyValidator` can be registered within DI, and injected:\n\n```csharp\npublic static async Task Main(string[] args)\n{\n    ...\n    builder.Services.AddExpiringKeyValidatorAsSingleton();\n}\n```\n\nor it can be initialized manually: `new ExpiringKeyValidator()`.\n\n### Validate Key\n\nCheck if a key is present.\n\n```csharp\nbool Validate(string key)\n```\n\n### Add Key\n\nAdd a key with an expiration time.\n\n```csharp\nvoid Add(string key, int expirationTimeMilliseconds)\n```\n\n### Validate and Add Key\n\nValidate a key and add it if it doesn't exist.\n\n```csharp\nbool ValidateAndAdd(string key, int expirationTimeMilliseconds) // true if doesn't exist, false if it does\n```\n\n### Remove Key\n\nRemove a key.\n\n```csharp\nvoid Remove(string key)\n```\n\n## Example\n\n```csharp\nvar validator = new ExpiringKeyValidator();\nvalidator.Add(\"key1\", 5000); // 5 seconds\n\nvar invalid = validator.Validate(\"key1\"); // false, key exists\n\nawait Task.Delay(7000); // wait 7 seconds\n\nvar validAfterTime = validator.Validate(\"key1\"); // true, key does not exist\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoenneker%2Fsoenneker.validators.expiringkey","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoenneker%2Fsoenneker.validators.expiringkey","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoenneker%2Fsoenneker.validators.expiringkey/lists"}