svelte-api-keys
svelte-api-keys copied to clipboard
API Key Generation, Validation, and Rate Limiting for SvelteKit
Cover lots of databases for key storage - use something like Drizzle (?)
closes #11
e.g. for cloudflare, when it would be in a http header (`True-Client-IP`?) instead of using SvelteKit's `event.getClientAddress()`
Unless the key size is way too small the chances are so tiny as to be impossible, which means it's guaranteed to happen ...
Example: you have an API route `/routes/api/projects/[id]/+server.ts` You could have a permission allowing you access to _all_ projects, such as `project:*` or you might want a token that only allows...
Document how to implement API Key Prefixes to indicate usage, similar as Stripe's `pk_test_` (prefix can be stripped out via custom fn in key extractor)