- Cloudflare account
- Wrangler CLI installed (
npm install -g wrangler) - Discord bot token
- Node.js v16+
npm installwrangler loginwrangler kv:namespace create "TOKENS_KV"
wrangler kv:namespace create "ENCRYPTION_KV"
wrangler kv:namespace create "LOGS_KV"Copy the namespace IDs and update wrangler.toml.
Update the SHARED_SECRET in wrangler.toml or use:
wrangler secret put SHARED_SECRETGenerate a random 32-byte base64 key:
# PowerShell
$bytes = New-Object byte[] 32
[Security.Cryptography.RNGCryptoServiceProvider]::Create().GetBytes($bytes)
[Convert]::ToBase64String($bytes)Then set it:
wrangler kv:key put --namespace-id=YOUR_ENCRYPTION_KV_ID "encryption_key" "YOUR-BASE64-KEY"wrangler kv:key put --namespace-id=YOUR_TOKENS_KV_ID "tokens" '{"active":"YOUR-BOT-TOKEN"}'wrangler deployname = "kurinium-proxy"
main = "src/index.js"
compatibility_date = "2025-12-22"
[[kv_namespaces]]
binding = "TOKENS_KV"
id = "YOUR_TOKENS_KV_ID"
[[kv_namespaces]]
binding = "ENCRYPTION_KV"
id = "YOUR_ENCRYPTION_KV_ID"
[[kv_namespaces]]
binding = "LOGS_KV"
id = "YOUR_LOGS_KV_ID"
[vars]
SHARED_SECRET = "YOUR-SHARED-SECRET-KEY"- Get your worker URL from Cloudflare dashboard
- Test the debug endpoint:
curl https://YOUR-WORKER.workers.dev/debug- Update your Rust client's
src/config.rswith the worker URL
POST /key- Retrieve encryption key (requires shared secret)POST /api/*- Discord API proxy (encrypted)GET /debug- Debug information
- Ensure you've set the encryption key in KV storage
- Check the namespace ID matches in wrangler.toml
- Set the Discord bot token in TOKENS_KV
- Format:
{"active":"BOT-TOKEN-HERE"}
- Verify shared secret matches between client and worker
- Check for whitespace or encoding issues