@witchcraft/nuxt-auth 0.1.2 → 0.1.4

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/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "auth",
3
3
  "configKey": "auth",
4
- "version": "0.1.1",
4
+ "version": "0.1.3",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -3,7 +3,7 @@ import { defineNuxtModule, useLogger, createResolver, addComponentsDir, addImpor
3
3
  import { defu } from 'defu';
4
4
 
5
5
  const dependencies = {
6
- "@witchcraft/ui": "^0.2.3",
6
+ "@witchcraft/ui": "^0.3.0",
7
7
  "nuxt-security": "^2.4.0"};
8
8
  const pkg = {
9
9
  dependencies: dependencies};
@@ -74,11 +74,8 @@ const module = defineNuxtModule({
74
74
  prefix: "Auth",
75
75
  global: true
76
76
  });
77
- if (!process.env.NUXT_AUTH_SECRET) {
78
- logger.error("Missing $NUXT_AUTH_SECRET.");
79
- }
80
- if (process.env.NUXT_AUTH_SECRET && process.env.NUXT_AUTH_SECRET.length === 0) {
81
- logger.warn("$NUXT_AUTH_SECRET is empty. This is not recommended.");
77
+ if (process.env.NODE_ENV !== "production" && (!process.env.NUXT_AUTH_SECRET || process.env.NUXT_AUTH_SECRET && process.env.NUXT_AUTH_SECRET.length === 0)) {
78
+ logger.warn("$NUXT_AUTH_SECRET is missing or empty. This is not recommended.");
82
79
  }
83
80
  nuxt.options.runtimeConfig.public.auth = defu(
84
81
  nuxt.options.runtimeConfig.public.auth,
@@ -3,5 +3,6 @@ type __VLS_Props = {
3
3
  successPath?: string;
4
4
  cancelPath?: string;
5
5
  };
6
- declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
6
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
7
+ declare const _default: typeof __VLS_export;
7
8
  export default _default;
@@ -3,5 +3,6 @@ type __VLS_Props = {
3
3
  successPath?: string;
4
4
  cancelPath?: string;
5
5
  };
6
- declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
6
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
7
+ declare const _default: typeof __VLS_export;
7
8
  export default _default;
@@ -3,9 +3,10 @@ type __VLS_Props = {
3
3
  promptText?: string;
4
4
  copyTitle?: string;
5
5
  };
6
- declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
6
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
7
7
  openAppText: string;
8
8
  promptText: string;
9
9
  copyTitle: string;
10
10
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
+ declare const _default: typeof __VLS_export;
11
12
  export default _default;
@@ -3,9 +3,10 @@ type __VLS_Props = {
3
3
  promptText?: string;
4
4
  copyTitle?: string;
5
5
  };
6
- declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
6
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
7
7
  openAppText: string;
8
8
  promptText: string;
9
9
  copyTitle: string;
10
10
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
+ declare const _default: typeof __VLS_export;
11
12
  export default _default;
@@ -5,11 +5,12 @@ type __VLS_Props = {
5
5
  useAuthOptions?: UseAuthComposableOptions;
6
6
  loginOptions?: Parameters<ReturnType<typeof useAuth>["login"]>[1];
7
7
  };
8
- declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
8
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
9
9
  providerStyles: Record<ProviderNames, Partial<ProviderStyle>>;
10
10
  useAuthOptions: UseAuthComposableOptions;
11
11
  loginOptions: {
12
12
  devBypass?: boolean;
13
13
  };
14
14
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
15
+ declare const _default: typeof __VLS_export;
15
16
  export default _default;
@@ -5,11 +5,12 @@ type __VLS_Props = {
5
5
  useAuthOptions?: UseAuthComposableOptions;
6
6
  loginOptions?: Parameters<ReturnType<typeof useAuth>["login"]>[1];
7
7
  };
8
- declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
8
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
9
9
  providerStyles: Record<ProviderNames, Partial<ProviderStyle>>;
10
10
  useAuthOptions: UseAuthComposableOptions;
11
11
  loginOptions: {
12
12
  devBypass?: boolean;
13
13
  };
14
14
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
15
+ declare const _default: typeof __VLS_export;
15
16
  export default _default;
@@ -1,2 +1,3 @@
1
- declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
2
3
  export default _default;
@@ -1,2 +1,3 @@
1
- declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
2
3
  export default _default;
@@ -23,10 +23,11 @@ type __VLS_Slots = {} & {
23
23
  } & {
24
24
  unauthenticated?: (props: typeof __VLS_33) => any;
25
25
  };
26
- declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
26
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
27
27
  usernameLink: (user: AuthUser) => string;
28
28
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
29
- declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
29
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
30
+ declare const _default: typeof __VLS_export;
30
31
  export default _default;
31
32
  type __VLS_WithSlots<T, S> = T & {
32
33
  new (): {
@@ -23,10 +23,11 @@ type __VLS_Slots = {} & {
23
23
  } & {
24
24
  unauthenticated?: (props: typeof __VLS_33) => any;
25
25
  };
26
- declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
26
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
27
27
  usernameLink: (user: AuthUser) => string;
28
28
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
29
- declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
29
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
30
+ declare const _default: typeof __VLS_export;
30
31
  export default _default;
31
32
  type __VLS_WithSlots<T, S> = T & {
32
33
  new (): {
@@ -21,12 +21,13 @@ type __VLS_Slots = {} & {
21
21
  } & {
22
22
  error?: (props: typeof __VLS_45) => any;
23
23
  };
24
- declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
24
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
25
25
  debounce: number;
26
26
  getValidUsernameRoute: (username: string) => string;
27
27
  onSubmitRegistration: (event: Event, username: string, error: Ref<string>, redirectUrl: string, deeplink?: string) => void;
28
28
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
29
- declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
29
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
30
+ declare const _default: typeof __VLS_export;
30
31
  export default _default;
31
32
  type __VLS_WithSlots<T, S> = T & {
32
33
  new (): {
@@ -21,12 +21,13 @@ type __VLS_Slots = {} & {
21
21
  } & {
22
22
  error?: (props: typeof __VLS_45) => any;
23
23
  };
24
- declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
24
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
25
25
  debounce: number;
26
26
  getValidUsernameRoute: (username: string) => string;
27
27
  onSubmitRegistration: (event: Event, username: string, error: Ref<string>, redirectUrl: string, deeplink?: string) => void;
28
28
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
29
- declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
29
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
30
+ declare const _default: typeof __VLS_export;
30
31
  export default _default;
31
32
  type __VLS_WithSlots<T, S> = T & {
32
33
  new (): {
@@ -69,6 +69,9 @@ export class Auth {
69
69
  providerCookieOpts;
70
70
  constructor(runtimeConfig, db, usersTable, authAccountsTable, sessionManager, router, opts, env, logger) {
71
71
  this.rc = runtimeConfig;
72
+ if (!import.meta.dev && !(this.rc.authSecret || this.rc.authSecret.length === 0)) {
73
+ throw new Error("FATAL: Missing or empty runtimeConfig.authSecret (i.e. should be set via NUXT_AUTH_SECRET) in production.");
74
+ }
72
75
  this.providerCookieOpts = {
73
76
  secure: this.rc.public.auth.isSecure,
74
77
  ...this.rc.public.auth.providerCookieOpts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@witchcraft/nuxt-auth",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Nuxt module for logging.",
5
5
  "repository": "witchcraftjs/nuxt-auth",
6
6
  "license": "MIT",
@@ -52,7 +52,7 @@
52
52
  "@oslojs/encoding": "^1.1.0",
53
53
  "@vueuse/core": "^13.9.0",
54
54
  "@witchcraft/nuxt-logger": "^0.0.2",
55
- "@witchcraft/ui": "^0.2.3",
55
+ "@witchcraft/ui": "^0.3.0",
56
56
  "arctic": "~3.7.0",
57
57
  "cookie-es": "^2.0.0",
58
58
  "defu": "latest",