Skip to content

Commit ab55a16

Browse files
committed
feat: fix sync issue
1 parent 0726d7e commit ab55a16

File tree

11 files changed

+786
-19
lines changed

11 files changed

+786
-19
lines changed

infrastructure/eid-wallet/src-tauri/Info.ios.plist

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,11 @@
66
<string>Authenticate with biometric</string>
77
<key>NSCameraUsageDescription</key>
88
<string>Read QR codes</string>
9+
10+
<key>NSAppTransportSecurity</key>
11+
<dict>
12+
<key>NSAllowsArbitraryLoads</key>
13+
<true/>
14+
</dict>
915
</dict>
1016
</plist>
Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
11
{
2-
"$schema": "../gen/schemas/mobile-schema.json",
3-
"identifier": "mobile-capability",
4-
"description": "Capability for the main window on mobile",
5-
"windows": [
6-
"main"
7-
],
8-
"permissions": [
9-
"core:default",
10-
"opener:default",
11-
"store:default",
12-
"biometric:default",
13-
"barcode-scanner:default"
14-
],
15-
"platforms": [
16-
"iOS",
17-
"android"
18-
]
19-
}
2+
"$schema": "../gen/schemas/mobile-schema.json",
3+
"identifier": "mobile-capability",
4+
"description": "Capability for the main window on mobile",
5+
"windows": ["main"],
6+
"permissions": [
7+
"core:default",
8+
"opener:default",
9+
"store:default",
10+
"biometric:default",
11+
"barcode-scanner:default"
12+
],
13+
"platforms": ["iOS", "android"]
14+
}

infrastructure/eid-wallet/src-tauri/gen/android/app/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ android {
1717
compileSdk = 34
1818
namespace = "foundation.metastate.eid_wallet"
1919
defaultConfig {
20-
manifestPlaceholders["usesCleartextTraffic"] = "false"
20+
manifestPlaceholders["usesCleartextTraffic"] = "true"
2121
applicationId = "foundation.metastate.eid_wallet"
2222
minSdk = 24
2323
targetSdk = 34

infrastructure/eid-wallet/src-tauri/gen/apple/eid-wallet_iOS/Info.plist

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,10 @@
4444
<string>Authenticate with biometric</string>
4545
<key>NSCameraUsageDescription</key>
4646
<string>Read QR codes</string>
47+
<key>NSAppTransportSecurity</key>
48+
<dict>
49+
<key>NSAllowsArbitraryLoads</key>
50+
<true/>
51+
</dict>
4752
</dict>
4853
</plist>

platforms/registry/src/index.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,21 @@ server.get("/resolve", async (request, reply) => {
141141
}
142142
});
143143

144+
// List all vault entries
145+
server.get("/list", async (request, reply) => {
146+
try {
147+
const vaults = await vaultService.findAll();
148+
return vaults.map(vault => ({
149+
ename: vault.ename,
150+
uri: vault.uri,
151+
evault: vault.evault,
152+
}));
153+
} catch (error) {
154+
server.log.error(error);
155+
reply.status(500).send({ error: "Failed to list vault entries" });
156+
}
157+
});
158+
144159
const start = async () => {
145160
try {
146161
await initializeDatabase();

services/search-engine/README.md

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
# Search Engine Service
2+
3+
A service that queries the registry and eVault to provide search functionality across registry entries and user profiles.
4+
5+
## Features
6+
7+
- **Registry Data Caching**: Queries the registry's `/list` endpoint and caches all vault entries
8+
- **User Profile Caching**: Queries eVault for user profiles using the User schema (ID: `550e8400-e29b-41d4-a716-446655440000`)
9+
- **Automatic Refresh**: Runs a cron job every 15 minutes to refresh cached data
10+
- **Multi-field Search**: Search by name, ename, w3id, username, displayName, bio, location, website, etc.
11+
- **Combined Search**: Search across both registry entries and user profiles simultaneously
12+
13+
## Configuration
14+
15+
Set the following environment variables:
16+
17+
```bash
18+
PORT=3002 # Service port (default: 3002)
19+
REGISTRY_URL=http://localhost:4321 # Registry service URL
20+
EVAULT_BASE_URL=http://localhost:4000 # eVault service URL
21+
```
22+
23+
## API Endpoints
24+
25+
### Health Check
26+
27+
```
28+
GET /health
29+
```
30+
31+
Returns service status and cache statistics.
32+
33+
### Search Registry Entries
34+
35+
```
36+
GET /search/registry?q=<query>&type=<search_type>
37+
```
38+
39+
Search registry entries by query and optional type filter.
40+
41+
**Parameters:**
42+
43+
- `q` (required): Search query
44+
- `type` (optional): Search type (`ename`, `w3id`, `uri`, `evault`, or `all`)
45+
46+
### Search User Profiles
47+
48+
```
49+
GET /search/users?q=<query>&type=<search_type>
50+
```
51+
52+
Search user profiles by query and optional type filter.
53+
54+
**Parameters:**
55+
56+
- `q` (required): Search query
57+
- `type` (optional): Search type (`username`, `displayName`, `bio`, `location`, `website`, or `all`)
58+
59+
### Combined Search
60+
61+
```
62+
GET /search?q=<query>&type=<search_type>
63+
```
64+
65+
Search both registry entries and user profiles simultaneously.
66+
67+
### Cache Statistics
68+
69+
```
70+
GET /cache/stats
71+
```
72+
73+
Returns current cache statistics.
74+
75+
### Manual Refresh
76+
77+
```
78+
POST /refresh
79+
```
80+
81+
Manually trigger a cache refresh.
82+
83+
## Installation
84+
85+
```bash
86+
cd services/search-engine
87+
npm install
88+
```
89+
90+
## Development
91+
92+
```bash
93+
npm run dev
94+
```
95+
96+
## Production
97+
98+
```bash
99+
npm start
100+
```
101+
102+
## Data Flow
103+
104+
1. **Initial Load**: Service starts and immediately fetches data from registry and eVault
105+
2. **Scheduled Refresh**: Every 15 minutes, the service refreshes all cached data
106+
3. **Search Queries**: Users can search cached data instantly without hitting external services
107+
4. **Manual Refresh**: Admins can trigger immediate cache refresh via API
108+
109+
## User Profile Schema
110+
111+
The service queries user profiles using the User schema with ID `550e8400-e29b-41d4-a716-446655440000`. Searchable fields include:
112+
113+
- `username`: User's unique username/handle
114+
- `displayName`: User's display name or full name
115+
- `bio`: User's biography or description
116+
- `location`: User's physical location
117+
- `website`: User's personal website URL
118+
- `avatarUrl`: URL to user's profile picture
119+
- `bannerUrl`: URL to user's profile banner
120+
- `isVerified`: Whether the user's account is verified
121+
- `isPrivate`: Whether the user's account is private
122+
- `followerCount`: Number of followers
123+
- `followingCount`: Number of users followed
124+
- `postCount`: Number of posts created
125+
126+
## Registry Entry Structure
127+
128+
Registry entries contain:
129+
130+
- `ename`: W3ID identifier
131+
- `uri`: Service URI
132+
- `evault`: eVault identifier
133+
134+
## Error Handling
135+
136+
The service gracefully handles:
137+
138+
- Network timeouts
139+
- Service unavailability
140+
- Invalid responses
141+
- Partial data failures
142+
143+
Failed queries are logged but don't crash the service, ensuring high availability.

0 commit comments

Comments
 (0)