initial commit
This commit is contained in:
15
packages/auth/package.json
Normal file
15
packages/auth/package.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "@hexahost/auth",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@hexahost/typescript-config": "workspace:*",
|
||||
"typescript": "^5.7.3"
|
||||
}
|
||||
}
|
||||
29
packages/auth/src/index.ts
Normal file
29
packages/auth/src/index.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
export enum UserRole {
|
||||
USER = 'USER',
|
||||
SUPPORT = 'SUPPORT',
|
||||
MODERATOR = 'MODERATOR',
|
||||
ADMIN = 'ADMIN',
|
||||
SUPER_ADMIN = 'SUPER_ADMIN',
|
||||
}
|
||||
|
||||
export interface AuthenticatedUser {
|
||||
id: string;
|
||||
email: string;
|
||||
username: string;
|
||||
roles: UserRole[];
|
||||
}
|
||||
|
||||
export interface SessionContext {
|
||||
user: AuthenticatedUser;
|
||||
sessionId: string;
|
||||
issuedAt: Date;
|
||||
expiresAt: Date;
|
||||
}
|
||||
|
||||
export interface AuthTokenPayload {
|
||||
sub: string;
|
||||
sessionId: string;
|
||||
roles: UserRole[];
|
||||
iat?: number;
|
||||
exp?: number;
|
||||
}
|
||||
9
packages/auth/tsconfig.json
Normal file
9
packages/auth/tsconfig.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"extends": "@hexahost/typescript-config/library.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist",
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
||||
Reference in New Issue
Block a user