@draftlab/auth 0.10.0 → 0.10.2

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/core.d.mts CHANGED
@@ -14,11 +14,11 @@ import { Router } from "@draftlab/auth-router";
14
14
  /**
15
15
  * Sets the subject payload in the JWT token and returns the response.
16
16
  */
17
- interface OnSuccessResponder<T$1 extends {
17
+ interface OnSuccessResponder<T extends {
18
18
  type: string;
19
19
  properties: unknown;
20
20
  }> {
21
- subject<Type extends T$1["type"]>(type: Type, properties: Extract<T$1, {
21
+ subject<Type extends T["type"]>(type: Type, properties: Extract<T, {
22
22
  type: Type;
23
23
  }>["properties"], opts?: {
24
24
  ttl?: {
@@ -11,8 +11,8 @@ import { Oauth2Provider } from "./oauth2.mjs";
11
11
  * import { AppleProvider } from "@draftlab/auth/provider/apple"
12
12
  *
13
13
  * export default issuer({
14
- * providers: {
15
14
  * basePath: "/auth", // Important for callback URL
15
+ * providers: {
16
16
  * apple: AppleProvider({
17
17
  * clientID: process.env.APPLE_CLIENT_ID,
18
18
  * clientSecret: process.env.APPLE_CLIENT_SECRET,
@@ -148,6 +148,7 @@ const CodeProvider = (config) => {
148
148
  await ctx.unset(c, "provider");
149
149
  return await ctx.success(c, { claims: currentState.claims });
150
150
  }
151
+ return transition(c, { type: "start" });
151
152
  });
152
153
  }
153
154
  };
@@ -11,8 +11,8 @@ import { Oauth2Provider } from "./oauth2.mjs";
11
11
  * import { DiscordProvider } from "@draftlab/auth/provider/discord"
12
12
  *
13
13
  * export default issuer({
14
- * providers: {
15
14
  * basePath: "/auth", // Important for callback URL
15
+ * providers: {
16
16
  * discord: DiscordProvider({
17
17
  * clientID: process.env.DISCORD_CLIENT_ID,
18
18
  * clientSecret: process.env.DISCORD_CLIENT_SECRET,
@@ -11,8 +11,8 @@ import { Oauth2Provider } from "./oauth2.mjs";
11
11
  * import { FacebookProvider } from "@draftlab/auth/provider/facebook"
12
12
  *
13
13
  * export default issuer({
14
- * providers: {
15
14
  * basePath: "/auth", // Important for callback URL
15
+ * providers: {
16
16
  * facebook: FacebookProvider({
17
17
  * clientID: process.env.FACEBOOK_APP_ID,
18
18
  * clientSecret: process.env.FACEBOOK_APP_SECRET,
@@ -11,8 +11,8 @@ import { Oauth2Provider } from "./oauth2.mjs";
11
11
  * import { GitlabProvider } from "@draftlab/auth/provider/gitlab"
12
12
  *
13
13
  * export default issuer({
14
- * providers: {
15
14
  * basePath: "/auth", // Important for callback URL
15
+ * providers: {
16
16
  * gitlab: GitlabProvider({
17
17
  * clientID: process.env.GITLAB_CLIENT_ID,
18
18
  * clientSecret: process.env.GITLAB_CLIENT_SECRET,
@@ -11,8 +11,8 @@ import { Oauth2Provider } from "./oauth2.mjs";
11
11
  * import { LinkedInProvider } from "@draftlab/auth/provider/linkedin"
12
12
  *
13
13
  * export default issuer({
14
- * providers: {
15
14
  * basePath: "/auth", // Important for callback URL
15
+ * providers: {
16
16
  * linkedin: LinkedInProvider({
17
17
  * clientID: process.env.LINKEDIN_CLIENT_ID,
18
18
  * clientSecret: process.env.LINKEDIN_CLIENT_SECRET,
@@ -12,8 +12,8 @@ import { Oauth2Provider } from "./oauth2.mjs";
12
12
  * import { MicrosoftProvider } from "@draftlab/auth/provider/microsoft"
13
13
  *
14
14
  * export default issuer({
15
- * providers: {
16
15
  * basePath: "/auth", // Important for callback URL
16
+ * providers: {
17
17
  * microsoft: MicrosoftProvider({
18
18
  * tenant: "common", // or specific tenant ID
19
19
  * clientID: process.env.MICROSOFT_CLIENT_ID,
@@ -17,7 +17,7 @@ interface UserModel {
17
17
  */
18
18
  interface PasskeyModel {
19
19
  id: string;
20
- publicKey: Uint8Array;
20
+ publicKey: Uint8Array<ArrayBuffer>;
21
21
  userId: string;
22
22
  webauthnUserID: string;
23
23
  counter: number;
@@ -211,9 +211,10 @@ const PasskeyProvider = (config) => {
211
211
  });
212
212
  } catch (error) {
213
213
  console.error("Passkey Registration Verification Error:", error);
214
+ const message = error instanceof Error ? error.message : "Unknown error";
214
215
  return c.json({
215
216
  verified: false,
216
- error: error.message
217
+ error: message
217
218
  }, { status: 400 });
218
219
  }
219
220
  const { verified, registrationInfo } = verification;
@@ -11,8 +11,8 @@ import { Oauth2Provider } from "./oauth2.mjs";
11
11
  * import { RedditProvider } from "@draftlab/auth/provider/reddit"
12
12
  *
13
13
  * export default issuer({
14
- * providers: {
15
14
  * basePath: "/auth", // Important for callback URL
15
+ * providers: {
16
16
  * reddit: RedditProvider({
17
17
  * clientID: process.env.REDDIT_CLIENT_ID,
18
18
  * clientSecret: process.env.REDDIT_CLIENT_SECRET,
@@ -11,8 +11,8 @@ import { Oauth2Provider } from "./oauth2.mjs";
11
11
  * import { SlackProvider } from "@draftlab/auth/provider/slack"
12
12
  *
13
13
  * export default issuer({
14
- * providers: {
15
14
  * basePath: "/auth", // Important for callback URL
15
+ * providers: {
16
16
  * slack: SlackProvider({
17
17
  * clientID: process.env.SLACK_CLIENT_ID,
18
18
  * clientSecret: process.env.SLACK_CLIENT_SECRET,
@@ -128,7 +128,7 @@ const SlackProvider = (config) => {
128
128
  ...config,
129
129
  type: "slack",
130
130
  endpoint: {
131
- authorization: "https://slack.com/oauth_authorize",
131
+ authorization: "https://slack.com/oauth/v2/authorize",
132
132
  token: "https://slack.com/api/oauth.v2.access"
133
133
  }
134
134
  });
@@ -11,8 +11,8 @@ import { Oauth2Provider } from "./oauth2.mjs";
11
11
  * import { SpotifyProvider } from "@draftlab/auth/provider/spotify"
12
12
  *
13
13
  * export default issuer({
14
- * providers: {
15
14
  * basePath: "/auth", // Important for callback URL
15
+ * providers: {
16
16
  * spotify: SpotifyProvider({
17
17
  * clientID: process.env.SPOTIFY_CLIENT_ID,
18
18
  * clientSecret: process.env.SPOTIFY_CLIENT_SECRET,
@@ -11,8 +11,8 @@ import { Oauth2Provider } from "./oauth2.mjs";
11
11
  * import { TwitchProvider } from "@draftlab/auth/provider/twitch"
12
12
  *
13
13
  * export default issuer({
14
- * providers: {
15
14
  * basePath: "/auth", // Important for callback URL
15
+ * providers: {
16
16
  * twitch: TwitchProvider({
17
17
  * clientID: process.env.TWITCH_CLIENT_ID,
18
18
  * clientSecret: process.env.TWITCH_CLIENT_SECRET,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftlab/auth",
3
- "version": "0.10.0",
3
+ "version": "0.10.2",
4
4
  "type": "module",
5
5
  "description": "Core implementation for @draftlab/auth",
6
6
  "author": "Matheus Pergoli",
@@ -37,9 +37,9 @@
37
37
  ],
38
38
  "license": "MIT",
39
39
  "devDependencies": {
40
- "@types/node": "^24.10.1",
40
+ "@types/node": "^25.0.3",
41
41
  "@types/qrcode": "^1.5.6",
42
- "tsdown": "^0.16.8",
42
+ "tsdown": "^0.18.1",
43
43
  "typescript": "^5.9.3",
44
44
  "@draftlab/tsconfig": "0.1.0"
45
45
  },
@@ -57,13 +57,13 @@
57
57
  },
58
58
  "dependencies": {
59
59
  "@simplewebauthn/server": "^13.2.2",
60
- "@standard-schema/spec": "^1.0.0",
61
- "jose": "^6.1.2",
60
+ "@standard-schema/spec": "^1.1.0",
61
+ "jose": "^6.1.3",
62
62
  "otpauth": "^9.4.1",
63
- "preact": "^10.27.2",
64
- "preact-render-to-string": "^6.6.3",
63
+ "preact": "^10.28.0",
64
+ "preact-render-to-string": "^6.6.4",
65
65
  "qrcode": "^1.5.4",
66
- "@draftlab/auth-router": "0.3.0"
66
+ "@draftlab/auth-router": "0.4.0"
67
67
  },
68
68
  "engines": {
69
69
  "node": ">=18"