Skip to content

Commit c80cf92

Browse files
authored
Feat/add x ename header to group and provisioner (#418)
* chore: add platform x-ename header * chore: fix dreamsync build * chore: fix native dep issues with CI * chore: fix build config stuff * chore: remove optinal dep * chore: fix build step * chore: fix eVault X-ENAME caching * chore: fix blabsy build step for test * chore: fix blabsy sample env
1 parent ed2cf47 commit c80cf92

File tree

11 files changed

+180
-62
lines changed

11 files changed

+180
-62
lines changed

.env.example

Lines changed: 68 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,73 @@
1-
# Pictique Configuration
2-
PUBLIC_PICTIQUE_BASE_URL=your_public_pictique_base_url_here
1+
# Neo4j Configuration
2+
NEO4J_URI=bolt://localhost:7687
3+
NEO4J_USER=neo4j
4+
NEO4J_PASSWORD=your-neo4j-password
35

4-
# Blabsy Configuration
5-
PUBLIC_BLABSY_BASE_URL=your_public_blabsy_base_url_here
6+
PUBLIC_EVAULT_SERVER_URI=http://localhost:4000
67

7-
# Eid Wallet & Pictique Configuration (Svelte)
8-
PUBLIC_REGISTRY_URL=your_public_registry_url_here
9-
PUBLIC_PROVISIONER_URL=your_public_provisioner_url_here
8+
REGISTRY_ENTROPY_KEY_JWK='{"kty":"EC","use":"sig","alg":"ES256","kid":"entropy-key-1","crv":"P-256","x":"your-x-value","y":"your-y-value","d":"your-d-value"}'
9+
ENCRYPTION_PASSWORD="your-encryption-password"
10+
W3ID="@your-w3id"
1011

11-
# Next.js Applications Configuration (eVoting, Blabsy, Group Charter Manager)
12-
NEXT_PUBLIC_REGISTRY_URL=your_public_registry_url_here
12+
REGISTRY_DATABASE_URL=postgresql://postgres:postgres@localhost:5432/registry
1313

14-
# Neo4j Configuration
15-
NEO4J_URI=bolt://neo4j:7687
16-
NEO4J_USER=neo4j
17-
NEO4J_PASSWORD=your_secure_password_here
14+
REGISTRY_SHARED_SECRET="your-registry-shared-secret"
15+
PROVISIONER_DATABASE_URL="postgres://postgres:postgres@localhost:5432/provisioner"
16+
PUBLIC_VERIFF_KEY="your-veriff-key"
17+
VERIFF_HMAC_KEY="your-veriff-hmac-key"
18+
19+
# set this to allow or deny
20+
DUPLICATES_POLICY="DENY"
21+
IP_ADDR="localhost"
22+
23+
PICTIQUE_DATABASE_URL=postgresql://postgres:postgres@localhost:5432/pictique
24+
25+
PICTIQUE_MAPPING_DB_PATH=/path/to/pictique/mapping/db
26+
BLABSY_MAPPING_DB_PATH="/path/to/blabsy/mapping/db"
27+
DREAMSYNC_MAPPING_DB_PATH="/path/to/dreamsync/mapping/db"
28+
GROUP_CHARTER_MAPPING_DB_PATH=/path/to/charter/mapping/db
29+
CERBERUS_MAPPING_DB_PATH=/path/to/cerberus/mapping/db
30+
31+
GOOGLE_APPLICATION_CREDENTIALS="/path/to/firebase-secrets.json"
32+
33+
#PUBLIC_REGISTRY_URL="https://registry.w3ds.metastate.foundation"
34+
#PUBLIC_PROVISIONER_URL="https://provisioner.w3ds.metastate.foundation"
35+
36+
#PUBLIC_REGISTRY_URL="https://registry.staging.metastate.foundation"
37+
#PUBLIC_PROVISIONER_URL="https://provisioner.staging.metastate.foundation"
38+
39+
PUBLIC_REGISTRY_URL="http://localhost:4321"
40+
PUBLIC_PROVISIONER_URL="http://localhost:3001"
41+
42+
PUBLIC_PICTIQUE_URL="http://localhost:5173"
43+
PUBLIC_PICTIQUE_BASE_URL="http://localhost:1111"
44+
PUBLIC_BLABSY_URL="http://localhost:8080"
45+
PUBLIC_BLABSY_BASE_URL="http://localhost:4444"
46+
47+
PUBLIC_GROUP_CHARTER_BASE_URL="http://localhost:5555"
48+
GROUP_CHARTER_DATABASE_URL=postgresql://postgres:postgres@localhost:5432/group_charter_manager
49+
50+
CERBERUS_DATABASE_URL=postgresql://postgres:postgres@localhost:5432/cerberus
51+
PUBLIC_CERBERUS_BASE_URL="http://localhost:6666"
52+
53+
EVOTING_DATABASE_URL=postgresql://postgres:postgres@localhost:5432/evoting
54+
55+
EVOTING_MAPPING_DB_PATH="/path/to/evoting/mapping/db"
56+
57+
OPENAI_API_KEY=sk-your-openai-api-key
58+
59+
PUBLIC_EVOTING_BASE_URL="http://localhost:7777"
60+
PUBLIC_EVOTING_URL="http://localhost:3001"
61+
62+
PUBLIC_APP_STORE_EID_WALLET=""
63+
PUBLIC_PLAY_STORE_EID_WALLET=""
64+
NOTIFICATION_SHARED_SECRET=your-notification-secret-key
65+
66+
DREAMSYNC_DATABASE_URL=postgresql://postgres:postgres@localhost:5432/dreamsync
67+
VITE_DREAMSYNC_BASE_URL="http://localhost:8888"
68+
69+
EREPUTATION_DATABASE_URL=postgresql://postgres:postgres@localhost:5432/ereputation
70+
EREPUTATION_MAPPING_DB_PATH="/path/to/erep/mapping/db"
71+
VITE_EREPUTATION_BASE_URL=http://localhost:8765
1872

19-
# eVault Configuration
20-
PORT=4000
73+
LOAD_TEST_USER_COUNT=6

.github/workflows/build.yml

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,56 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@v4
1515

16+
- name: Setup pnpm
17+
uses: pnpm/action-setup@v4
18+
with:
19+
version: 10.13.1
20+
run_install: false
21+
1622
- name: Setup Node.js
1723
uses: actions/setup-node@v4
1824
with:
1925
node-version: 22.x
26+
cache: 'pnpm'
2027

2128
- name: Install build dependencies
2229
run: |
2330
sudo apt-get update
2431
sudo apt-get install -y build-essential python3
2532
26-
- name: Install pnpm
27-
run: npm install -g pnpm
33+
- name: Setup environment variables
34+
run: |
35+
# Always copy .env.example to .env before builds to ensure env vars are available
36+
# Root level .env
37+
if [ -f .env.example ]; then
38+
cp .env.example .env
39+
echo "✅ Created root .env from .env.example"
40+
else
41+
echo "⚠️ Warning: root .env.example not found, creating minimal .env"
42+
touch .env
43+
fi
44+
45+
# Package-level .env files (e.g., blabsy)
46+
for dir in platforms/* infrastructure/*; do
47+
if [ -d "$dir" ] && [ -f "$dir/.env.example" ]; then
48+
cp "$dir/.env.example" "$dir/.env"
49+
echo "✅ Created $dir/.env from $dir/.env.example"
50+
fi
51+
done
2852
2953
- name: Install Dependencies
30-
run: pnpm install
31-
32-
- name: Clean and rebuild native modules
3354
run: |
34-
# Remove any pre-built binaries that might be incompatible
35-
find node_modules -name "*.node" -delete 2>/dev/null || true
36-
# Rebuild all native modules
37-
pnpm rebuild
55+
# Install all dependencies (optional dependencies are installed by default)
56+
# Use --frozen-lockfile to ensure reproducible builds
57+
pnpm install --frozen-lockfile
58+
59+
- name: Rebuild native modules
60+
run: |
61+
# Rebuild native modules to ensure compatibility with CI environment
62+
pnpm rebuild || echo "Rebuild completed with warnings (some packages may not need rebuilding)"
3863
3964
- name: Build All Packages
40-
run: pnpm build
65+
run: |
66+
# Build all packages using turbo
67+
pnpm build
4168

.npmrc

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

infrastructure/control-panel/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@
5454
"lucide-svelte": "^0.539.0",
5555
"tailwind-merge": "^3.0.2"
5656
}
57-
}
57+
}

infrastructure/web3-adapter/src/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,11 @@ async function createGroupManifestWithRetry(
180180
const endpoint = new URL("/graphql", response.data.uri).toString();
181181

182182
const { GraphQLClient } = await import("graphql-request");
183-
const client = new GraphQLClient(endpoint);
183+
const client = new GraphQLClient(endpoint, {
184+
headers: {
185+
"X-ENAME": w3id,
186+
},
187+
});
184188

185189
const STORE_META_ENVELOPE = `
186190
mutation StoreMetaEnvelope($input: MetaEnvelopeInput!) {

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,13 @@
3535
"onlyBuiltDependencies": [
3636
"@biomejs/biome",
3737
"@parcel/watcher",
38+
"@rollup/rollup-linux-x64-gnu",
3839
"cpu-features",
3940
"es5-ext",
4041
"esbuild",
4142
"msw",
4243
"protobufjs",
44+
"rollup",
4345
"sqlite3",
4446
"ssh2",
4547
"svelte-preprocess"

platforms/blabsy/.env.example

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
1-
# Registry URL for fetching motd and other registry services
2-
# Note: In Next.js, environment variables exposed to the browser must be prefixed with NEXT_PUBLIC_
3-
NEXT_PUBLIC_REGISTRY_URL=http://localhost:4321
1+
PUBLIC_REGISTRY_URL="PUBLIC_REGISTRY_URL"
2+
# Dev URL
3+
NEXT_PUBLIC_URL=NEXT_PUBLIC_URL
4+
NEXT_PUBLIC_BASE_URL=NEXT_PUBLIC_BASE_URL
45

6+
# Emulator
7+
NEXT_PUBLIC_USE_EMULATOR=false
8+
9+
# Firebase
10+
NEXT_PUBLIC_API_KEY="API-KEY"
11+
NEXT_PUBLIC_AUTH_DOMAIN="auth-domain"
12+
NEXT_PUBLIC_PROJECT_ID="project-id"
13+
NEXT_PUBLIC_STORAGE_BUCKET="bucket-id"
14+
NEXT_PUBLIC_MESSAGING_SENDER_ID="sender-id"
15+
NEXT_PUBLIC_APP_ID="app-id"
16+
NEXT_PUBLIC_MEASUREMENT_ID="measurement-id"

platforms/cerberus/src/services/PlatformEVaultService.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export class PlatformEVaultService {
4242
private static instance: PlatformEVaultService;
4343
private client: GraphQLClient | null = null;
4444
private endpoint: string | null = null;
45+
private w3id: string | null = null;
4546

4647
private constructor() {}
4748

@@ -169,9 +170,15 @@ export class PlatformEVaultService {
169170
* Ensure we have a valid GraphQL client
170171
*/
171172
private async ensureClient(w3id: string): Promise<GraphQLClient> {
172-
if (!this.endpoint || !this.client) {
173+
// Recreate client if w3id changed or client/endpoint is missing
174+
if (!this.endpoint || !this.client || this.w3id !== w3id) {
173175
this.endpoint = await this.resolveEndpoint(w3id);
174-
this.client = new GraphQLClient(this.endpoint);
176+
this.client = new GraphQLClient(this.endpoint, {
177+
headers: {
178+
"X-ENAME": w3id,
179+
},
180+
});
181+
this.w3id = w3id;
175182
}
176183
return this.client;
177184
}

platforms/dreamSync/vite.config.ts

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,37 @@ import runtimeErrorOverlay from "@replit/vite-plugin-runtime-error-modal";
66
const envDir = path.resolve(import.meta.dirname, "../../");
77
console.log("🔍 Vite envDir:", envDir);
88

9-
export default defineConfig({
10-
plugins: [
9+
export default defineConfig(async () => {
10+
const plugins = [
1111
react(),
1212
runtimeErrorOverlay(),
13-
...(process.env.NODE_ENV !== "production" &&
14-
process.env.REPL_ID !== undefined
15-
? [
16-
await import("@replit/vite-plugin-cartographer").then((m) =>
17-
m.cartographer(),
18-
),
19-
]
20-
: []),
21-
],
22-
resolve: {
23-
alias: {
24-
"@": path.resolve(import.meta.dirname, "client", "src"),
25-
"@shared": path.resolve(import.meta.dirname, "shared"),
26-
"@assets": path.resolve(import.meta.dirname, "attached_assets"),
13+
];
14+
15+
if (process.env.NODE_ENV !== "production" && process.env.REPL_ID !== undefined) {
16+
const { cartographer } = await import("@replit/vite-plugin-cartographer");
17+
plugins.push(cartographer());
18+
}
19+
20+
return {
21+
plugins,
22+
resolve: {
23+
alias: {
24+
"@": path.resolve(import.meta.dirname, "client", "src"),
25+
"@shared": path.resolve(import.meta.dirname, "shared"),
26+
"@assets": path.resolve(import.meta.dirname, "attached_assets"),
27+
},
28+
},
29+
root: path.resolve(import.meta.dirname, "client"),
30+
build: {
31+
outDir: path.resolve(import.meta.dirname, "dist/public"),
32+
emptyOutDir: true,
2733
},
28-
},
29-
root: path.resolve(import.meta.dirname, "client"),
30-
build: {
31-
outDir: path.resolve(import.meta.dirname, "dist/public"),
32-
emptyOutDir: true,
33-
},
34-
server: {
35-
fs: {
36-
strict: true,
37-
deny: ["**/.*"],
34+
server: {
35+
fs: {
36+
strict: true,
37+
deny: ["**/.*"],
38+
},
3839
},
39-
},
40-
envDir: envDir,
40+
envDir: envDir,
41+
};
4142
});

platforms/dreamsync-api/src/services/PlatformEVaultService.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export class PlatformEVaultService {
4242
private static instance: PlatformEVaultService;
4343
private client: GraphQLClient | null = null;
4444
private endpoint: string | null = null;
45+
private w3id: string | null = null;
4546

4647
private constructor() {}
4748

@@ -169,9 +170,15 @@ export class PlatformEVaultService {
169170
* Ensure we have a valid GraphQL client
170171
*/
171172
private async ensureClient(w3id: string): Promise<GraphQLClient> {
172-
if (!this.endpoint || !this.client) {
173+
// Recreate client if w3id changed or client/endpoint is missing
174+
if (!this.endpoint || !this.client || this.w3id !== w3id) {
173175
this.endpoint = await this.resolveEndpoint(w3id);
174-
this.client = new GraphQLClient(this.endpoint);
176+
this.client = new GraphQLClient(this.endpoint, {
177+
headers: {
178+
"X-ENAME": w3id,
179+
},
180+
});
181+
this.w3id = w3id;
175182
}
176183
return this.client;
177184
}

0 commit comments

Comments
 (0)