Skip to content

Commit d22457f

Browse files
sosweethamBekiboo
andauthored
Feat/profile editor (#910)
* feat: profile editor * fix: profile video download * feat: dreamsync integration * fix: update lockfile * fix: dreamsync profile patch * fix: actions * fix: remove unused shad components * fix: format * fix: build * fix: lockfile * fix: ai suggestions * fix: add missing headers for file upload * fix: update dependencies and clean up prepare script * fix: normalize ACL entries and improve error handling in EVaultProfileService * fix: reorder and format dependencies in package.json * fix: enhance URL normalization and validation in SocialLinksSection * fix: update package dependencies in pnpm-lock.yaml for improved compatibility * fix: improve error handling for createMetaEnvelope in EVaultProfileService * fix: enhance access control logic for profile assets in ProfileController * fix: normalize eName before setting in headers for GraphQLClient * fix: enhance educational and work experience sections with improved labels and placeholders * feat: add logo and favicon images for profile editor * fix: replace native select with custom Select component for platform selection * resolve pnpm-lock.yaml merge conflict * fix: dreamsync warns * fix: explicit pub priv profile behaviour * fix: dreamsync profile visibility --------- Co-authored-by: Bekiboo <julien.connault@gmail.com>
1 parent 9512a3d commit d22457f

152 files changed

Lines changed: 8351 additions & 58 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ PUBLIC_PROVISIONER_SHARED_SECRET="your-provisioner-shared-secret"
9292

9393
PUBLIC_ESIGNER_BASE_URL="http://localhost:3004"
9494
PUBLIC_FILE_MANAGER_BASE_URL="http://localhost:3005"
95+
PUBLIC_PROFILE_EDITOR_BASE_URL="http://localhost:3006"
9596

9697
DREAMSYNC_DATABASE_URL=postgresql://postgres:postgres@localhost:5432/dreamsync
9798
VITE_DREAMSYNC_BASE_URL="http://localhost:8888"

.npmrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
optional=true
22
strict-peer-dependencies=false
3-

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
### Port Assignments
1010

1111
#### Core Services (Always Running)
12+
1213
- **4321** - Registry Service
1314
- **3001** - evault-core Provisioning API (Express)
1415
- **4000** - evault-core GraphQL/HTTP API (Fastify)
@@ -17,6 +18,7 @@
1718
- **7687** - Neo4j Bolt Protocol
1819

1920
#### Platform APIs
21+
2022
- **3000** - Blabsy W3DS Auth API
2123
- **3002** - Cerberus API
2224
- **3003** - Group Charter Manager API
@@ -28,6 +30,7 @@
2830
- **1111** - Pictique API
2931

3032
#### Frontend Services
33+
3134
- **8080** - Dev sandbox (W3DS) / Blabsy Frontend
3235
- **5173** - Pictique Frontend
3336
- **3004** - Group Charter Manager Frontend
@@ -37,19 +40,24 @@
3740
### Docker Compose Profiles
3841

3942
#### `socials` Profile
43+
4044
Runs core services plus social media platforms:
45+
4146
- Core: registry, evault-core, postgres, neo4j
4247
- Pictique API + Frontend
4348
- Blabsy API + Frontend
4449

4550
#### `charter-blabsy` Profile
51+
4652
Runs core services plus charter and blabsy:
53+
4754
- Core: registry, evault-core, postgres, neo4j
4855
- Group Charter Manager API + Frontend
4956
- Blabsy API + Frontend
5057
- Cerberus
5158

5259
#### `all` Profile
60+
5361
Runs all services (core + all APIs + all frontends)
5462

5563
### Usage

docs/docusaurus.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ const config: Config = {
4646
sidebarPath: './sidebars.ts',
4747
editUrl: 'https://github.com/MetaState-Prototype-Project/prototype/tree/main/docs/',
4848
},
49+
blog: false,
4950
} satisfies Preset.Options,
5051
],
5152
],

infrastructure/control-panel/config/admin-enames.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
"@7218b67d-da21-54d6-9a85-7c4db1d09768",
44
"@82f7a77a-f03a-52aa-88fc-1b1e488ad498",
55
"@35a31f0d-dd76-5780-b383-29f219fcae99",
6-
"@82f7a77a-f03a-52aa-88fc-1b1e488ad498",
7-
"@af7e4f55-ad9d-537c-81ef-4f3a234bdd2c",
8-
"@6e1bbcd4-1f59-5bd8-aa3c-6f5301c356d7",
9-
"@b995a88a-90d1-56fc-ba42-1e1eb664861c"
6+
"@82f7a77a-f03a-52aa-88fc-1b1e488ad498"
107
]
118
}

packages/auth/package.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"name": "@metastate-foundation/auth",
3+
"version": "0.1.0",
4+
"description": "Shared authentication utilities for w3ds platform APIs",
5+
"type": "module",
6+
"scripts": {
7+
"build": "tsc -p tsconfig.json",
8+
"check-types": "tsc --noEmit",
9+
"postinstall": "npm run build"
10+
},
11+
"main": "./dist/index.js",
12+
"types": "./dist/index.d.ts",
13+
"exports": {
14+
".": {
15+
"types": "./dist/index.d.ts",
16+
"import": "./dist/index.js",
17+
"require": "./dist/index.js",
18+
"default": "./dist/index.js"
19+
}
20+
},
21+
"files": ["dist"],
22+
"dependencies": {
23+
"jsonwebtoken": "^9.0.2",
24+
"signature-validator": "workspace:*",
25+
"uuid": "^11.1.0"
26+
},
27+
"devDependencies": {
28+
"@types/jsonwebtoken": "^9.0.9",
29+
"@types/node": "^20.11.24",
30+
"@types/uuid": "^10.0.0",
31+
"typescript": "~5.6.2"
32+
}
33+
}

packages/auth/src/auth-offer.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { v4 as uuidv4 } from "uuid";
2+
import type { AuthOfferConfig } from "./types.js";
3+
4+
export interface AuthOffer {
5+
uri: string;
6+
session: string;
7+
}
8+
9+
export function buildAuthOffer(config: AuthOfferConfig): AuthOffer {
10+
const callbackPath = config.callbackPath ?? "/api/auth";
11+
const url = new URL(callbackPath, config.baseUrl).toString();
12+
const session = uuidv4();
13+
const uri = `w3ds://auth?redirect=${url}&session=${session}&platform=${config.platform}`;
14+
return { uri, session };
15+
}

packages/auth/src/guard.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export function createAuthGuard() {
2+
return (req: any, res: any, next: any): void => {
3+
if (!req.user) {
4+
return res.status(401).json({ error: "Authentication required" });
5+
}
6+
next();
7+
};
8+
}

packages/auth/src/index.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
export { signToken, verifyToken } from "./jwt.js";
2+
export { createAuthMiddleware } from "./middleware.js";
3+
export { createAuthGuard } from "./guard.js";
4+
export { buildAuthOffer } from "./auth-offer.js";
5+
export type { AuthOffer } from "./auth-offer.js";
6+
export { verifyLoginSignature } from "./verify-login.js";
7+
export type {
8+
AuthUser,
9+
JwtPayload,
10+
AuthMiddlewareConfig,
11+
AuthOfferConfig,
12+
LoginVerificationConfig,
13+
LoginVerificationResult,
14+
} from "./types.js";

packages/auth/src/jwt.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import jwt from "jsonwebtoken";
2+
import type { JwtPayload } from "./types.js";
3+
4+
export function signToken(
5+
payload: JwtPayload,
6+
secret: string,
7+
options?: { expiresIn?: string | number },
8+
): string {
9+
return jwt.sign(payload as object, secret, {
10+
expiresIn: (options?.expiresIn ?? "7d") as any,
11+
});
12+
}
13+
14+
export function verifyToken(token: string, secret: string): JwtPayload {
15+
try {
16+
return jwt.verify(token, secret) as JwtPayload;
17+
} catch {
18+
throw new Error("Invalid token");
19+
}
20+
}

0 commit comments

Comments
 (0)