@japikey/cloudflare 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/router.js +2 -2
- package/package.json +17 -15
package/dist/router.js
CHANGED
|
@@ -145,7 +145,7 @@ async function handleListApiKeysRequest(request, env, options) {
|
|
|
145
145
|
async function handleGetApiKeyRequest(request, env, options, keyId) {
|
|
146
146
|
const userId = await options.getUserId(request, env);
|
|
147
147
|
const apiKey = await options.db.getApiKey(keyId);
|
|
148
|
-
if (
|
|
148
|
+
if (apiKey?.user_id !== userId) {
|
|
149
149
|
throw new NotFoundError('API key not found');
|
|
150
150
|
}
|
|
151
151
|
return new Response(JSON.stringify(apiKey), {
|
|
@@ -157,7 +157,7 @@ async function handleGetApiKeyRequest(request, env, options, keyId) {
|
|
|
157
157
|
async function handleRevokeApiKeyRequest(request, env, options, keyId) {
|
|
158
158
|
const userId = await options.getUserId(request, env);
|
|
159
159
|
const apiKey = await options.db.getApiKey(keyId);
|
|
160
|
-
if (
|
|
160
|
+
if (apiKey?.user_id !== userId) {
|
|
161
161
|
throw new NotFoundError('API key not found');
|
|
162
162
|
}
|
|
163
163
|
await options.db.revokeApiKey({ user_id: userId, kid: keyId });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@japikey/cloudflare",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Cloudflare worker-based endpoints for japikey",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=22.5.0"
|
|
@@ -38,29 +38,31 @@
|
|
|
38
38
|
"test:coverage": "vitest --coverage",
|
|
39
39
|
"clean": "rimraf dist",
|
|
40
40
|
"build": "npm run clean && tsc",
|
|
41
|
-
"lint": "eslint
|
|
41
|
+
"lint": "eslint .",
|
|
42
42
|
"lint:fix": "eslint . --fix",
|
|
43
43
|
"format": "prettier --write src/**/*.ts",
|
|
44
44
|
"format:check": "prettier --check src/**/*.ts"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@japikey/japikey": "0.4.
|
|
48
|
-
"path-to-regexp": "^
|
|
47
|
+
"@japikey/japikey": "0.4.1",
|
|
48
|
+
"path-to-regexp": "^9.0.0",
|
|
49
|
+
"@japikey/shared": "0.4.1",
|
|
50
|
+
"uuid": "^14.0.3"
|
|
49
51
|
},
|
|
50
52
|
"devDependencies": {
|
|
51
|
-
"@types/node": "^
|
|
52
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
53
|
-
"@typescript-eslint/parser": "^8.
|
|
54
|
-
"@vitest/coverage-v8": "^
|
|
55
|
-
"eslint": "^
|
|
53
|
+
"@types/node": "^26.6.6",
|
|
54
|
+
"@typescript-eslint/eslint-plugin": "^8.72.2",
|
|
55
|
+
"@typescript-eslint/parser": "^8.72.2",
|
|
56
|
+
"@vitest/coverage-v8": "^5.1.0",
|
|
57
|
+
"eslint": "^10.15.0",
|
|
56
58
|
"eslint-config-prettier": "^10.1.8",
|
|
57
|
-
"globals": "^14.0
|
|
58
|
-
"jose": "^6.
|
|
59
|
-
"prettier": "^3.
|
|
60
|
-
"rimraf": "^6.
|
|
61
|
-
"vitest": "^
|
|
59
|
+
"globals": "^17.14.0",
|
|
60
|
+
"jose": "^6.2.17",
|
|
61
|
+
"prettier": "^3.10.1",
|
|
62
|
+
"rimraf": "^6.1.4",
|
|
63
|
+
"vitest": "^5.1.0"
|
|
62
64
|
},
|
|
63
65
|
"peerDependencies": {
|
|
64
|
-
"@cloudflare/workers-types": "^
|
|
66
|
+
"@cloudflare/workers-types": "^5.20261114.1"
|
|
65
67
|
}
|
|
66
68
|
}
|