@mantiq/core 0.2.0 → 0.2.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mantiq/core",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Service container, router, middleware, HTTP kernel, config, and exception handler",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -45,6 +45,7 @@ export interface MantiqRequest {
45
45
  hasSession(): boolean
46
46
 
47
47
  // ── Auth ─────────────────────────────────────────────────────────────────
48
+ bearerToken(): string | null
48
49
  user<T = any>(): T | null
49
50
  isAuthenticated(): boolean
50
51
  setUser(user: any): void
@@ -193,6 +193,12 @@ export class MantiqRequest implements MantiqRequestContract {
193
193
 
194
194
  // ── Auth ─────────────────────────────────────────────────────────────────
195
195
 
196
+ bearerToken(): string | null {
197
+ const auth = this.header('authorization')
198
+ if (!auth || !auth.startsWith('Bearer ')) return null
199
+ return auth.slice(7).trim() || null
200
+ }
201
+
196
202
  user<T = any>(): T | null {
197
203
  return this.authenticatedUser as T | null
198
204
  }