@cedarjs/auth-clerk-api 1.1.1-next.0 → 1.1.1-next.18

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/decoder.d.ts CHANGED
@@ -1,7 +1,3 @@
1
1
  import type { Decoder } from '@cedarjs/api';
2
- /**
3
- * @deprecated This function will be removed; it uses a rate-limited API. Use `clerkAuthDecoder` instead.
4
- */
5
- export declare const authDecoder: Decoder;
6
2
  export declare const clerkAuthDecoder: Decoder;
7
3
  //# sourceMappingURL=decoder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"decoder.d.ts","sourceRoot":"","sources":["../src/decoder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAE3C;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,OAiCzB,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,OAkC9B,CAAA"}
1
+ {"version":3,"file":"decoder.d.ts","sourceRoot":"","sources":["../src/decoder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAE3C,eAAO,MAAM,gBAAgB,EAAE,OA6B9B,CAAA"}
package/dist/decoder.js CHANGED
@@ -28,49 +28,18 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
  var decoder_exports = {};
30
30
  __export(decoder_exports, {
31
- authDecoder: () => authDecoder,
32
31
  clerkAuthDecoder: () => clerkAuthDecoder
33
32
  });
34
33
  module.exports = __toCommonJS(decoder_exports);
35
- const authDecoder = async (token, type) => {
36
- if (type !== "clerk") {
37
- return null;
38
- }
39
- const { users, verifyToken } = await import("@clerk/clerk-sdk-node");
40
- try {
41
- const issuer = (iss) => iss.startsWith("https://clerk.") || iss.includes(".clerk.accounts");
42
- const jwtPayload = await verifyToken(token, {
43
- issuer,
44
- apiUrl: process.env.CLERK_API_URL || "https://api.clerk.dev",
45
- jwtKey: process.env.CLERK_JWT_KEY,
46
- apiKey: process.env.CLERK_API_KEY,
47
- secretKey: process.env.CLERK_SECRET_KEY
48
- });
49
- if (!jwtPayload.sub) {
50
- return Promise.reject(new Error("Session invalid"));
51
- }
52
- const user = await users.getUser(jwtPayload.sub);
53
- return {
54
- ...user,
55
- roles: user.publicMetadata["roles"] ?? []
56
- };
57
- } catch (error) {
58
- console.error(error);
59
- return Promise.reject(error);
60
- }
61
- };
62
34
  const clerkAuthDecoder = async (token, type) => {
63
35
  if (type !== "clerk") {
64
36
  return null;
65
37
  }
66
- const { verifyToken } = await import("@clerk/clerk-sdk-node");
38
+ const { verifyToken } = await import("@clerk/backend");
67
39
  try {
68
- const issuer = (iss) => iss.startsWith("https://clerk.") || iss.includes(".clerk.accounts");
69
40
  const jwtPayload = await verifyToken(token, {
70
- issuer,
71
- apiUrl: process.env.CLERK_API_URL || "https://api.clerk.dev",
41
+ apiUrl: process.env.CLERK_API_URL,
72
42
  jwtKey: process.env.CLERK_JWT_KEY,
73
- apiKey: process.env.CLERK_API_KEY,
74
43
  secretKey: process.env.CLERK_SECRET_KEY
75
44
  });
76
45
  if (!jwtPayload.sub) {
@@ -87,6 +56,5 @@ const clerkAuthDecoder = async (token, type) => {
87
56
  };
88
57
  // Annotate the CommonJS export names for ESM import in node:
89
58
  0 && (module.exports = {
90
- authDecoder,
91
59
  clerkAuthDecoder
92
60
  });
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { authDecoder, clerkAuthDecoder } from './decoder';
1
+ export { clerkAuthDecoder } from './decoder';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA"}
package/dist/index.js CHANGED
@@ -18,13 +18,11 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var index_exports = {};
20
20
  __export(index_exports, {
21
- authDecoder: () => import_decoder.authDecoder,
22
21
  clerkAuthDecoder: () => import_decoder.clerkAuthDecoder
23
22
  });
24
23
  module.exports = __toCommonJS(index_exports);
25
24
  var import_decoder = require("./decoder");
26
25
  // Annotate the CommonJS export names for ESM import in node:
27
26
  0 && (module.exports = {
28
- authDecoder,
29
27
  clerkAuthDecoder
30
28
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/auth-clerk-api",
3
- "version": "1.1.1-next.0+4e91c835e",
3
+ "version": "1.1.1-next.18+5ffd3124d",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/cedarjs/cedar.git",
@@ -39,12 +39,12 @@
39
39
  "test:watch": "vitest watch"
40
40
  },
41
41
  "dependencies": {
42
- "@clerk/clerk-sdk-node": "4.13.21"
42
+ "@clerk/backend": "1.34.0"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@arethetypeswrong/cli": "0.18.2",
46
- "@cedarjs/api": "1.1.1-next.0+4e91c835e",
47
- "@cedarjs/framework-tools": "1.1.1-next.1",
46
+ "@cedarjs/api": "1.1.1-next.18+5ffd3124d",
47
+ "@cedarjs/framework-tools": "1.1.1-next.18",
48
48
  "@types/aws-lambda": "8.10.152",
49
49
  "concurrently": "8.2.2",
50
50
  "publint": "0.3.12",
@@ -55,5 +55,5 @@
55
55
  "publishConfig": {
56
56
  "access": "public"
57
57
  },
58
- "gitHead": "4e91c835e7b5fc4fe1499b811415ff56041ae9bf"
58
+ "gitHead": "5ffd3124d3d4ceb7843408264c96ecceff8542f5"
59
59
  }