2.4 KiB
CapyKit
CapyKit is a practical .NET utility library for the small pieces of application code that tend to get rewritten from project to project. It includes focused helpers for strings, collections, serialization, compression, password hashing, random value generation, key validation, calculations, resource pooling, and lightweight library diagnostics.
The project started as shared infrastructure for HappyCapy and is now packaged as a standalone toolkit for .NET 8 applications.
What Is Included
- Extension methods for strings, enums, objects, and LINQ collections.
- JSON serialization and gzip compression helpers.
- PBKDF2 password hashing, salt generation, and random token/password generation.
- HMAC-backed formatted key generation and validation.
- Distance, unit conversion, angle conversion, and quick hash helpers.
- A simple resource pool abstraction.
CapyEventReporterfor routing CapyKit warnings and errors into your own logging system.- A generated DocFX API reference for the public surface area.
Install
dotnet add package CapyKit
For local development from this repository:
dotnet add reference ./CapyKit/CapyKit.csproj
Quick Example
using CapyKit;
using CapyKit.Extensions;
using CapyKit.Helpers;
var name = incomingName.IfNullOrWhiteSpace("Guest");
var page = users.Page(pageNumber: 1, pageSize: 25);
Password password = SecurityHelper.Pbkdf2("correct horse battery staple");
bool matches = SecurityHelper.CompareHashedPassword(
password,
"correct horse battery staple",
password.Salt,
Password.Pbkdf2Algorithm);
Documentation
The documenation for using the library can be viewed online here. API documenation is also rendered and available.
To build and serve the documentation locally:
dotnet tool install -g docfx
docfx Docs/docfx.json --serve
DocFX writes the generated site to Docs/_site.
Project Status
CapyKit is a growing utility library. Some APIs are mature and covered by tests, while others are still being rounded out as the project transitions from private shared code into a public package. Review the generated API reference and tests when adopting a helper in production code.
License
This project is licensed under the terms in LICENSE.