@meeovi/auth 1.0.0

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/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './src/useAuth'
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@meeovi/auth",
3
+ "version": "1.0.0",
4
+ "description": "Authentication for M Framework.",
5
+ "license": "ISC",
6
+ "author": "",
7
+ "type": "commonjs",
8
+ "main": "index.ts",
9
+ "scripts": {
10
+ "test": "echo \"Error: no test specified\" && exit 1"
11
+ },
12
+ "dependencies": {
13
+ "@better-auth/cli": "^1.4.10",
14
+ "@better-auth/oauth-provider": "^1.4.12",
15
+ "@better-auth/passkey": "^1.4.10",
16
+ "@better-auth/scim": "^1.4.15",
17
+ "@better-auth/sso": "^1.4.12",
18
+ "@polar-sh/better-auth": "^1.6.3",
19
+ "better-auth": "^1.4.12",
20
+ "mjml": "^4.18.0",
21
+ "uncrypto": "^0.1.3",
22
+ "uuid": "^13.0.0"
23
+ }
24
+ }
package/src/config.ts ADDED
@@ -0,0 +1,20 @@
1
+
2
+ export interface AuthConfig {
3
+ authProvider: string
4
+ authUrl?: string
5
+ sessionCookieName?: string
6
+ }
7
+
8
+ let config: AuthConfig = {
9
+ authProvider: 'better-auth',
10
+ authUrl: '',
11
+ sessionCookieName: 'meeovi_session'
12
+ }
13
+
14
+ export function setAuthConfig(newConfig: Partial<AuthConfig>) {
15
+ config = { ...config, ...newConfig }
16
+ }
17
+
18
+ export function getAuthConfig(): AuthConfig {
19
+ return config
20
+ }
File without changes
package/src/useAuth.ts ADDED
@@ -0,0 +1,18 @@
1
+ import { createAuthClient } from 'better-auth/client'
2
+ import { useRuntimeConfig } from '#imports'
3
+
4
+ let client: any = null
5
+
6
+ export function useAuth() {
7
+ if (!client) {
8
+ const config = useRuntimeConfig()
9
+ client = createAuthClient({ baseURL: config.public.authUrl })
10
+ }
11
+
12
+ return {
13
+ login: client.login,
14
+ logout: client.logout,
15
+ register: client.register,
16
+ session: client.session
17
+ }
18
+ }