@ooneex/auth 0.0.20 → 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/README.md CHANGED
@@ -1 +1,27 @@
1
1
  # @ooneex/auth
2
+
3
+ Authentication framework with pluggable strategies for securing APIs and web applications -- supports token-based and session-based authentication flows.
4
+
5
+ ![Bun](https://img.shields.io/badge/Bun-Compatible-orange?style=flat-square&logo=bun)
6
+ ![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue?style=flat-square&logo=typescript)
7
+ ![MIT License](https://img.shields.io/badge/License-MIT-yellow?style=flat-square)
8
+
9
+ ## Features
10
+
11
+ ✅ **Clerk Integration** - Built-in Clerk authentication client for user and session management
12
+
13
+ ✅ **Token Verification** - Bearer token extraction and verification via Clerk backend
14
+
15
+ ✅ **Auth Middleware** - Ready-to-use ClerkAuthMiddleware for protecting routes
16
+
17
+ ✅ **User Management** - Get, update, ban, lock, unlock, and delete users through the Clerk API
18
+
19
+ ✅ **Session Management** - Retrieve sessions and sign out users programmatically
20
+
21
+ ✅ **User Metadata** - Read and update public, private, and unsafe metadata on user profiles
22
+
23
+ ✅ **Profile Images** - Update and delete user profile images
24
+
25
+ ✅ **Dependency Injection** - Injectable classes that integrate with the Ooneex DI container
26
+
27
+ ✅ **Custom Exceptions** - AuthException with HTTP status codes for structured error handling
package/dist/index.d.ts CHANGED
@@ -3,10 +3,13 @@ declare class AuthException extends Exception {
3
3
  constructor(message: string, data?: Record<string, unknown>);
4
4
  }
5
5
  import { Session, User } from "@clerk/backend";
6
+ type ClerkAuthConfigType = {
7
+ secretKey?: string;
8
+ };
6
9
  declare class ClerkAuth {
7
10
  private readonly client;
8
11
  private readonly secretKey;
9
- constructor();
12
+ constructor(config?: ClerkAuthConfigType);
10
13
  getCurrentUser(token: string): Promise<User | null>;
11
14
  banUser(userId: string): Promise<User>;
12
15
  unbanUser(userId: string): Promise<User>;
@@ -29,19 +32,11 @@ declare class ClerkAuth {
29
32
  getCurrentUserSession(token: string): Promise<Session | null>;
30
33
  signOut(sessionId: string): Promise<Session>;
31
34
  }
32
- import { ContextConfigType as ContextConfigType2, ContextType as ContextType2 } from "@ooneex/controller";
33
- import { UserRepository } from "@ooneex/typeorm/repositories/user";
34
- import { IUser as IUser2 } from "@ooneex/user";
35
35
  import { ContextConfigType, ContextType } from "@ooneex/controller";
36
- import { IUser } from "@ooneex/user";
37
- type AuthMiddlewareClassType = new (...args: any[]) => IAuthMiddleware;
38
- interface IAuthMiddleware<T extends ContextConfigType = ContextConfigType> {
39
- handler: (context: ContextType<T>) => Promise<IUser> | IUser;
40
- }
41
- declare class ClerkAuthMiddleware implements IAuthMiddleware {
36
+ import { IMiddleware } from "@ooneex/middleware";
37
+ declare class ClerkAuthMiddleware implements IMiddleware {
42
38
  private readonly clerkAuth;
43
- private readonly userRepository;
44
- constructor(clerkAuth: ClerkAuth, userRepository: UserRepository);
45
- handler<T extends ContextConfigType2>(context: ContextType2<T>): Promise<IUser2>;
39
+ constructor(clerkAuth: ClerkAuth);
40
+ handler<T extends ContextConfigType>(context: ContextType<T>): Promise<ContextType<T>>;
46
41
  }
47
- export { IAuthMiddleware, ClerkAuthMiddleware, ClerkAuth, AuthMiddlewareClassType, AuthException };
42
+ export { ClerkAuthMiddleware, ClerkAuthConfigType, ClerkAuth, AuthException };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- var o=function(e,s,t,r){var c=arguments.length,i=c<3?s:r===null?r=Object.getOwnPropertyDescriptor(s,t):r,u;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")i=Reflect.decorate(e,s,t,r);else for(var U=e.length-1;U>=0;U--)if(u=e[U])i=(c<3?u(i):c>3?u(s,t,i):u(s,t))||i;return c>3&&i&&Object.defineProperty(s,t,i),i},m=(e,s)=>(t,r)=>s(t,r,e),l=(e,s)=>{if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,s)};import{Exception as f}from"@ooneex/exception";import{HttpStatus as P}from"@ooneex/http-status";class a extends f{constructor(e,s={}){super(e,{status:P.Code.InternalServerError,data:s});this.name="AuthException"}}import{createClerkClient as h,verifyToken as d}from"@clerk/backend";import{injectable as w}from"@ooneex/container";class n{client;secretKey;constructor(){let e=Bun.env.CLERK_SECRET_KEY,s=Bun.env.PUBLIC_CLERK_PUBLISHABLE_KEY;if(!e)throw new a("CLERK_SECRET_KEY environment variable is required");this.secretKey=e,this.client=h({secretKey:e,...s?{publishableKey:s}:{}})}async getCurrentUser(e){let{sub:s}=await d(e,{secretKey:this.secretKey});if(!s)return null;return await this.getUser(s)}async banUser(e){return await this.client.users.banUser(e)}async unbanUser(e){return await this.client.users.unbanUser(e)}async getUser(e){return await this.client.users.getUser(e)}async lockUser(e){return await this.client.users.lockUser(e)}async unlockUser(e){return await this.client.users.unlockUser(e)}async updateUser(e,s){return await this.client.users.updateUser(e,s)}async updateUserProfileImage(e,s){return await this.client.users.updateUserProfileImage(e,s)}async updateUserMetadata(e,s){return await this.client.users.updateUserMetadata(e,s)}async getUserMetadata(e){let s=await this.getUser(e);return{publicMetadata:s.publicMetadata,privateMetadata:s.privateMetadata,unsafeMetadata:s.unsafeMetadata}}async deleteUser(e){return await this.client.users.deleteUser(e)}async deleteUserProfileImage(e){return await this.client.users.deleteUserProfileImage(e)}async getSession(e){return await this.client.sessions.getSession(e)}async getCurrentUserSession(e){let{sid:s}=await d(e,{secretKey:this.secretKey});if(!s)return null;return await this.getSession(s)}async signOut(e){return await this.client.sessions.revokeSession(e)}}n=o([w(),l("design:paramtypes",[])],n);import{inject as y}from"@ooneex/container";import{HttpStatus as g}from"@ooneex/http-status";import{UserRepository as b}from"@ooneex/typeorm/repositories/user";class p{clerkAuth;userRepository;constructor(e,s){this.clerkAuth=e;this.userRepository=s}async handler(e){let s=e.header.getBearerToken();if(!s)throw new a("Authentication required: Missing bearer token",{status:g.Code.Unauthorized});let t=await this.clerkAuth.getCurrentUser(s);if(!t)throw new a("Authentication failed: Invalid or expired token",{status:g.Code.Unauthorized});let r=await this.userRepository.findOneBy({key:t.id});if(!r)throw new a("User not found",{status:g.Code.Unauthorized});return r}}p=o([m(0,y(n)),m(1,y(b)),l("design:paramtypes",[typeof n==="undefined"?Object:n,typeof b==="undefined"?Object:b])],p);export{p as ClerkAuthMiddleware,n as ClerkAuth,a as AuthException};
2
+ var c=function(e,t,r,a){var s=arguments.length,i=s<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,r):a,u;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")i=Reflect.decorate(e,t,r,a);else for(var m=e.length-1;m>=0;m--)if(u=e[m])i=(s<3?u(i):s>3?u(t,r,i):u(t,r))||i;return s>3&&i&&Object.defineProperty(t,r,i),i},f=(e,t)=>(r,a)=>t(r,a,e),l=(e,t)=>{if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,t)};import{Exception as U}from"@ooneex/exception";import{HttpStatus as g}from"@ooneex/http-status";class n extends U{constructor(e,t={}){super(e,{status:g.Code.InternalServerError,data:t});this.name="AuthException"}}import{createClerkClient as h,verifyToken as y}from"@clerk/backend";import{injectable as b}from"@ooneex/container";class o{client;secretKey;constructor(e){let t=e?.secretKey||Bun.env.CLERK_SECRET_KEY;if(!t)throw new n("Clerk secret key is required. Provide a secret key through config options or set the CLERK_SECRET_KEY environment variable.");this.secretKey=t,this.client=h({secretKey:t})}async getCurrentUser(e){let{sub:t}=await y(e,{secretKey:this.secretKey});if(!t)return null;return await this.getUser(t)}async banUser(e){return await this.client.users.banUser(e)}async unbanUser(e){return await this.client.users.unbanUser(e)}async getUser(e){return await this.client.users.getUser(e)}async lockUser(e){return await this.client.users.lockUser(e)}async unlockUser(e){return await this.client.users.unlockUser(e)}async updateUser(e,t){return await this.client.users.updateUser(e,t)}async updateUserProfileImage(e,t){return await this.client.users.updateUserProfileImage(e,t)}async updateUserMetadata(e,t){return await this.client.users.updateUserMetadata(e,t)}async getUserMetadata(e){let t=await this.getUser(e);return{publicMetadata:t.publicMetadata,privateMetadata:t.privateMetadata,unsafeMetadata:t.unsafeMetadata}}async deleteUser(e){return await this.client.users.deleteUser(e)}async deleteUserProfileImage(e){return await this.client.users.deleteUserProfileImage(e)}async getSession(e){return await this.client.sessions.getSession(e)}async getCurrentUserSession(e){let{sid:t}=await y(e,{secretKey:this.secretKey});if(!t)return null;return await this.getSession(t)}async signOut(e){return await this.client.sessions.revokeSession(e)}}o=c([b(),l("design:paramtypes",[typeof ClerkAuthConfigType==="undefined"?Object:ClerkAuthConfigType])],o);import{inject as w,injectable as A}from"@ooneex/container";import{HttpStatus as d}from"@ooneex/http-status";import{ERole as x}from"@ooneex/role";class p{clerkAuth;constructor(e){this.clerkAuth=e}async handler(e){let t=e.header.getBearerToken();if(!t)throw new n("Authentication required: Missing bearer token",{status:d.Code.Unauthorized});let r=await this.clerkAuth.getCurrentUser(t);if(!r)throw new n("Authentication failed: Invalid or expired token",{status:d.Code.Unauthorized});let a=r.emailAddresses.find((i)=>i.id===r.primaryEmailAddressId);if(!a)throw new n("User has no primary email",{status:d.Code.Unauthorized});let s={id:r.privateMetadata?.externalId,externalId:r.id,email:a.emailAddress,roles:r.privateMetadata?.roles??[x.USER]};if(r.firstName)s.firstName=r.firstName;if(r.lastName)s.lastName=r.lastName;if(r.username)s.username=r.username;if(r.phoneNumbers[0]?.phoneNumber)s.phone=r.phoneNumbers[0].phoneNumber;if(r.lastActiveAt)s.lastActiveAt=new Date(r.lastActiveAt);if(r.lastSignInAt)s.lastLoginAt=new Date(r.lastSignInAt);if(r.imageUrl)s.avatar=r.imageUrl;if(r.createdAt)s.createdAt=new Date(r.createdAt);if(r.updatedAt)s.updatedAt=new Date(r.updatedAt);return e.user=s,e}}p=c([A(),f(0,w(o)),l("design:paramtypes",[typeof o==="undefined"?Object:o])],p);export{p as ClerkAuthMiddleware,o as ClerkAuth,n as AuthException};
3
3
 
4
- //# debugId=A41AB52842A4B22064756E2164756E21
4
+ //# debugId=4AAA1A1EEBE4A80C64756E2164756E21
package/dist/index.js.map CHANGED
@@ -3,10 +3,10 @@
3
3
  "sources": ["src/AuthException.ts", "src/ClerkAuth.ts", "src/ClerkAuthMiddleware.ts"],
4
4
  "sourcesContent": [
5
5
  "import { Exception } from \"@ooneex/exception\";\nimport { HttpStatus } from \"@ooneex/http-status\";\n\nexport class AuthException extends Exception {\n constructor(message: string, data: Record<string, unknown> = {}) {\n super(message, {\n status: HttpStatus.Code.InternalServerError,\n data,\n });\n this.name = \"AuthException\";\n }\n}\n",
6
- "import { createClerkClient, type Session, type User, verifyToken } from \"@clerk/backend\";\nimport { injectable } from \"@ooneex/container\";\nimport { AuthException } from \"./AuthException\";\n\n@injectable()\nexport class ClerkAuth {\n private readonly client: ReturnType<typeof createClerkClient>;\n private readonly secretKey: string;\n\n constructor() {\n const secretKey = Bun.env.CLERK_SECRET_KEY;\n const publishableKey = Bun.env.PUBLIC_CLERK_PUBLISHABLE_KEY;\n\n if (!secretKey) {\n throw new AuthException(\"CLERK_SECRET_KEY environment variable is required\");\n }\n\n this.secretKey = secretKey;\n this.client = createClerkClient({\n secretKey,\n ...(publishableKey ? { publishableKey } : {}),\n });\n }\n\n public async getCurrentUser(token: string): Promise<User | null> {\n const { sub: userId } = await verifyToken(token, {\n secretKey: this.secretKey,\n });\n\n if (!userId) {\n return null;\n }\n\n return await this.getUser(userId);\n }\n\n public async banUser(userId: string): Promise<User> {\n return await this.client.users.banUser(userId);\n }\n\n public async unbanUser(userId: string): Promise<User> {\n return await this.client.users.unbanUser(userId);\n }\n\n public async getUser(userId: string): Promise<User> {\n return await this.client.users.getUser(userId);\n }\n\n public async lockUser(userId: string): Promise<User> {\n return await this.client.users.lockUser(userId);\n }\n\n public async unlockUser(userId: string): Promise<User> {\n return await this.client.users.unlockUser(userId);\n }\n\n public async updateUser(userId: string, params: Parameters<typeof this.client.users.updateUser>[1]): Promise<User> {\n return await this.client.users.updateUser(userId, params);\n }\n\n public async updateUserProfileImage(userId: string, params: { file: Blob | File }): Promise<User> {\n return await this.client.users.updateUserProfileImage(userId, params);\n }\n\n public async updateUserMetadata(\n userId: string,\n params: Parameters<typeof this.client.users.updateUserMetadata>[1],\n ): Promise<User> {\n return await this.client.users.updateUserMetadata(userId, params);\n }\n\n public async getUserMetadata(userId: string): Promise<{\n publicMetadata: User[\"publicMetadata\"];\n privateMetadata: User[\"privateMetadata\"];\n unsafeMetadata: User[\"unsafeMetadata\"];\n }> {\n const user = await this.getUser(userId);\n return {\n publicMetadata: user.publicMetadata,\n privateMetadata: user.privateMetadata,\n unsafeMetadata: user.unsafeMetadata,\n };\n }\n\n public async deleteUser(userId: string): Promise<User> {\n return await this.client.users.deleteUser(userId);\n }\n\n public async deleteUserProfileImage(userId: string): Promise<User> {\n return await this.client.users.deleteUserProfileImage(userId);\n }\n\n public async getSession(sessionId: string): Promise<Session> {\n return await this.client.sessions.getSession(sessionId);\n }\n\n public async getCurrentUserSession(token: string): Promise<Session | null> {\n const { sid: sessionId } = await verifyToken(token, {\n secretKey: this.secretKey,\n });\n\n if (!sessionId) {\n return null;\n }\n\n return await this.getSession(sessionId);\n }\n\n public async signOut(sessionId: string): Promise<Session> {\n return await this.client.sessions.revokeSession(sessionId);\n }\n}\n",
7
- "import { inject } from \"@ooneex/container\";\nimport type { ContextConfigType, ContextType } from \"@ooneex/controller\";\nimport { HttpStatus } from \"@ooneex/http-status\";\nimport { UserRepository } from \"@ooneex/typeorm/repositories/user\";\nimport type { IUser } from \"@ooneex/user\";\nimport { AuthException } from \"./AuthException\";\nimport { ClerkAuth } from \"./ClerkAuth\";\nimport type { IAuthMiddleware } from \"./types\";\n\nexport class ClerkAuthMiddleware implements IAuthMiddleware {\n constructor(\n @inject(ClerkAuth) private readonly clerkAuth: ClerkAuth,\n @inject(UserRepository) private readonly userRepository: UserRepository,\n ) {}\n\n public async handler<T extends ContextConfigType>(context: ContextType<T>): Promise<IUser> {\n const token = context.header.getBearerToken();\n\n if (!token) {\n throw new AuthException(\"Authentication required: Missing bearer token\", {\n status: HttpStatus.Code.Unauthorized,\n });\n }\n\n const clerkUser = await this.clerkAuth.getCurrentUser(token);\n\n if (!clerkUser) {\n throw new AuthException(\"Authentication failed: Invalid or expired token\", {\n status: HttpStatus.Code.Unauthorized,\n });\n }\n\n const user = await this.userRepository.findOneBy({ key: clerkUser.id });\n\n if (!user) {\n throw new AuthException(\"User not found\", {\n status: HttpStatus.Code.Unauthorized,\n });\n }\n\n return user;\n }\n}\n"
6
+ "import { createClerkClient, type Session, type User, verifyToken } from \"@clerk/backend\";\nimport { injectable } from \"@ooneex/container\";\nimport { AuthException } from \"./AuthException\";\nimport type { ClerkAuthConfigType } from \"./types\";\n\n@injectable()\nexport class ClerkAuth {\n private readonly client: ReturnType<typeof createClerkClient>;\n private readonly secretKey: string;\n\n constructor(config?: ClerkAuthConfigType) {\n const secretKey = config?.secretKey || Bun.env.CLERK_SECRET_KEY;\n\n if (!secretKey) {\n throw new AuthException(\n \"Clerk secret key is required. Provide a secret key through config options or set the CLERK_SECRET_KEY environment variable.\",\n );\n }\n\n this.secretKey = secretKey;\n this.client = createClerkClient({\n secretKey,\n });\n }\n\n public async getCurrentUser(token: string): Promise<User | null> {\n const { sub: userId } = await verifyToken(token, {\n secretKey: this.secretKey,\n });\n\n if (!userId) {\n return null;\n }\n\n return await this.getUser(userId);\n }\n\n public async banUser(userId: string): Promise<User> {\n return await this.client.users.banUser(userId);\n }\n\n public async unbanUser(userId: string): Promise<User> {\n return await this.client.users.unbanUser(userId);\n }\n\n public async getUser(userId: string): Promise<User> {\n return await this.client.users.getUser(userId);\n }\n\n public async lockUser(userId: string): Promise<User> {\n return await this.client.users.lockUser(userId);\n }\n\n public async unlockUser(userId: string): Promise<User> {\n return await this.client.users.unlockUser(userId);\n }\n\n public async updateUser(userId: string, params: Parameters<typeof this.client.users.updateUser>[1]): Promise<User> {\n return await this.client.users.updateUser(userId, params);\n }\n\n public async updateUserProfileImage(userId: string, params: { file: Blob | File }): Promise<User> {\n return await this.client.users.updateUserProfileImage(userId, params);\n }\n\n public async updateUserMetadata(\n userId: string,\n params: Parameters<typeof this.client.users.updateUserMetadata>[1],\n ): Promise<User> {\n return await this.client.users.updateUserMetadata(userId, params);\n }\n\n public async getUserMetadata(userId: string): Promise<{\n publicMetadata: User[\"publicMetadata\"];\n privateMetadata: User[\"privateMetadata\"];\n unsafeMetadata: User[\"unsafeMetadata\"];\n }> {\n const user = await this.getUser(userId);\n return {\n publicMetadata: user.publicMetadata,\n privateMetadata: user.privateMetadata,\n unsafeMetadata: user.unsafeMetadata,\n };\n }\n\n public async deleteUser(userId: string): Promise<User> {\n return await this.client.users.deleteUser(userId);\n }\n\n public async deleteUserProfileImage(userId: string): Promise<User> {\n return await this.client.users.deleteUserProfileImage(userId);\n }\n\n public async getSession(sessionId: string): Promise<Session> {\n return await this.client.sessions.getSession(sessionId);\n }\n\n public async getCurrentUserSession(token: string): Promise<Session | null> {\n const { sid: sessionId } = await verifyToken(token, {\n secretKey: this.secretKey,\n });\n\n if (!sessionId) {\n return null;\n }\n\n return await this.getSession(sessionId);\n }\n\n public async signOut(sessionId: string): Promise<Session> {\n return await this.client.sessions.revokeSession(sessionId);\n }\n}\n",
7
+ "import { inject, injectable } from \"@ooneex/container\";\nimport type { ContextConfigType, ContextType } from \"@ooneex/controller\";\nimport { HttpStatus } from \"@ooneex/http-status\";\nimport type { IMiddleware } from \"@ooneex/middleware\";\nimport { ERole } from \"@ooneex/role\";\nimport type { IUser } from \"@ooneex/user\";\nimport { AuthException } from \"./AuthException\";\nimport { ClerkAuth } from \"./ClerkAuth\";\n\n@injectable()\nexport class ClerkAuthMiddleware implements IMiddleware {\n constructor(@inject(ClerkAuth) private readonly clerkAuth: ClerkAuth) {}\n\n public async handler<T extends ContextConfigType>(context: ContextType<T>): Promise<ContextType<T>> {\n const token = context.header.getBearerToken();\n\n if (!token) {\n throw new AuthException(\"Authentication required: Missing bearer token\", {\n status: HttpStatus.Code.Unauthorized,\n });\n }\n\n const clerkUser = await this.clerkAuth.getCurrentUser(token);\n\n if (!clerkUser) {\n throw new AuthException(\"Authentication failed: Invalid or expired token\", {\n status: HttpStatus.Code.Unauthorized,\n });\n }\n\n const primaryEmail = clerkUser.emailAddresses.find((e) => e.id === clerkUser.primaryEmailAddressId);\n\n if (!primaryEmail) {\n throw new AuthException(\"User has no primary email\", {\n status: HttpStatus.Code.Unauthorized,\n });\n }\n\n const user: IUser = {\n id: clerkUser.privateMetadata?.externalId as string,\n externalId: clerkUser.id,\n email: primaryEmail.emailAddress,\n roles: (clerkUser.privateMetadata?.roles as ERole[]) ?? [ERole.USER],\n };\n\n if (clerkUser.firstName) user.firstName = clerkUser.firstName;\n if (clerkUser.lastName) user.lastName = clerkUser.lastName;\n if (clerkUser.username) user.username = clerkUser.username;\n if (clerkUser.phoneNumbers[0]?.phoneNumber) user.phone = clerkUser.phoneNumbers[0].phoneNumber;\n if (clerkUser.lastActiveAt) user.lastActiveAt = new Date(clerkUser.lastActiveAt);\n if (clerkUser.lastSignInAt) user.lastLoginAt = new Date(clerkUser.lastSignInAt);\n if (clerkUser.imageUrl) user.avatar = clerkUser.imageUrl;\n if (clerkUser.createdAt) user.createdAt = new Date(clerkUser.createdAt);\n if (clerkUser.updatedAt) user.updatedAt = new Date(clerkUser.updatedAt);\n\n context.user = user;\n\n return context;\n }\n}\n"
8
8
  ],
9
- "mappings": ";8cAAA,oBAAS,0BACT,qBAAS,4BAEF,MAAM,UAAsB,CAAU,CAC3C,WAAW,CAAC,EAAiB,EAAgC,CAAC,EAAG,CAC/D,MAAM,EAAS,CACb,OAAQ,EAAW,KAAK,oBACxB,MACF,CAAC,EACD,KAAK,KAAO,gBAEhB,CCXA,4BAAS,iBAA4C,uBACrD,qBAAS,0BAIF,MAAM,CAAU,CACJ,OACA,UAEjB,WAAW,EAAG,CACZ,IAAM,EAAY,IAAI,IAAI,iBACpB,EAAiB,IAAI,IAAI,6BAE/B,GAAI,CAAC,EACH,MAAM,IAAI,EAAc,mDAAmD,EAG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AAU,UACpD,GAAI,EAAU,SAAU,EAAK,SAAW,EAAU,SAClD,GAAI,EAAU,SAAU,EAAK,SAAW,EAAU,SAClD,GAAI,EAAU,aAAa,IAAI,YAAa,EAAK,MAAQ,EAAU,aAAa,GAAG,YACnF,GAAI,EAAU,aAAc,EAAK,aAAe,IAAI,KAAK,EAAU,YAAY,EAC/E,GAAI,EAAU,aAAc,EAAK,YAAc,IAAI,KAAK,EAAU,YAAY,EAC9E,GAAI,EAAU,SAAU,EAAK,OAAS,EAAU,SAChD,GAAI,EAAU,UAAW,EAAK,UAAY,IAAI,KAAK,EAAU,SAAS,EACtE,GAAI,EAAU,UAAW,EAAK,UAAY,IAAI,KAAK,EAAU,SAAS,EAItE,OAFA,EAAQ,KAAO,EAER,EAEX,CAjDa,EAAN,GADN,EAAW,EAEG,MAAO,CAAS,GADxB,0DAAM",
10
+ "debugId": "4AAA1A1EEBE4A80C64756E2164756E21",
11
11
  "names": []
12
12
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ooneex/auth",
3
- "description": "Authentication utilities and strategies for securing Ooneex applications",
4
- "version": "0.0.20",
3
+ "description": "Authentication framework with pluggable strategies for securing APIs and web applications — supports token-based and session-based authentication flows",
4
+ "version": "1.0.0",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist",
@@ -28,14 +28,15 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@clerk/backend": "^1.24.1",
31
- "@ooneex/container": "0.0.18",
32
- "@ooneex/controller": "0.16.1",
33
- "@ooneex/exception": "0.0.17",
34
- "@ooneex/http-status": "0.0.17",
35
- "@ooneex/typeorm": "0.16.0",
36
- "@ooneex/user": "0.0.17"
31
+ "@ooneex/container": "0.0.19",
32
+ "@ooneex/controller": "0.17.1",
33
+ "@ooneex/exception": "0.0.18",
34
+ "@ooneex/http-status": "0.0.18"
35
+ },
36
+ "devDependencies": {
37
+ "@ooneex/middleware": "0.17.1",
38
+ "@ooneex/user": "0.0.19"
37
39
  },
38
- "devDependencies": {},
39
40
  "keywords": [
40
41
  "auth",
41
42
  "authentication",