(kv: KVNamespace, apiKey: string)
| 51 | } |
| 52 | |
| 53 | async function verifyAPIKey(kv: KVNamespace, apiKey: string): Promise<boolean> { |
| 54 | const val = await kv.get(`ak:${apiKey}`); |
| 55 | return val !== null; |
| 56 | } |
| 57 | |
| 58 | async function getTokenPool(kv: KVNamespace): Promise<{ id: string; token: string }[]> { |
| 59 | const list = await kv.list({ prefix: "rt:" }); |