Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions docs/docs/W3DS Basics/Binding-Documents.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -74,19 +74,25 @@ Binds an eName to a photograph (selfie or profile picture).

### social_connection

Binds an eName to a social connection or relationship claim.
Binds an eName to a social connection or relationship claim between two parties.

```json
{
"type": "social_connection",
"data": {
"name": "Alice Smith"
"kind": "social_connection",
"name": "Alice Smith",
"parties": ["@ename-1", "@ename-2"],
"relation_description": "Known each other since university"
}
}
```

**Data fields:**
- `kind` — Discriminant field, always `"social_connection"`
- `name` — Name of the connected person or entity
- `parties` — Array of exactly two eNames identifying both participants in the connection
- `relation_description` — Arbitrary text describing the nature of the relationship

### self

Expand Down
2 changes: 1 addition & 1 deletion infrastructure/control-panel/README.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -129,7 +129,7 @@ CONTROL_PANEL_ADMIN_ENAMES_FILE=config/admin-enames.json

```json
{
"admins": ["@admin1.w3id", "@admin2.w3id"]
"admins": ["@admin1.w3id", "@admin2.w3id"]
}
```

Expand Down
14 changes: 7 additions & 7 deletions infrastructure/control-panel/config/admin-enames.json
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
{
"admins": [
"@7218b67d-da21-54d6-9a85-7c4db1d09768",
"@82f7a77a-f03a-52aa-88fc-1b1e488ad498",
"@35a31f0d-dd76-5780-b383-29f219fcae99",
"@82f7a77a-f03a-52aa-88fc-1b1e488ad498",
"@af7e4f55-ad9d-537c-81ef-4f3a234bdd2c"
]
"admins": [
"@7218b67d-da21-54d6-9a85-7c4db1d09768",
"@82f7a77a-f03a-52aa-88fc-1b1e488ad498",
"@35a31f0d-dd76-5780-b383-29f219fcae99",
"@82f7a77a-f03a-52aa-88fc-1b1e488ad498",
"@af7e4f55-ad9d-537c-81ef-4f3a234bdd2c"
]
}
Original file line numberDiff line numberDiff line change
Expand Up@@ -30,7 +30,6 @@ export class EVaultService {
return freshData;
}


/**
* Get cache status information
*/
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,9 +28,7 @@ function getBaseUrl(): string {
return `http://localhost:${port}`;
}

export async function sendNotification(
request: SendNotificationRequest
): Promise<SendResult> {
export async function sendNotification(request: SendNotificationRequest): Promise<SendResult> {
const baseUrl = getBaseUrl();
try {
const response = await fetch(`${baseUrl}/api/send`, {
Expand DownExpand Up@@ -69,9 +67,9 @@ export async function getDevicesWithTokens(): Promise<
}
}

export async function getDevicesByEName(eName: string): Promise<
{ token: string; platform: string; eName: string }[]
> {
export async function getDevicesByEName(
eName: string
): Promise<{ token: string; platform: string; eName: string }[]> {
const { env } = await import('$env/dynamic/private');
const provisionerUrl =
env.PUBLIC_PROVISIONER_URL || env.PROVISIONER_URL || 'http://localhost:3001';
Expand DownExpand Up@@ -110,7 +108,10 @@ export async function sendBulkNotifications(
return {
sent,
failed: failed.length,
errors: failed.map((r) => ({ token: r.token.slice(0, 20) + '...', error: r.error ?? 'Unknown' }))
errors: failed.map((r) => ({
token: r.token.slice(0, 20) + '...',
error: r.error ?? 'Unknown'
}))
};
}

Expand Down
16 changes: 11 additions & 5 deletions infrastructure/control-panel/src/routes/+layout.svelte
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,7 +27,7 @@

{#if isLoginRoute}
<main class="min-h-screen bg-gray-50">
<section class="px-10 pb-10 pt-10">
<section class="px-10 pt-10 pb-10">
{@render children()}
</section>
</main>
Expand DownExpand Up@@ -104,7 +104,8 @@
const evaultObjects = evaultIds
.map((id: string) =>
allEVaults.find(
(e: any) => (e.evault || e.ename || e.id) === id
(e: any) =>
(e.evault || e.ename || e.id) === id
)
)
.filter(Boolean);
Expand All@@ -125,7 +126,8 @@
) {
const { registryService } =
await import('$lib/services/registry');
const allPlatforms = await registryService.getPlatforms();
const allPlatforms =
await registryService.getPlatforms();
const platformObjects = platformUrls
.map((url: string) =>
allPlatforms.find((p: any) => p.url === url)
Expand DownExpand Up@@ -155,11 +157,15 @@
{/if}

{#if data?.user?.ename}
<div class="rounded-full border border-gray-200 bg-gray-50 px-3 py-1 text-sm text-gray-700">
<div
class="rounded-full border border-gray-200 bg-gray-50 px-3 py-1 text-sm text-gray-700"
>
{data.user.ename}
</div>
{/if}
<ButtonAction size="sm" variant="soft" callback={handleLogout}>Logout</ButtonAction>
<ButtonAction size="sm" variant="soft" callback={handleLogout}
>Logout</ButtonAction
>
</div>
</header>
<section class="px-10 pb-10">
Expand Down
3 changes: 1 addition & 2 deletions infrastructure/control-panel/src/routes/+page.svelte
Original file line numberDiff line numberDiff line change
Expand Up@@ -463,8 +463,7 @@
</script>

{#snippet ENameWithType(value: unknown)}
{@const item =
(value as { ename?: string; type?: 'user' | 'group' } | null) ?? null}
{@const item = (value as { ename?: string; type?: 'user' | 'group' } | null) ?? null}
{@const ename = item?.ename || 'N/A'}
{@const type = item?.type || 'group'}
<div class="flex items-center gap-2 whitespace-nowrap">
Expand Down
14 changes: 7 additions & 7 deletions infrastructure/control-panel/src/routes/api/auth/+server.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,13 +19,10 @@ type VerifySignatureOutput = {
};

const require = createRequire(import.meta.url);
let verifySignatureFn:
| ((options: VerifySignatureInput) => Promise<VerifySignatureOutput>)
| null = null;
let verifySignatureFn: ((options: VerifySignatureInput) => Promise<VerifySignatureOutput>) | null =
null;

async function verifyW3dsSignature(
options: VerifySignatureInput
): Promise<VerifySignatureOutput> {
async function verifyW3dsSignature(options: VerifySignatureInput): Promise<VerifySignatureOutput> {
if (!verifySignatureFn) {
const signatureValidator = require('signature-validator') as {
verifySignature: (input: VerifySignatureInput) => Promise<VerifySignatureOutput>;
Expand DownExpand Up@@ -82,7 +79,10 @@ export const POST: RequestHandler = async ({ request, cookies }) => {
const registryBaseUrl = env.PUBLIC_REGISTRY_URL;
if (!registryBaseUrl) {
console.error('[auth] Missing PUBLIC_REGISTRY_URL');
publishAuthSessionResult(session, { status: 'error', message: 'Server not configured' });
publishAuthSessionResult(session, {
status: 'error',
message: 'Server not configured'
});
return json({ error: 'Server configuration error' }, { status: 500 });
}
console.info('[auth] Verifying signature', {
Expand Down
11 changes: 7 additions & 4 deletions infrastructure/control-panel/src/routes/api/evaults/+server.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -110,8 +110,12 @@ async function resolveVaultIdentity(
return {
type: 'user',
name:
firstNonEmptyString(userProfile.displayName, userProfile.username, vault.ename, vault.evault) ||
defaultName
firstNonEmptyString(
userProfile.displayName,
userProfile.username,
vault.ename,
vault.evault
) || defaultName
};
}

Expand All@@ -128,8 +132,7 @@ async function resolveVaultIdentity(
groupManifest.ename,
vault.ename,
vault.evault
) ||
defaultName
) || defaultName
};
}

Expand Down
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
import { json } from '@sveltejs/kit';
import type { RequestHandler } from '@sveltejs/kit';
import {
getDevicesWithTokens,
sendBulkNotifications
} from '$lib/services/notificationService';
import { getDevicesWithTokens, sendBulkNotifications } from '$lib/services/notificationService';

export const POST: RequestHandler = async ({ request }) => {
try {
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,7 +8,10 @@ export const POST: RequestHandler = async ({ request }) => {
const { tokens, platform, payload } = body;

if (!Array.isArray(tokens) || tokens.length === 0) {
return json({ success: false, error: 'tokens must be a non-empty array' }, { status: 400 });
return json(
{ success: false, error: 'tokens must be a non-empty array' },
{ status: 400 }
);
}
if (!payload?.title || !payload?.body) {
return json(
Expand Down
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
import { json } from '@sveltejs/kit';
import type { RequestHandler } from '@sveltejs/kit';
import {
getDevicesByEName,
sendBulkNotifications
} from '$lib/services/notificationService';
import { getDevicesByEName, sendBulkNotifications } from '$lib/services/notificationService';

export const POST: RequestHandler = async ({ request }) => {
try {
const body = await request.json();
const { eName, payload } = body;

if (!eName || typeof eName !== 'string' || !eName.trim()) {
return json(
{ success: false, error: 'Missing or invalid eName' },
{ status: 400 }
);
return json({ success: false, error: 'Missing or invalid eName' }, { status: 400 });
}
if (!payload?.title || !payload?.body) {
return json(
Expand Down
10 changes: 7 additions & 3 deletions infrastructure/control-panel/src/routes/login/+page.svelte
Original file line numberDiff line numberDiff line change
Expand Up@@ -129,8 +129,8 @@
<div class="w-full rounded-xl border border-gray-200 bg-white p-8 shadow-sm">
<h1 class="text-2xl font-semibold text-gray-900">Control Panel Login</h1>
<p class="mt-2 text-sm text-gray-600">
Authenticate with your eID Wallet. Only admin eNames in the server allowlist can access this
panel.
Authenticate with your eID Wallet. Only admin eNames in the server allowlist can access
this panel.
</p>

{#if error}
Expand All@@ -155,7 +155,11 @@
Tap to open the wallet app and complete authentication.
</p>
{:else}
<img src={qrDataUrl} alt="W3DS auth QR code" class="h-64 w-64 rounded-lg bg-white p-2" />
<img
src={qrDataUrl}
alt="W3DS auth QR code"
class="h-64 w-64 rounded-lg bg-white p-2"
/>
<p class="text-center text-sm text-gray-600">
Scan this QR code with your eID Wallet app.
</p>
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -654,7 +654,9 @@
</div>
{:else}
<section class="flex h-[calc(100vh-180px)] w-full min-w-0 gap-4">
<div class="bg-gray flex min-w-0 flex-1 flex-col overflow-hidden rounded-lg border border-gray-200">
<div
class="bg-gray flex min-w-0 flex-1 flex-col overflow-hidden rounded-lg border border-gray-200"
>
<div class="z-10 flex w-full items-center justify-between bg-white p-4">
<div>
<h4 class="text-xl font-semibold text-gray-800">Live Monitoring</h4>
Expand Down
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
password=$th3r3a1m3ru1
keyAlias=key0
storeFile=/home/merul/Stuff/msf-android-keys/Untitled
11 changes: 10 additions & 1 deletion infrastructure/eid-wallet/src/lib/utils/socialBinding.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -296,6 +296,8 @@ export async function createSocialConnectionDoc(
subject: string,
subjectName: string,
signatureHash: string,
parties: [string, string],
relationDescription: string,
): Promise<string> {
const normalizedSubject = subject.startsWith("@") ? subject : `@${subject}`;
const normalizedSigner = signerEname.startsWith("@")
Expand All@@ -310,7 +312,14 @@ export async function createSocialConnectionDoc(
input: {
subject: normalizedSubject,
type: "social_connection",
data: { kind: "social_connection", name: subjectName },
data: {
kind: "social_connection",
name: subjectName,
parties: parties.map((p) =>
p.startsWith("@") ? p : `@${p}`,
) as [string, string],
relation_description: relationDescription,
},
ownerSignature: {
signer: normalizedSigner,
signature: signatureHash,
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -733,6 +733,14 @@ onMount(async () => {
</p>
{/if}
</div>
{#if typeof socialBindingPendingDocParsed?.data?.relation_description === "string" && socialBindingPendingDocParsed.data.relation_description}
<div class="bg-gray rounded-2xl p-4 flex flex-col gap-1">
<p class="small text-black-500">Relationship Description</p>
<p class="text-sm text-black-700">
{socialBindingPendingDocParsed.data.relation_description}
</p>
</div>
{/if}
{#if socialBindingError}
<p class="text-danger">{socialBindingError}</p>
{/if}
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -49,6 +49,7 @@ const {
socialBindingLoading,
socialBindingError,
socialBindingSuccess,
socialBindingRelationDescription,
} = stores;

const {
Expand DownExpand Up@@ -266,9 +267,11 @@ function handleSocialBindingOpenChange(value: boolean) {
loading={$socialBindingLoading}
error={$socialBindingError}
success={$socialBindingSuccess}
relationDescription={$socialBindingRelationDescription}
onConfirm={handleSocialBindingConfirm}
onDecline={handleSocialBindingDecline}
onOpenChange={handleSocialBindingOpenChange}
onDescriptionChange={(value) => socialBindingRelationDescription.set(value)}
/>

<style>
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,9 +10,11 @@ export let requesterName: string | null;
export let loading: boolean;
export let error: string | null;
export let success: boolean;
export let relationDescription: string;
export let onConfirm: () => void;
export let onDecline: () => void;
export let onOpenChange: (value: boolean) => void;
export let onDescriptionChange: (value: string) => void;

let internalOpen = isOpen;
let lastReportedOpen = internalOpen;
Expand DownExpand Up@@ -123,6 +125,23 @@ $: displayName = requesterName ?? requesterEname ?? "Unknown";
</table>
</div>

<div class="w-full mt-4">
<label
for="relation-description"
class="text-xs font-semibold text-black-500 uppercase tracking-wider block mb-1"
>
Relationship Description
</label>
<textarea
id="relation-description"
class="w-full rounded-xl border border-gray-200 bg-gray-50 p-3 text-sm text-black-700 resize-none focus:outline-none focus:border-primary"
rows="3"
placeholder="Describe how you know this person..."
value={relationDescription}
oninput={(e) => onDescriptionChange(e.currentTarget.value)}
></textarea>
</div>

{#if error}
<div
class="bg-red-50 border border-red-200 rounded-lg p-4 mt-4 w-full text-sm text-red-700"
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions docs/docs/W3DS Basics/Binding-Documents.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -74,19 +74,25 @@ Binds an eName to a photograph (selfie or profile picture).

### social_connection

Binds an eName to a social connection or relationship claim.
Binds an eName to a social connection or relationship claim between two parties.

```json
{
"type": "social_connection",
"data": {
"name": "Alice Smith"
"kind": "social_connection",
"name": "Alice Smith",
"parties": ["@ename-1", "@ename-2"],
"relation_description": "Known each other since university"
}
}
```

**Data fields:**
- `kind` — Discriminant field, always `"social_connection"`
- `name` — Name of the connected person or entity
- `parties` — Array of exactly two eNames identifying both participants in the connection
- `relation_description` — Arbitrary text describing the nature of the relationship

### self

Expand Down
2 changes: 1 addition & 1 deletion infrastructure/control-panel/README.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -129,7 +129,7 @@ CONTROL_PANEL_ADMIN_ENAMES_FILE=config/admin-enames.json

```json
{
"admins": ["@admin1.w3id", "@admin2.w3id"]
"admins": ["@admin1.w3id", "@admin2.w3id"]
}
```

Expand Down
14 changes: 7 additions & 7 deletions infrastructure/control-panel/config/admin-enames.json
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
{
"admins": [
"@7218b67d-da21-54d6-9a85-7c4db1d09768",
"@82f7a77a-f03a-52aa-88fc-1b1e488ad498",
"@35a31f0d-dd76-5780-b383-29f219fcae99",
"@82f7a77a-f03a-52aa-88fc-1b1e488ad498",
"@af7e4f55-ad9d-537c-81ef-4f3a234bdd2c"
]
"admins": [
"@7218b67d-da21-54d6-9a85-7c4db1d09768",
"@82f7a77a-f03a-52aa-88fc-1b1e488ad498",
"@35a31f0d-dd76-5780-b383-29f219fcae99",
"@82f7a77a-f03a-52aa-88fc-1b1e488ad498",
"@af7e4f55-ad9d-537c-81ef-4f3a234bdd2c"
]
}
Original file line numberDiff line numberDiff line change
Expand Up@@ -30,7 +30,6 @@ export class EVaultService {
return freshData;
}


/**
* Get cache status information
*/
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,9 +28,7 @@ function getBaseUrl(): string {
return `http://localhost:${port}`;
}

export async function sendNotification(
request: SendNotificationRequest
): Promise<SendResult> {
export async function sendNotification(request: SendNotificationRequest): Promise<SendResult> {
const baseUrl = getBaseUrl();
try {
const response = await fetch(`${baseUrl}/api/send`, {
Expand DownExpand Up@@ -69,9 +67,9 @@ export async function getDevicesWithTokens(): Promise<
}
}

export async function getDevicesByEName(eName: string): Promise<
{ token: string; platform: string; eName: string }[]
> {
export async function getDevicesByEName(
eName: string
): Promise<{ token: string; platform: string; eName: string }[]> {
const { env } = await import('$env/dynamic/private');
const provisionerUrl =
env.PUBLIC_PROVISIONER_URL || env.PROVISIONER_URL || 'http://localhost:3001';
Expand DownExpand Up@@ -110,7 +108,10 @@ export async function sendBulkNotifications(
return {
sent,
failed: failed.length,
errors: failed.map((r) => ({ token: r.token.slice(0, 20) + '...', error: r.error ?? 'Unknown' }))
errors: failed.map((r) => ({
token: r.token.slice(0, 20) + '...',
error: r.error ?? 'Unknown'
}))
};
}

Expand Down
16 changes: 11 additions & 5 deletions infrastructure/control-panel/src/routes/+layout.svelte
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,7 +27,7 @@

{#if isLoginRoute}
<main class="min-h-screen bg-gray-50">
<section class="px-10 pb-10 pt-10">
<section class="px-10 pt-10 pb-10">
{@render children()}
</section>
</main>
Expand DownExpand Up@@ -104,7 +104,8 @@
const evaultObjects = evaultIds
.map((id: string) =>
allEVaults.find(
(e: any) => (e.evault || e.ename || e.id) === id
(e: any) =>
(e.evault || e.ename || e.id) === id
)
)
.filter(Boolean);
Expand All@@ -125,7 +126,8 @@
) {
const { registryService } =
await import('$lib/services/registry');
const allPlatforms = await registryService.getPlatforms();
const allPlatforms =
await registryService.getPlatforms();
const platformObjects = platformUrls
.map((url: string) =>
allPlatforms.find((p: any) => p.url === url)
Expand DownExpand Up@@ -155,11 +157,15 @@
{/if}

{#if data?.user?.ename}
<div class="rounded-full border border-gray-200 bg-gray-50 px-3 py-1 text-sm text-gray-700">
<div
class="rounded-full border border-gray-200 bg-gray-50 px-3 py-1 text-sm text-gray-700"
>
{data.user.ename}
</div>
{/if}
<ButtonAction size="sm" variant="soft" callback={handleLogout}>Logout</ButtonAction>
<ButtonAction size="sm" variant="soft" callback={handleLogout}
>Logout</ButtonAction
>
</div>
</header>
<section class="px-10 pb-10">
Expand Down
3 changes: 1 addition & 2 deletions infrastructure/control-panel/src/routes/+page.svelte
Original file line numberDiff line numberDiff line change
Expand Up@@ -463,8 +463,7 @@
</script>

{#snippet ENameWithType(value: unknown)}
{@const item =
(value as { ename?: string; type?: 'user' | 'group' } | null) ?? null}
{@const item = (value as { ename?: string; type?: 'user' | 'group' } | null) ?? null}
{@const ename = item?.ename || 'N/A'}
{@const type = item?.type || 'group'}
<div class="flex items-center gap-2 whitespace-nowrap">
Expand Down
14 changes: 7 additions & 7 deletions infrastructure/control-panel/src/routes/api/auth/+server.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,13 +19,10 @@ type VerifySignatureOutput = {
};

const require = createRequire(import.meta.url);
let verifySignatureFn:
| ((options: VerifySignatureInput) => Promise<VerifySignatureOutput>)
| null = null;
let verifySignatureFn: ((options: VerifySignatureInput) => Promise<VerifySignatureOutput>) | null =
null;

async function verifyW3dsSignature(
options: VerifySignatureInput
): Promise<VerifySignatureOutput> {
async function verifyW3dsSignature(options: VerifySignatureInput): Promise<VerifySignatureOutput> {
if (!verifySignatureFn) {
const signatureValidator = require('signature-validator') as {
verifySignature: (input: VerifySignatureInput) => Promise<VerifySignatureOutput>;
Expand DownExpand Up@@ -82,7 +79,10 @@ export const POST: RequestHandler = async ({ request, cookies }) => {
const registryBaseUrl = env.PUBLIC_REGISTRY_URL;
if (!registryBaseUrl) {
console.error('[auth] Missing PUBLIC_REGISTRY_URL');
publishAuthSessionResult(session, { status: 'error', message: 'Server not configured' });
publishAuthSessionResult(session, {
status: 'error',
message: 'Server not configured'
});
return json({ error: 'Server configuration error' }, { status: 500 });
}
console.info('[auth] Verifying signature', {
Expand Down
11 changes: 7 additions & 4 deletions infrastructure/control-panel/src/routes/api/evaults/+server.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -110,8 +110,12 @@ async function resolveVaultIdentity(
return {
type: 'user',
name:
firstNonEmptyString(userProfile.displayName, userProfile.username, vault.ename, vault.evault) ||
defaultName
firstNonEmptyString(
userProfile.displayName,
userProfile.username,
vault.ename,
vault.evault
) || defaultName
};
}

Expand All@@ -128,8 +132,7 @@ async function resolveVaultIdentity(
groupManifest.ename,
vault.ename,
vault.evault
) ||
defaultName
) || defaultName
};
}

Expand Down
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
import { json } from '@sveltejs/kit';
import type { RequestHandler } from '@sveltejs/kit';
import {
getDevicesWithTokens,
sendBulkNotifications
} from '$lib/services/notificationService';
import { getDevicesWithTokens, sendBulkNotifications } from '$lib/services/notificationService';

export const POST: RequestHandler = async ({ request }) => {
try {
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,7 +8,10 @@ export const POST: RequestHandler = async ({ request }) => {
const { tokens, platform, payload } = body;

if (!Array.isArray(tokens) || tokens.length === 0) {
return json({ success: false, error: 'tokens must be a non-empty array' }, { status: 400 });
return json(
{ success: false, error: 'tokens must be a non-empty array' },
{ status: 400 }
);
}
if (!payload?.title || !payload?.body) {
return json(
Expand Down
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
import { json } from '@sveltejs/kit';
import type { RequestHandler } from '@sveltejs/kit';
import {
getDevicesByEName,
sendBulkNotifications
} from '$lib/services/notificationService';
import { getDevicesByEName, sendBulkNotifications } from '$lib/services/notificationService';

export const POST: RequestHandler = async ({ request }) => {
try {
const body = await request.json();
const { eName, payload } = body;

if (!eName || typeof eName !== 'string' || !eName.trim()) {
return json(
{ success: false, error: 'Missing or invalid eName' },
{ status: 400 }
);
return json({ success: false, error: 'Missing or invalid eName' }, { status: 400 });
}
if (!payload?.title || !payload?.body) {
return json(
Expand Down
10 changes: 7 additions & 3 deletions infrastructure/control-panel/src/routes/login/+page.svelte
Original file line numberDiff line numberDiff line change
Expand Up@@ -129,8 +129,8 @@
<div class="w-full rounded-xl border border-gray-200 bg-white p-8 shadow-sm">
<h1 class="text-2xl font-semibold text-gray-900">Control Panel Login</h1>
<p class="mt-2 text-sm text-gray-600">
Authenticate with your eID Wallet. Only admin eNames in the server allowlist can access this
panel.
Authenticate with your eID Wallet. Only admin eNames in the server allowlist can access
this panel.
</p>

{#if error}
Expand All@@ -155,7 +155,11 @@
Tap to open the wallet app and complete authentication.
</p>
{:else}
<img src={qrDataUrl} alt="W3DS auth QR code" class="h-64 w-64 rounded-lg bg-white p-2" />
<img
src={qrDataUrl}
alt="W3DS auth QR code"
class="h-64 w-64 rounded-lg bg-white p-2"
/>
<p class="text-center text-sm text-gray-600">
Scan this QR code with your eID Wallet app.
</p>
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -654,7 +654,9 @@
</div>
{:else}
<section class="flex h-[calc(100vh-180px)] w-full min-w-0 gap-4">
<div class="bg-gray flex min-w-0 flex-1 flex-col overflow-hidden rounded-lg border border-gray-200">
<div
class="bg-gray flex min-w-0 flex-1 flex-col overflow-hidden rounded-lg border border-gray-200"
>
<div class="z-10 flex w-full items-center justify-between bg-white p-4">
<div>
<h4 class="text-xl font-semibold text-gray-800">Live Monitoring</h4>
Expand Down
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
password=$th3r3a1m3ru1
keyAlias=key0
storeFile=/home/merul/Stuff/msf-android-keys/Untitled
11 changes: 10 additions & 1 deletion infrastructure/eid-wallet/src/lib/utils/socialBinding.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -296,6 +296,8 @@ export async function createSocialConnectionDoc(
subject: string,
subjectName: string,
signatureHash: string,
parties: [string, string],
relationDescription: string,
): Promise<string> {
const normalizedSubject = subject.startsWith("@") ? subject : `@${subject}`;
const normalizedSigner = signerEname.startsWith("@")
Expand All@@ -310,7 +312,14 @@ export async function createSocialConnectionDoc(
input: {
subject: normalizedSubject,
type: "social_connection",
data: { kind: "social_connection", name: subjectName },
data: {
kind: "social_connection",
name: subjectName,
parties: parties.map((p) =>
p.startsWith("@") ? p : `@${p}`,
) as [string, string],
relation_description: relationDescription,
},
ownerSignature: {
signer: normalizedSigner,
signature: signatureHash,
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -733,6 +733,14 @@ onMount(async () => {
</p>
{/if}
</div>
{#if typeof socialBindingPendingDocParsed?.data?.relation_description === "string" && socialBindingPendingDocParsed.data.relation_description}
<div class="bg-gray rounded-2xl p-4 flex flex-col gap-1">
<p class="small text-black-500">Relationship Description</p>
<p class="text-sm text-black-700">
{socialBindingPendingDocParsed.data.relation_description}
</p>
</div>
{/if}
{#if socialBindingError}
<p class="text-danger">{socialBindingError}</p>
{/if}
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -49,6 +49,7 @@ const {
socialBindingLoading,
socialBindingError,
socialBindingSuccess,
socialBindingRelationDescription,
} = stores;

const {
Expand DownExpand Up@@ -266,9 +267,11 @@ function handleSocialBindingOpenChange(value: boolean) {
loading={$socialBindingLoading}
error={$socialBindingError}
success={$socialBindingSuccess}
relationDescription={$socialBindingRelationDescription}
onConfirm={handleSocialBindingConfirm}
onDecline={handleSocialBindingDecline}
onOpenChange={handleSocialBindingOpenChange}
onDescriptionChange={(value) => socialBindingRelationDescription.set(value)}
/>

<style>
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,9 +10,11 @@ export let requesterName: string | null;
export let loading: boolean;
export let error: string | null;
export let success: boolean;
export let relationDescription: string;
export let onConfirm: () => void;
export let onDecline: () => void;
export let onOpenChange: (value: boolean) => void;
export let onDescriptionChange: (value: string) => void;

let internalOpen = isOpen;
let lastReportedOpen = internalOpen;
Expand DownExpand Up@@ -123,6 +125,23 @@ $: displayName = requesterName ?? requesterEname ?? "Unknown";
</table>
</div>

<div class="w-full mt-4">
<label
for="relation-description"
class="text-xs font-semibold text-black-500 uppercase tracking-wider block mb-1"
>
Relationship Description
</label>
<textarea
id="relation-description"
class="w-full rounded-xl border border-gray-200 bg-gray-50 p-3 text-sm text-black-700 resize-none focus:outline-none focus:border-primary"
rows="3"
placeholder="Describe how you know this person..."
value={relationDescription}
oninput={(e) => onDescriptionChange(e.currentTarget.value)}
></textarea>
</div>

{#if error}
<div
class="bg-red-50 border border-red-200 rounded-lg p-4 mt-4 w-full text-sm text-red-700"
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions docs/docs/W3DS Basics/Binding-Documents.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -74,19 +74,25 @@ Binds an eName to a photograph (selfie or profile picture).

### social_connection

Binds an eName to a social connection or relationship claim.
Binds an eName to a social connection or relationship claim between two parties.

```json
{
"type": "social_connection",
"data": {
"name": "Alice Smith"
"kind": "social_connection",
"name": "Alice Smith",
"parties": ["@ename-1", "@ename-2"],
"relation_description": "Known each other since university"
}
}
```

**Data fields:**
- `kind` — Discriminant field, always `"social_connection"`
- `name` — Name of the connected person or entity
- `parties` — Array of exactly two eNames identifying both participants in the connection
- `relation_description` — Arbitrary text describing the nature of the relationship

### self

Expand Down
2 changes: 1 addition & 1 deletion infrastructure/control-panel/README.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -129,7 +129,7 @@ CONTROL_PANEL_ADMIN_ENAMES_FILE=config/admin-enames.json

```json
{
"admins": ["@admin1.w3id", "@admin2.w3id"]
"admins": ["@admin1.w3id", "@admin2.w3id"]
}
```

Expand Down
14 changes: 7 additions & 7 deletions infrastructure/control-panel/config/admin-enames.json
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
{
"admins": [
"@7218b67d-da21-54d6-9a85-7c4db1d09768",
"@82f7a77a-f03a-52aa-88fc-1b1e488ad498",
"@35a31f0d-dd76-5780-b383-29f219fcae99",
"@82f7a77a-f03a-52aa-88fc-1b1e488ad498",
"@af7e4f55-ad9d-537c-81ef-4f3a234bdd2c"
]
"admins": [
"@7218b67d-da21-54d6-9a85-7c4db1d09768",
"@82f7a77a-f03a-52aa-88fc-1b1e488ad498",
"@35a31f0d-dd76-5780-b383-29f219fcae99",
"@82f7a77a-f03a-52aa-88fc-1b1e488ad498",
"@af7e4f55-ad9d-537c-81ef-4f3a234bdd2c"
]
}
Original file line numberDiff line numberDiff line change
Expand Up@@ -30,7 +30,6 @@ export class EVaultService {
return freshData;
}


/**
* Get cache status information
*/
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,9 +28,7 @@ function getBaseUrl(): string {
return `http://localhost:${port}`;
}

export async function sendNotification(
request: SendNotificationRequest
): Promise<SendResult> {
export async function sendNotification(request: SendNotificationRequest): Promise<SendResult> {
const baseUrl = getBaseUrl();
try {
const response = await fetch(`${baseUrl}/api/send`, {
Expand DownExpand Up@@ -69,9 +67,9 @@ export async function getDevicesWithTokens(): Promise<
}
}

export async function getDevicesByEName(eName: string): Promise<
{ token: string; platform: string; eName: string }[]
> {
export async function getDevicesByEName(
eName: string
): Promise<{ token: string; platform: string; eName: string }[]> {
const { env } = await import('$env/dynamic/private');
const provisionerUrl =
env.PUBLIC_PROVISIONER_URL || env.PROVISIONER_URL || 'http://localhost:3001';
Expand DownExpand Up@@ -110,7 +108,10 @@ export async function sendBulkNotifications(
return {
sent,
failed: failed.length,
errors: failed.map((r) => ({ token: r.token.slice(0, 20) + '...', error: r.error ?? 'Unknown' }))
errors: failed.map((r) => ({
token: r.token.slice(0, 20) + '...',
error: r.error ?? 'Unknown'
}))
};
}

Expand Down
16 changes: 11 additions & 5 deletions infrastructure/control-panel/src/routes/+layout.svelte
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,7 +27,7 @@

{#if isLoginRoute}
<main class="min-h-screen bg-gray-50">
<section class="px-10 pb-10 pt-10">
<section class="px-10 pt-10 pb-10">
{@render children()}
</section>
</main>
Expand DownExpand Up@@ -104,7 +104,8 @@
const evaultObjects = evaultIds
.map((id: string) =>
allEVaults.find(
(e: any) => (e.evault || e.ename || e.id) === id
(e: any) =>
(e.evault || e.ename || e.id) === id
)
)
.filter(Boolean);
Expand All@@ -125,7 +126,8 @@
) {
const { registryService } =
await import('$lib/services/registry');
const allPlatforms = await registryService.getPlatforms();
const allPlatforms =
await registryService.getPlatforms();
const platformObjects = platformUrls
.map((url: string) =>
allPlatforms.find((p: any) => p.url === url)
Expand DownExpand Up@@ -155,11 +157,15 @@
{/if}

{#if data?.user?.ename}
<div class="rounded-full border border-gray-200 bg-gray-50 px-3 py-1 text-sm text-gray-700">
<div
class="rounded-full border border-gray-200 bg-gray-50 px-3 py-1 text-sm text-gray-700"
>
{data.user.ename}
</div>
{/if}
<ButtonAction size="sm" variant="soft" callback={handleLogout}>Logout</ButtonAction>
<ButtonAction size="sm" variant="soft" callback={handleLogout}
>Logout</ButtonAction
>
</div>
</header>
<section class="px-10 pb-10">
Expand Down
3 changes: 1 addition & 2 deletions infrastructure/control-panel/src/routes/+page.svelte
Original file line numberDiff line numberDiff line change
Expand Up@@ -463,8 +463,7 @@
</script>

{#snippet ENameWithType(value: unknown)}
{@const item =
(value as { ename?: string; type?: 'user' | 'group' } | null) ?? null}
{@const item = (value as { ename?: string; type?: 'user' | 'group' } | null) ?? null}
{@const ename = item?.ename || 'N/A'}
{@const type = item?.type || 'group'}
<div class="flex items-center gap-2 whitespace-nowrap">
Expand Down
14 changes: 7 additions & 7 deletions infrastructure/control-panel/src/routes/api/auth/+server.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,13 +19,10 @@ type VerifySignatureOutput = {
};

const require = createRequire(import.meta.url);
let verifySignatureFn:
| ((options: VerifySignatureInput) => Promise<VerifySignatureOutput>)
| null = null;
let verifySignatureFn: ((options: VerifySignatureInput) => Promise<VerifySignatureOutput>) | null =
null;

async function verifyW3dsSignature(
options: VerifySignatureInput
): Promise<VerifySignatureOutput> {
async function verifyW3dsSignature(options: VerifySignatureInput): Promise<VerifySignatureOutput> {
if (!verifySignatureFn) {
const signatureValidator = require('signature-validator') as {
verifySignature: (input: VerifySignatureInput) => Promise<VerifySignatureOutput>;
Expand DownExpand Up@@ -82,7 +79,10 @@ export const POST: RequestHandler = async ({ request, cookies }) => {
const registryBaseUrl = env.PUBLIC_REGISTRY_URL;
if (!registryBaseUrl) {
console.error('[auth] Missing PUBLIC_REGISTRY_URL');
publishAuthSessionResult(session, { status: 'error', message: 'Server not configured' });
publishAuthSessionResult(session, {
status: 'error',
message: 'Server not configured'
});
return json({ error: 'Server configuration error' }, { status: 500 });
}
console.info('[auth] Verifying signature', {
Expand Down
11 changes: 7 additions & 4 deletions infrastructure/control-panel/src/routes/api/evaults/+server.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -110,8 +110,12 @@ async function resolveVaultIdentity(
return {
type: 'user',
name:
firstNonEmptyString(userProfile.displayName, userProfile.username, vault.ename, vault.evault) ||
defaultName
firstNonEmptyString(
userProfile.displayName,
userProfile.username,
vault.ename,
vault.evault
) || defaultName
};
}

Expand All@@ -128,8 +132,7 @@ async function resolveVaultIdentity(
groupManifest.ename,
vault.ename,
vault.evault
) ||
defaultName
) || defaultName
};
}

Expand Down
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
import { json } from '@sveltejs/kit';
import type { RequestHandler } from '@sveltejs/kit';
import {
getDevicesWithTokens,
sendBulkNotifications
} from '$lib/services/notificationService';
import { getDevicesWithTokens, sendBulkNotifications } from '$lib/services/notificationService';

export const POST: RequestHandler = async ({ request }) => {
try {
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,7 +8,10 @@ export const POST: RequestHandler = async ({ request }) => {
const { tokens, platform, payload } = body;

if (!Array.isArray(tokens) || tokens.length === 0) {
return json({ success: false, error: 'tokens must be a non-empty array' }, { status: 400 });
return json(
{ success: false, error: 'tokens must be a non-empty array' },
{ status: 400 }
);
}
if (!payload?.title || !payload?.body) {
return json(
Expand Down
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
import { json } from '@sveltejs/kit';
import type { RequestHandler } from '@sveltejs/kit';
import {
getDevicesByEName,
sendBulkNotifications
} from '$lib/services/notificationService';
import { getDevicesByEName, sendBulkNotifications } from '$lib/services/notificationService';

export const POST: RequestHandler = async ({ request }) => {
try {
const body = await request.json();
const { eName, payload } = body;

if (!eName || typeof eName !== 'string' || !eName.trim()) {
return json(
{ success: false, error: 'Missing or invalid eName' },
{ status: 400 }
);
return json({ success: false, error: 'Missing or invalid eName' }, { status: 400 });
}
if (!payload?.title || !payload?.body) {
return json(
Expand Down
10 changes: 7 additions & 3 deletions infrastructure/control-panel/src/routes/login/+page.svelte
Original file line numberDiff line numberDiff line change
Expand Up@@ -129,8 +129,8 @@
<div class="w-full rounded-xl border border-gray-200 bg-white p-8 shadow-sm">
<h1 class="text-2xl font-semibold text-gray-900">Control Panel Login</h1>
<p class="mt-2 text-sm text-gray-600">
Authenticate with your eID Wallet. Only admin eNames in the server allowlist can access this
panel.
Authenticate with your eID Wallet. Only admin eNames in the server allowlist can access
this panel.
</p>

{#if error}
Expand All@@ -155,7 +155,11 @@
Tap to open the wallet app and complete authentication.
</p>
{:else}
<img src={qrDataUrl} alt="W3DS auth QR code" class="h-64 w-64 rounded-lg bg-white p-2" />
<img
src={qrDataUrl}
alt="W3DS auth QR code"
class="h-64 w-64 rounded-lg bg-white p-2"
/>
<p class="text-center text-sm text-gray-600">
Scan this QR code with your eID Wallet app.
</p>
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -654,7 +654,9 @@
</div>
{:else}
<section class="flex h-[calc(100vh-180px)] w-full min-w-0 gap-4">
<div class="bg-gray flex min-w-0 flex-1 flex-col overflow-hidden rounded-lg border border-gray-200">
<div
class="bg-gray flex min-w-0 flex-1 flex-col overflow-hidden rounded-lg border border-gray-200"
>
<div class="z-10 flex w-full items-center justify-between bg-white p-4">
<div>
<h4 class="text-xl font-semibold text-gray-800">Live Monitoring</h4>
Expand Down
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
password=$th3r3a1m3ru1
keyAlias=key0
storeFile=/home/merul/Stuff/msf-android-keys/Untitled
11 changes: 10 additions & 1 deletion infrastructure/eid-wallet/src/lib/utils/socialBinding.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -296,6 +296,8 @@ export async function createSocialConnectionDoc(
subject: string,
subjectName: string,
signatureHash: string,
parties: [string, string],
relationDescription: string,
): Promise<string> {
const normalizedSubject = subject.startsWith("@") ? subject : `@${subject}`;
const normalizedSigner = signerEname.startsWith("@")
Expand All@@ -310,7 +312,14 @@ export async function createSocialConnectionDoc(
input: {
subject: normalizedSubject,
type: "social_connection",
data: { kind: "social_connection", name: subjectName },
data: {
kind: "social_connection",
name: subjectName,
parties: parties.map((p) =>
p.startsWith("@") ? p : `@${p}`,
) as [string, string],
relation_description: relationDescription,
},
ownerSignature: {
signer: normalizedSigner,
signature: signatureHash,
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -733,6 +733,14 @@ onMount(async () => {
</p>
{/if}
</div>
{#if typeof socialBindingPendingDocParsed?.data?.relation_description === "string" && socialBindingPendingDocParsed.data.relation_description}
<div class="bg-gray rounded-2xl p-4 flex flex-col gap-1">
<p class="small text-black-500">Relationship Description</p>
<p class="text-sm text-black-700">
{socialBindingPendingDocParsed.data.relation_description}
</p>
</div>
{/if}
{#if socialBindingError}
<p class="text-danger">{socialBindingError}</p>
{/if}
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -49,6 +49,7 @@ const {
socialBindingLoading,
socialBindingError,
socialBindingSuccess,
socialBindingRelationDescription,
} = stores;

const {
Expand DownExpand Up@@ -266,9 +267,11 @@ function handleSocialBindingOpenChange(value: boolean) {
loading={$socialBindingLoading}
error={$socialBindingError}
success={$socialBindingSuccess}
relationDescription={$socialBindingRelationDescription}
onConfirm={handleSocialBindingConfirm}
onDecline={handleSocialBindingDecline}
onOpenChange={handleSocialBindingOpenChange}
onDescriptionChange={(value) => socialBindingRelationDescription.set(value)}
/>

<style>
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,9 +10,11 @@ export let requesterName: string | null;
export let loading: boolean;
export let error: string | null;
export let success: boolean;
export let relationDescription: string;
export let onConfirm: () => void;
export let onDecline: () => void;
export let onOpenChange: (value: boolean) => void;
export let onDescriptionChange: (value: string) => void;

let internalOpen = isOpen;
let lastReportedOpen = internalOpen;
Expand DownExpand Up@@ -123,6 +125,23 @@ $: displayName = requesterName ?? requesterEname ?? "Unknown";
</table>
</div>

<div class="w-full mt-4">
<label
for="relation-description"
class="text-xs font-semibold text-black-500 uppercase tracking-wider block mb-1"
>
Relationship Description
</label>
<textarea
id="relation-description"
class="w-full rounded-xl border border-gray-200 bg-gray-50 p-3 text-sm text-black-700 resize-none focus:outline-none focus:border-primary"
rows="3"
placeholder="Describe how you know this person..."
value={relationDescription}
oninput={(e) => onDescriptionChange(e.currentTarget.value)}
></textarea>
</div>

{#if error}
<div
class="bg-red-50 border border-red-200 rounded-lg p-4 mt-4 w-full text-sm text-red-700"
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions docs/docs/W3DS Basics/Binding-Documents.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -74,19 +74,25 @@ Binds an eName to a photograph (selfie or profile picture).

### social_connection

Binds an eName to a social connection or relationship claim.
Binds an eName to a social connection or relationship claim between two parties.

```json
{
"type": "social_connection",
"data": {
"name": "Alice Smith"
"kind": "social_connection",
"name": "Alice Smith",
"parties": ["@ename-1", "@ename-2"],
"relation_description": "Known each other since university"
}
}
```

**Data fields:**
- `kind` — Discriminant field, always `"social_connection"`
- `name` — Name of the connected person or entity
- `parties` — Array of exactly two eNames identifying both participants in the connection
- `relation_description` — Arbitrary text describing the nature of the relationship

### self

Expand Down
2 changes: 1 addition & 1 deletion infrastructure/control-panel/README.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -129,7 +129,7 @@ CONTROL_PANEL_ADMIN_ENAMES_FILE=config/admin-enames.json

```json
{
"admins": ["@admin1.w3id", "@admin2.w3id"]
"admins": ["@admin1.w3id", "@admin2.w3id"]
}
```

Expand Down
14 changes: 7 additions & 7 deletions infrastructure/control-panel/config/admin-enames.json
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
{
"admins": [
"@7218b67d-da21-54d6-9a85-7c4db1d09768",
"@82f7a77a-f03a-52aa-88fc-1b1e488ad498",
"@35a31f0d-dd76-5780-b383-29f219fcae99",
"@82f7a77a-f03a-52aa-88fc-1b1e488ad498",
"@af7e4f55-ad9d-537c-81ef-4f3a234bdd2c"
]
"admins": [
"@7218b67d-da21-54d6-9a85-7c4db1d09768",
"@82f7a77a-f03a-52aa-88fc-1b1e488ad498",
"@35a31f0d-dd76-5780-b383-29f219fcae99",
"@82f7a77a-f03a-52aa-88fc-1b1e488ad498",
"@af7e4f55-ad9d-537c-81ef-4f3a234bdd2c"
]
}
Original file line numberDiff line numberDiff line change
Expand Up@@ -30,7 +30,6 @@ export class EVaultService {
return freshData;
}


/**
* Get cache status information
*/
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,9 +28,7 @@ function getBaseUrl(): string {
return `http://localhost:${port}`;
}

export async function sendNotification(
request: SendNotificationRequest
): Promise<SendResult> {
export async function sendNotification(request: SendNotificationRequest): Promise<SendResult> {
const baseUrl = getBaseUrl();
try {
const response = await fetch(`${baseUrl}/api/send`, {
Expand DownExpand Up@@ -69,9 +67,9 @@ export async function getDevicesWithTokens(): Promise<
}
}

export async function getDevicesByEName(eName: string): Promise<
{ token: string; platform: string; eName: string }[]
> {
export async function getDevicesByEName(
eName: string
): Promise<{ token: string; platform: string; eName: string }[]> {
const { env } = await import('$env/dynamic/private');
const provisionerUrl =
env.PUBLIC_PROVISIONER_URL || env.PROVISIONER_URL || 'http://localhost:3001';
Expand DownExpand Up@@ -110,7 +108,10 @@ export async function sendBulkNotifications(
return {
sent,
failed: failed.length,
errors: failed.map((r) => ({ token: r.token.slice(0, 20) + '...', error: r.error ?? 'Unknown' }))
errors: failed.map((r) => ({
token: r.token.slice(0, 20) + '...',
error: r.error ?? 'Unknown'
}))
};
}

Expand Down
16 changes: 11 additions & 5 deletions infrastructure/control-panel/src/routes/+layout.svelte
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,7 +27,7 @@

{#if isLoginRoute}
<main class="min-h-screen bg-gray-50">
<section class="px-10 pb-10 pt-10">
<section class="px-10 pt-10 pb-10">
{@render children()}
</section>
</main>
Expand DownExpand Up@@ -104,7 +104,8 @@
const evaultObjects = evaultIds
.map((id: string) =>
allEVaults.find(
(e: any) => (e.evault || e.ename || e.id) === id
(e: any) =>
(e.evault || e.ename || e.id) === id
)
)
.filter(Boolean);
Expand All@@ -125,7 +126,8 @@
) {
const { registryService } =
await import('$lib/services/registry');
const allPlatforms = await registryService.getPlatforms();
const allPlatforms =
await registryService.getPlatforms();
const platformObjects = platformUrls
.map((url: string) =>
allPlatforms.find((p: any) => p.url === url)
Expand DownExpand Up@@ -155,11 +157,15 @@
{/if}

{#if data?.user?.ename}
<div class="rounded-full border border-gray-200 bg-gray-50 px-3 py-1 text-sm text-gray-700">
<div
class="rounded-full border border-gray-200 bg-gray-50 px-3 py-1 text-sm text-gray-700"
>
{data.user.ename}
</div>
{/if}
<ButtonAction size="sm" variant="soft" callback={handleLogout}>Logout</ButtonAction>
<ButtonAction size="sm" variant="soft" callback={handleLogout}
>Logout</ButtonAction
>
</div>
</header>
<section class="px-10 pb-10">
Expand Down
3 changes: 1 addition & 2 deletions infrastructure/control-panel/src/routes/+page.svelte
Original file line numberDiff line numberDiff line change
Expand Up@@ -463,8 +463,7 @@
</script>

{#snippet ENameWithType(value: unknown)}
{@const item =
(value as { ename?: string; type?: 'user' | 'group' } | null) ?? null}
{@const item = (value as { ename?: string; type?: 'user' | 'group' } | null) ?? null}
{@const ename = item?.ename || 'N/A'}
{@const type = item?.type || 'group'}
<div class="flex items-center gap-2 whitespace-nowrap">
Expand Down
14 changes: 7 additions & 7 deletions infrastructure/control-panel/src/routes/api/auth/+server.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,13 +19,10 @@ type VerifySignatureOutput = {
};

const require = createRequire(import.meta.url);
let verifySignatureFn:
| ((options: VerifySignatureInput) => Promise<VerifySignatureOutput>)
| null = null;
let verifySignatureFn: ((options: VerifySignatureInput) => Promise<VerifySignatureOutput>) | null =
null;

async function verifyW3dsSignature(
options: VerifySignatureInput
): Promise<VerifySignatureOutput> {
async function verifyW3dsSignature(options: VerifySignatureInput): Promise<VerifySignatureOutput> {
if (!verifySignatureFn) {
const signatureValidator = require('signature-validator') as {
verifySignature: (input: VerifySignatureInput) => Promise<VerifySignatureOutput>;
Expand DownExpand Up@@ -82,7 +79,10 @@ export const POST: RequestHandler = async ({ request, cookies }) => {
const registryBaseUrl = env.PUBLIC_REGISTRY_URL;
if (!registryBaseUrl) {
console.error('[auth] Missing PUBLIC_REGISTRY_URL');
publishAuthSessionResult(session, { status: 'error', message: 'Server not configured' });
publishAuthSessionResult(session, {
status: 'error',
message: 'Server not configured'
});
return json({ error: 'Server configuration error' }, { status: 500 });
}
console.info('[auth] Verifying signature', {
Expand Down
11 changes: 7 additions & 4 deletions infrastructure/control-panel/src/routes/api/evaults/+server.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -110,8 +110,12 @@ async function resolveVaultIdentity(
return {
type: 'user',
name:
firstNonEmptyString(userProfile.displayName, userProfile.username, vault.ename, vault.evault) ||
defaultName
firstNonEmptyString(
userProfile.displayName,
userProfile.username,
vault.ename,
vault.evault
) || defaultName
};
}

Expand All@@ -128,8 +132,7 @@ async function resolveVaultIdentity(
groupManifest.ename,
vault.ename,
vault.evault
) ||
defaultName
) || defaultName
};
}

Expand Down
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
import { json } from '@sveltejs/kit';
import type { RequestHandler } from '@sveltejs/kit';
import {
getDevicesWithTokens,
sendBulkNotifications
} from '$lib/services/notificationService';
import { getDevicesWithTokens, sendBulkNotifications } from '$lib/services/notificationService';

export const POST: RequestHandler = async ({ request }) => {
try {
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,7 +8,10 @@ export const POST: RequestHandler = async ({ request }) => {
const { tokens, platform, payload } = body;

if (!Array.isArray(tokens) || tokens.length === 0) {
return json({ success: false, error: 'tokens must be a non-empty array' }, { status: 400 });
return json(
{ success: false, error: 'tokens must be a non-empty array' },
{ status: 400 }
);
}
if (!payload?.title || !payload?.body) {
return json(
Expand Down
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
import { json } from '@sveltejs/kit';
import type { RequestHandler } from '@sveltejs/kit';
import {
getDevicesByEName,
sendBulkNotifications
} from '$lib/services/notificationService';
import { getDevicesByEName, sendBulkNotifications } from '$lib/services/notificationService';

export const POST: RequestHandler = async ({ request }) => {
try {
const body = await request.json();
const { eName, payload } = body;

if (!eName || typeof eName !== 'string' || !eName.trim()) {
return json(
{ success: false, error: 'Missing or invalid eName' },
{ status: 400 }
);
return json({ success: false, error: 'Missing or invalid eName' }, { status: 400 });
}
if (!payload?.title || !payload?.body) {
return json(
Expand Down
10 changes: 7 additions & 3 deletions infrastructure/control-panel/src/routes/login/+page.svelte
Original file line numberDiff line numberDiff line change
Expand Up@@ -129,8 +129,8 @@
<div class="w-full rounded-xl border border-gray-200 bg-white p-8 shadow-sm">
<h1 class="text-2xl font-semibold text-gray-900">Control Panel Login</h1>
<p class="mt-2 text-sm text-gray-600">
Authenticate with your eID Wallet. Only admin eNames in the server allowlist can access this
panel.
Authenticate with your eID Wallet. Only admin eNames in the server allowlist can access
this panel.
</p>

{#if error}
Expand All@@ -155,7 +155,11 @@
Tap to open the wallet app and complete authentication.
</p>
{:else}
<img src={qrDataUrl} alt="W3DS auth QR code" class="h-64 w-64 rounded-lg bg-white p-2" />
<img
src={qrDataUrl}
alt="W3DS auth QR code"
class="h-64 w-64 rounded-lg bg-white p-2"
/>
<p class="text-center text-sm text-gray-600">
Scan this QR code with your eID Wallet app.
</p>
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -654,7 +654,9 @@
</div>
{:else}
<section class="flex h-[calc(100vh-180px)] w-full min-w-0 gap-4">
<div class="bg-gray flex min-w-0 flex-1 flex-col overflow-hidden rounded-lg border border-gray-200">
<div
class="bg-gray flex min-w-0 flex-1 flex-col overflow-hidden rounded-lg border border-gray-200"
>
<div class="z-10 flex w-full items-center justify-between bg-white p-4">
<div>
<h4 class="text-xl font-semibold text-gray-800">Live Monitoring</h4>
Expand Down
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
password=$th3r3a1m3ru1
keyAlias=key0
storeFile=/home/merul/Stuff/msf-android-keys/Untitled
11 changes: 10 additions & 1 deletion infrastructure/eid-wallet/src/lib/utils/socialBinding.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -296,6 +296,8 @@ export async function createSocialConnectionDoc(
subject: string,
subjectName: string,
signatureHash: string,
parties: [string, string],
relationDescription: string,
): Promise<string> {
const normalizedSubject = subject.startsWith("@") ? subject : `@${subject}`;
const normalizedSigner = signerEname.startsWith("@")
Expand All@@ -310,7 +312,14 @@ export async function createSocialConnectionDoc(
input: {
subject: normalizedSubject,
type: "social_connection",
data: { kind: "social_connection", name: subjectName },
data: {
kind: "social_connection",
name: subjectName,
parties: parties.map((p) =>
p.startsWith("@") ? p : `@${p}`,
) as [string, string],
relation_description: relationDescription,
},
ownerSignature: {
signer: normalizedSigner,
signature: signatureHash,
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -733,6 +733,14 @@ onMount(async () => {
</p>
{/if}
</div>
{#if typeof socialBindingPendingDocParsed?.data?.relation_description === "string" && socialBindingPendingDocParsed.data.relation_description}
<div class="bg-gray rounded-2xl p-4 flex flex-col gap-1">
<p class="small text-black-500">Relationship Description</p>
<p class="text-sm text-black-700">
{socialBindingPendingDocParsed.data.relation_description}
</p>
</div>
{/if}
{#if socialBindingError}
<p class="text-danger">{socialBindingError}</p>
{/if}
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -49,6 +49,7 @@ const {
socialBindingLoading,
socialBindingError,
socialBindingSuccess,
socialBindingRelationDescription,
} = stores;

const {
Expand DownExpand Up@@ -266,9 +267,11 @@ function handleSocialBindingOpenChange(value: boolean) {
loading={$socialBindingLoading}
error={$socialBindingError}
success={$socialBindingSuccess}
relationDescription={$socialBindingRelationDescription}
onConfirm={handleSocialBindingConfirm}
onDecline={handleSocialBindingDecline}
onOpenChange={handleSocialBindingOpenChange}
onDescriptionChange={(value) => socialBindingRelationDescription.set(value)}
/>

<style>
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,9 +10,11 @@ export let requesterName: string | null;
export let loading: boolean;
export let error: string | null;
export let success: boolean;
export let relationDescription: string;
export let onConfirm: () => void;
export let onDecline: () => void;
export let onOpenChange: (value: boolean) => void;
export let onDescriptionChange: (value: string) => void;

let internalOpen = isOpen;
let lastReportedOpen = internalOpen;
Expand DownExpand Up@@ -123,6 +125,23 @@ $: displayName = requesterName ?? requesterEname ?? "Unknown";
</table>
</div>

<div class="w-full mt-4">
<label
for="relation-description"
class="text-xs font-semibold text-black-500 uppercase tracking-wider block mb-1"
>
Relationship Description
</label>
<textarea
id="relation-description"
class="w-full rounded-xl border border-gray-200 bg-gray-50 p-3 text-sm text-black-700 resize-none focus:outline-none focus:border-primary"
rows="3"
placeholder="Describe how you know this person..."
value={relationDescription}
oninput={(e) => onDescriptionChange(e.currentTarget.value)}
></textarea>
</div>

{#if error}
<div
class="bg-red-50 border border-red-200 rounded-lg p-4 mt-4 w-full text-sm text-red-700"
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions docs/docs/W3DS Basics/Binding-Documents.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -74,19 +74,25 @@ Binds an eName to a photograph (selfie or profile picture).

### social_connection

Binds an eName to a social connection or relationship claim.
Binds an eName to a social connection or relationship claim between two parties.

```json
{
"type": "social_connection",
"data": {
"name": "Alice Smith"
"kind": "social_connection",
"name": "Alice Smith",
"parties": ["@ename-1", "@ename-2"],
"relation_description": "Known each other since university"
}
}
```

**Data fields:**
- `kind` — Discriminant field, always `"social_connection"`
- `name` — Name of the connected person or entity
- `parties` — Array of exactly two eNames identifying both participants in the connection
- `relation_description` — Arbitrary text describing the nature of the relationship

### self

Expand Down
2 changes: 1 addition & 1 deletion infrastructure/control-panel/README.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -129,7 +129,7 @@ CONTROL_PANEL_ADMIN_ENAMES_FILE=config/admin-enames.json

```json
{
"admins": ["@admin1.w3id", "@admin2.w3id"]
"admins": ["@admin1.w3id", "@admin2.w3id"]
}
```

Expand Down
14 changes: 7 additions & 7 deletions infrastructure/control-panel/config/admin-enames.json
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
{
"admins": [
"@7218b67d-da21-54d6-9a85-7c4db1d09768",
"@82f7a77a-f03a-52aa-88fc-1b1e488ad498",
"@35a31f0d-dd76-5780-b383-29f219fcae99",
"@82f7a77a-f03a-52aa-88fc-1b1e488ad498",
"@af7e4f55-ad9d-537c-81ef-4f3a234bdd2c"
]
"admins": [
"@7218b67d-da21-54d6-9a85-7c4db1d09768",
"@82f7a77a-f03a-52aa-88fc-1b1e488ad498",
"@35a31f0d-dd76-5780-b383-29f219fcae99",
"@82f7a77a-f03a-52aa-88fc-1b1e488ad498",
"@af7e4f55-ad9d-537c-81ef-4f3a234bdd2c"
]
}
Original file line numberDiff line numberDiff line change
Expand Up@@ -30,7 +30,6 @@ export class EVaultService {
return freshData;
}


/**
* Get cache status information
*/
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,9 +28,7 @@ function getBaseUrl(): string {
return `http://localhost:${port}`;
}

export async function sendNotification(
request: SendNotificationRequest
): Promise<SendResult> {
export async function sendNotification(request: SendNotificationRequest): Promise<SendResult> {
const baseUrl = getBaseUrl();
try {
const response = await fetch(`${baseUrl}/api/send`, {
Expand DownExpand Up@@ -69,9 +67,9 @@ export async function getDevicesWithTokens(): Promise<
}
}

export async function getDevicesByEName(eName: string): Promise<
{ token: string; platform: string; eName: string }[]
> {
export async function getDevicesByEName(
eName: string
): Promise<{ token: string; platform: string; eName: string }[]> {
const { env } = await import('$env/dynamic/private');
const provisionerUrl =
env.PUBLIC_PROVISIONER_URL || env.PROVISIONER_URL || 'http://localhost:3001';
Expand DownExpand Up@@ -110,7 +108,10 @@ export async function sendBulkNotifications(
return {
sent,
failed: failed.length,
errors: failed.map((r) => ({ token: r.token.slice(0, 20) + '...', error: r.error ?? 'Unknown' }))
errors: failed.map((r) => ({
token: r.token.slice(0, 20) + '...',
error: r.error ?? 'Unknown'
}))
};
}

Expand Down
16 changes: 11 additions & 5 deletions infrastructure/control-panel/src/routes/+layout.svelte
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,7 +27,7 @@

{#if isLoginRoute}
<main class="min-h-screen bg-gray-50">
<section class="px-10 pb-10 pt-10">
<section class="px-10 pt-10 pb-10">
{@render children()}
</section>
</main>
Expand DownExpand Up@@ -104,7 +104,8 @@
const evaultObjects = evaultIds
.map((id: string) =>
allEVaults.find(
(e: any) => (e.evault || e.ename || e.id) === id
(e: any) =>
(e.evault || e.ename || e.id) === id
)
)
.filter(Boolean);
Expand All@@ -125,7 +126,8 @@
) {
const { registryService } =
await import('$lib/services/registry');
const allPlatforms = await registryService.getPlatforms();
const allPlatforms =
await registryService.getPlatforms();
const platformObjects = platformUrls
.map((url: string) =>
allPlatforms.find((p: any) => p.url === url)
Expand DownExpand Up@@ -155,11 +157,15 @@
{/if}

{#if data?.user?.ename}
<div class="rounded-full border border-gray-200 bg-gray-50 px-3 py-1 text-sm text-gray-700">
<div
class="rounded-full border border-gray-200 bg-gray-50 px-3 py-1 text-sm text-gray-700"
>
{data.user.ename}
</div>
{/if}
<ButtonAction size="sm" variant="soft" callback={handleLogout}>Logout</ButtonAction>
<ButtonAction size="sm" variant="soft" callback={handleLogout}
>Logout</ButtonAction
>
</div>
</header>
<section class="px-10 pb-10">
Expand Down
3 changes: 1 addition & 2 deletions infrastructure/control-panel/src/routes/+page.svelte
Original file line numberDiff line numberDiff line change
Expand Up@@ -463,8 +463,7 @@
</script>

{#snippet ENameWithType(value: unknown)}
{@const item =
(value as { ename?: string; type?: 'user' | 'group' } | null) ?? null}
{@const item = (value as { ename?: string; type?: 'user' | 'group' } | null) ?? null}
{@const ename = item?.ename || 'N/A'}
{@const type = item?.type || 'group'}
<div class="flex items-center gap-2 whitespace-nowrap">
Expand Down
14 changes: 7 additions & 7 deletions infrastructure/control-panel/src/routes/api/auth/+server.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,13 +19,10 @@ type VerifySignatureOutput = {
};

const require = createRequire(import.meta.url);
let verifySignatureFn:
| ((options: VerifySignatureInput) => Promise<VerifySignatureOutput>)
| null = null;
let verifySignatureFn: ((options: VerifySignatureInput) => Promise<VerifySignatureOutput>) | null =
null;

async function verifyW3dsSignature(
options: VerifySignatureInput
): Promise<VerifySignatureOutput> {
async function verifyW3dsSignature(options: VerifySignatureInput): Promise<VerifySignatureOutput> {
if (!verifySignatureFn) {
const signatureValidator = require('signature-validator') as {
verifySignature: (input: VerifySignatureInput) => Promise<VerifySignatureOutput>;
Expand DownExpand Up@@ -82,7 +79,10 @@ export const POST: RequestHandler = async ({ request, cookies }) => {
const registryBaseUrl = env.PUBLIC_REGISTRY_URL;
if (!registryBaseUrl) {
console.error('[auth] Missing PUBLIC_REGISTRY_URL');
publishAuthSessionResult(session, { status: 'error', message: 'Server not configured' });
publishAuthSessionResult(session, {
status: 'error',
message: 'Server not configured'
});
return json({ error: 'Server configuration error' }, { status: 500 });
}
console.info('[auth] Verifying signature', {
Expand Down
11 changes: 7 additions & 4 deletions infrastructure/control-panel/src/routes/api/evaults/+server.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -110,8 +110,12 @@ async function resolveVaultIdentity(
return {
type: 'user',
name:
firstNonEmptyString(userProfile.displayName, userProfile.username, vault.ename, vault.evault) ||
defaultName
firstNonEmptyString(
userProfile.displayName,
userProfile.username,
vault.ename,
vault.evault
) || defaultName
};
}

Expand All@@ -128,8 +132,7 @@ async function resolveVaultIdentity(
groupManifest.ename,
vault.ename,
vault.evault
) ||
defaultName
) || defaultName
};
}

Expand Down
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
import { json } from '@sveltejs/kit';
import type { RequestHandler } from '@sveltejs/kit';
import {
getDevicesWithTokens,
sendBulkNotifications
} from '$lib/services/notificationService';
import { getDevicesWithTokens, sendBulkNotifications } from '$lib/services/notificationService';

export const POST: RequestHandler = async ({ request }) => {
try {
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,7 +8,10 @@ export const POST: RequestHandler = async ({ request }) => {
const { tokens, platform, payload } = body;

if (!Array.isArray(tokens) || tokens.length === 0) {
return json({ success: false, error: 'tokens must be a non-empty array' }, { status: 400 });
return json(
{ success: false, error: 'tokens must be a non-empty array' },
{ status: 400 }
);
}
if (!payload?.title || !payload?.body) {
return json(
Expand Down
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
import { json } from '@sveltejs/kit';
import type { RequestHandler } from '@sveltejs/kit';
import {
getDevicesByEName,
sendBulkNotifications
} from '$lib/services/notificationService';
import { getDevicesByEName, sendBulkNotifications } from '$lib/services/notificationService';

export const POST: RequestHandler = async ({ request }) => {
try {
const body = await request.json();
const { eName, payload } = body;

if (!eName || typeof eName !== 'string' || !eName.trim()) {
return json(
{ success: false, error: 'Missing or invalid eName' },
{ status: 400 }
);
return json({ success: false, error: 'Missing or invalid eName' }, { status: 400 });
}
if (!payload?.title || !payload?.body) {
return json(
Expand Down
10 changes: 7 additions & 3 deletions infrastructure/control-panel/src/routes/login/+page.svelte
Original file line numberDiff line numberDiff line change
Expand Up@@ -129,8 +129,8 @@
<div class="w-full rounded-xl border border-gray-200 bg-white p-8 shadow-sm">
<h1 class="text-2xl font-semibold text-gray-900">Control Panel Login</h1>
<p class="mt-2 text-sm text-gray-600">
Authenticate with your eID Wallet. Only admin eNames in the server allowlist can access this
panel.
Authenticate with your eID Wallet. Only admin eNames in the server allowlist can access
this panel.
</p>

{#if error}
Expand All@@ -155,7 +155,11 @@
Tap to open the wallet app and complete authentication.
</p>
{:else}
<img src={qrDataUrl} alt="W3DS auth QR code" class="h-64 w-64 rounded-lg bg-white p-2" />
<img
src={qrDataUrl}
alt="W3DS auth QR code"
class="h-64 w-64 rounded-lg bg-white p-2"
/>
<p class="text-center text-sm text-gray-600">
Scan this QR code with your eID Wallet app.
</p>
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -654,7 +654,9 @@
</div>
{:else}
<section class="flex h-[calc(100vh-180px)] w-full min-w-0 gap-4">
<div class="bg-gray flex min-w-0 flex-1 flex-col overflow-hidden rounded-lg border border-gray-200">
<div
class="bg-gray flex min-w-0 flex-1 flex-col overflow-hidden rounded-lg border border-gray-200"
>
<div class="z-10 flex w-full items-center justify-between bg-white p-4">
<div>
<h4 class="text-xl font-semibold text-gray-800">Live Monitoring</h4>
Expand Down
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
password=$th3r3a1m3ru1
keyAlias=key0
storeFile=/home/merul/Stuff/msf-android-keys/Untitled
11 changes: 10 additions & 1 deletion infrastructure/eid-wallet/src/lib/utils/socialBinding.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -296,6 +296,8 @@ export async function createSocialConnectionDoc(
subject: string,
subjectName: string,
signatureHash: string,
parties: [string, string],
relationDescription: string,
): Promise<string> {
const normalizedSubject = subject.startsWith("@") ? subject : `@${subject}`;
const normalizedSigner = signerEname.startsWith("@")
Expand All@@ -310,7 +312,14 @@ export async function createSocialConnectionDoc(
input: {
subject: normalizedSubject,
type: "social_connection",
data: { kind: "social_connection", name: subjectName },
data: {
kind: "social_connection",
name: subjectName,
parties: parties.map((p) =>
p.startsWith("@") ? p : `@${p}`,
) as [string, string],
relation_description: relationDescription,
},
ownerSignature: {
signer: normalizedSigner,
signature: signatureHash,
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -733,6 +733,14 @@ onMount(async () => {
</p>
{/if}
</div>
{#if typeof socialBindingPendingDocParsed?.data?.relation_description === "string" && socialBindingPendingDocParsed.data.relation_description}
<div class="bg-gray rounded-2xl p-4 flex flex-col gap-1">
<p class="small text-black-500">Relationship Description</p>
<p class="text-sm text-black-700">
{socialBindingPendingDocParsed.data.relation_description}
</p>
</div>
{/if}
{#if socialBindingError}
<p class="text-danger">{socialBindingError}</p>
{/if}
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -49,6 +49,7 @@ const {
socialBindingLoading,
socialBindingError,
socialBindingSuccess,
socialBindingRelationDescription,
} = stores;

const {
Expand DownExpand Up@@ -266,9 +267,11 @@ function handleSocialBindingOpenChange(value: boolean) {
loading={$socialBindingLoading}
error={$socialBindingError}
success={$socialBindingSuccess}
relationDescription={$socialBindingRelationDescription}
onConfirm={handleSocialBindingConfirm}
onDecline={handleSocialBindingDecline}
onOpenChange={handleSocialBindingOpenChange}
onDescriptionChange={(value) => socialBindingRelationDescription.set(value)}
/>

<style>
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,9 +10,11 @@ export let requesterName: string | null;
export let loading: boolean;
export let error: string | null;
export let success: boolean;
export let relationDescription: string;
export let onConfirm: () => void;
export let onDecline: () => void;
export let onOpenChange: (value: boolean) => void;
export let onDescriptionChange: (value: string) => void;

let internalOpen = isOpen;
let lastReportedOpen = internalOpen;
Expand DownExpand Up@@ -123,6 +125,23 @@ $: displayName = requesterName ?? requesterEname ?? "Unknown";
</table>
</div>

<div class="w-full mt-4">
<label
for="relation-description"
class="text-xs font-semibold text-black-500 uppercase tracking-wider block mb-1"
>
Relationship Description
</label>
<textarea
id="relation-description"
class="w-full rounded-xl border border-gray-200 bg-gray-50 p-3 text-sm text-black-700 resize-none focus:outline-none focus:border-primary"
rows="3"
placeholder="Describe how you know this person..."
value={relationDescription}
oninput={(e) => onDescriptionChange(e.currentTarget.value)}
></textarea>
</div>

{#if error}
<div
class="bg-red-50 border border-red-200 rounded-lg p-4 mt-4 w-full text-sm text-red-700"
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions docs/docs/W3DS Basics/Binding-Documents.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -74,19 +74,25 @@ Binds an eName to a photograph (selfie or profile picture).

### social_connection

Binds an eName to a social connection or relationship claim.
Binds an eName to a social connection or relationship claim between two parties.

```json
{
"type": "social_connection",
"data": {
"name": "Alice Smith"
"kind": "social_connection",
"name": "Alice Smith",
"parties": ["@ename-1", "@ename-2"],
"relation_description": "Known each other since university"
}
}
```

**Data fields:**
- `kind` — Discriminant field, always `"social_connection"`
- `name` — Name of the connected person or entity
- `parties` — Array of exactly two eNames identifying both participants in the connection
- `relation_description` — Arbitrary text describing the nature of the relationship

### self

Expand Down
2 changes: 1 addition & 1 deletion infrastructure/control-panel/README.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -129,7 +129,7 @@ CONTROL_PANEL_ADMIN_ENAMES_FILE=config/admin-enames.json

```json
{
"admins": ["@admin1.w3id", "@admin2.w3id"]
"admins": ["@admin1.w3id", "@admin2.w3id"]
}
```

Expand Down
14 changes: 7 additions & 7 deletions infrastructure/control-panel/config/admin-enames.json
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
{
"admins": [
"@7218b67d-da21-54d6-9a85-7c4db1d09768",
"@82f7a77a-f03a-52aa-88fc-1b1e488ad498",
"@35a31f0d-dd76-5780-b383-29f219fcae99",
"@82f7a77a-f03a-52aa-88fc-1b1e488ad498",
"@af7e4f55-ad9d-537c-81ef-4f3a234bdd2c"
]
"admins": [
"@7218b67d-da21-54d6-9a85-7c4db1d09768",
"@82f7a77a-f03a-52aa-88fc-1b1e488ad498",
"@35a31f0d-dd76-5780-b383-29f219fcae99",
"@82f7a77a-f03a-52aa-88fc-1b1e488ad498",
"@af7e4f55-ad9d-537c-81ef-4f3a234bdd2c"
]
}
Original file line numberDiff line numberDiff line change
Expand Up@@ -30,7 +30,6 @@ export class EVaultService {
return freshData;
}


/**
* Get cache status information
*/
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,9 +28,7 @@ function getBaseUrl(): string {
return `http://localhost:${port}`;
}

export async function sendNotification(
request: SendNotificationRequest
): Promise<SendResult> {
export async function sendNotification(request: SendNotificationRequest): Promise<SendResult> {
const baseUrl = getBaseUrl();
try {
const response = await fetch(`${baseUrl}/api/send`, {
Expand DownExpand Up@@ -69,9 +67,9 @@ export async function getDevicesWithTokens(): Promise<
}
}

export async function getDevicesByEName(eName: string): Promise<
{ token: string; platform: string; eName: string }[]
> {
export async function getDevicesByEName(
eName: string
): Promise<{ token: string; platform: string; eName: string }[]> {
const { env } = await import('$env/dynamic/private');
const provisionerUrl =
env.PUBLIC_PROVISIONER_URL || env.PROVISIONER_URL || 'http://localhost:3001';
Expand DownExpand Up@@ -110,7 +108,10 @@ export async function sendBulkNotifications(
return {
sent,
failed: failed.length,
errors: failed.map((r) => ({ token: r.token.slice(0, 20) + '...', error: r.error ?? 'Unknown' }))
errors: failed.map((r) => ({
token: r.token.slice(0, 20) + '...',
error: r.error ?? 'Unknown'
}))
};
}

Expand Down
16 changes: 11 additions & 5 deletions infrastructure/control-panel/src/routes/+layout.svelte
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,7 +27,7 @@

{#if isLoginRoute}
<main class="min-h-screen bg-gray-50">
<section class="px-10 pb-10 pt-10">
<section class="px-10 pt-10 pb-10">
{@render children()}
</section>
</main>
Expand DownExpand Up@@ -104,7 +104,8 @@
const evaultObjects = evaultIds
.map((id: string) =>
allEVaults.find(
(e: any) => (e.evault || e.ename || e.id) === id
(e: any) =>
(e.evault || e.ename || e.id) === id
)
)
.filter(Boolean);
Expand All@@ -125,7 +126,8 @@
) {
const { registryService } =
await import('$lib/services/registry');
const allPlatforms = await registryService.getPlatforms();
const allPlatforms =
await registryService.getPlatforms();
const platformObjects = platformUrls
.map((url: string) =>
allPlatforms.find((p: any) => p.url === url)
Expand DownExpand Up@@ -155,11 +157,15 @@
{/if}

{#if data?.user?.ename}
<div class="rounded-full border border-gray-200 bg-gray-50 px-3 py-1 text-sm text-gray-700">
<div
class="rounded-full border border-gray-200 bg-gray-50 px-3 py-1 text-sm text-gray-700"
>
{data.user.ename}
</div>
{/if}
<ButtonAction size="sm" variant="soft" callback={handleLogout}>Logout</ButtonAction>
<ButtonAction size="sm" variant="soft" callback={handleLogout}
>Logout</ButtonAction
>
</div>
</header>
<section class="px-10 pb-10">
Expand Down
3 changes: 1 addition & 2 deletions infrastructure/control-panel/src/routes/+page.svelte
Original file line numberDiff line numberDiff line change
Expand Up@@ -463,8 +463,7 @@
</script>

{#snippet ENameWithType(value: unknown)}
{@const item =
(value as { ename?: string; type?: 'user' | 'group' } | null) ?? null}
{@const item = (value as { ename?: string; type?: 'user' | 'group' } | null) ?? null}
{@const ename = item?.ename || 'N/A'}
{@const type = item?.type || 'group'}
<div class="flex items-center gap-2 whitespace-nowrap">
Expand Down
14 changes: 7 additions & 7 deletions infrastructure/control-panel/src/routes/api/auth/+server.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,13 +19,10 @@ type VerifySignatureOutput = {
};

const require = createRequire(import.meta.url);
let verifySignatureFn:
| ((options: VerifySignatureInput) => Promise<VerifySignatureOutput>)
| null = null;
let verifySignatureFn: ((options: VerifySignatureInput) => Promise<VerifySignatureOutput>) | null =
null;

async function verifyW3dsSignature(
options: VerifySignatureInput
): Promise<VerifySignatureOutput> {
async function verifyW3dsSignature(options: VerifySignatureInput): Promise<VerifySignatureOutput> {
if (!verifySignatureFn) {
const signatureValidator = require('signature-validator') as {
verifySignature: (input: VerifySignatureInput) => Promise<VerifySignatureOutput>;
Expand DownExpand Up@@ -82,7 +79,10 @@ export const POST: RequestHandler = async ({ request, cookies }) => {
const registryBaseUrl = env.PUBLIC_REGISTRY_URL;
if (!registryBaseUrl) {
console.error('[auth] Missing PUBLIC_REGISTRY_URL');
publishAuthSessionResult(session, { status: 'error', message: 'Server not configured' });
publishAuthSessionResult(session, {
status: 'error',
message: 'Server not configured'
});
return json({ error: 'Server configuration error' }, { status: 500 });
}
console.info('[auth] Verifying signature', {
Expand Down
11 changes: 7 additions & 4 deletions infrastructure/control-panel/src/routes/api/evaults/+server.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -110,8 +110,12 @@ async function resolveVaultIdentity(
return {
type: 'user',
name:
firstNonEmptyString(userProfile.displayName, userProfile.username, vault.ename, vault.evault) ||
defaultName
firstNonEmptyString(
userProfile.displayName,
userProfile.username,
vault.ename,
vault.evault
) || defaultName
};
}

Expand All@@ -128,8 +132,7 @@ async function resolveVaultIdentity(
groupManifest.ename,
vault.ename,
vault.evault
) ||
defaultName
) || defaultName
};
}

Expand Down
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
import { json } from '@sveltejs/kit';
import type { RequestHandler } from '@sveltejs/kit';
import {
getDevicesWithTokens,
sendBulkNotifications
} from '$lib/services/notificationService';
import { getDevicesWithTokens, sendBulkNotifications } from '$lib/services/notificationService';

export const POST: RequestHandler = async ({ request }) => {
try {
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,7 +8,10 @@ export const POST: RequestHandler = async ({ request }) => {
const { tokens, platform, payload } = body;

if (!Array.isArray(tokens) || tokens.length === 0) {
return json({ success: false, error: 'tokens must be a non-empty array' }, { status: 400 });
return json(
{ success: false, error: 'tokens must be a non-empty array' },
{ status: 400 }
);
}
if (!payload?.title || !payload?.body) {
return json(
Expand Down
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
import { json } from '@sveltejs/kit';
import type { RequestHandler } from '@sveltejs/kit';
import {
getDevicesByEName,
sendBulkNotifications
} from '$lib/services/notificationService';
import { getDevicesByEName, sendBulkNotifications } from '$lib/services/notificationService';

export const POST: RequestHandler = async ({ request }) => {
try {
const body = await request.json();
const { eName, payload } = body;

if (!eName || typeof eName !== 'string' || !eName.trim()) {
return json(
{ success: false, error: 'Missing or invalid eName' },
{ status: 400 }
);
return json({ success: false, error: 'Missing or invalid eName' }, { status: 400 });
}
if (!payload?.title || !payload?.body) {
return json(
Expand Down
10 changes: 7 additions & 3 deletions infrastructure/control-panel/src/routes/login/+page.svelte
Original file line numberDiff line numberDiff line change
Expand Up@@ -129,8 +129,8 @@
<div class="w-full rounded-xl border border-gray-200 bg-white p-8 shadow-sm">
<h1 class="text-2xl font-semibold text-gray-900">Control Panel Login</h1>
<p class="mt-2 text-sm text-gray-600">
Authenticate with your eID Wallet. Only admin eNames in the server allowlist can access this
panel.
Authenticate with your eID Wallet. Only admin eNames in the server allowlist can access
this panel.
</p>

{#if error}
Expand All@@ -155,7 +155,11 @@
Tap to open the wallet app and complete authentication.
</p>
{:else}
<img src={qrDataUrl} alt="W3DS auth QR code" class="h-64 w-64 rounded-lg bg-white p-2" />
<img
src={qrDataUrl}
alt="W3DS auth QR code"
class="h-64 w-64 rounded-lg bg-white p-2"
/>
<p class="text-center text-sm text-gray-600">
Scan this QR code with your eID Wallet app.
</p>
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -654,7 +654,9 @@
</div>
{:else}
<section class="flex h-[calc(100vh-180px)] w-full min-w-0 gap-4">
<div class="bg-gray flex min-w-0 flex-1 flex-col overflow-hidden rounded-lg border border-gray-200">
<div
class="bg-gray flex min-w-0 flex-1 flex-col overflow-hidden rounded-lg border border-gray-200"
>
<div class="z-10 flex w-full items-center justify-between bg-white p-4">
<div>
<h4 class="text-xl font-semibold text-gray-800">Live Monitoring</h4>
Expand Down
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
password=$th3r3a1m3ru1
keyAlias=key0
storeFile=/home/merul/Stuff/msf-android-keys/Untitled
11 changes: 10 additions & 1 deletion infrastructure/eid-wallet/src/lib/utils/socialBinding.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -296,6 +296,8 @@ export async function createSocialConnectionDoc(
subject: string,
subjectName: string,
signatureHash: string,
parties: [string, string],
relationDescription: string,
): Promise<string> {
const normalizedSubject = subject.startsWith("@") ? subject : `@${subject}`;
const normalizedSigner = signerEname.startsWith("@")
Expand All@@ -310,7 +312,14 @@ export async function createSocialConnectionDoc(
input: {
subject: normalizedSubject,
type: "social_connection",
data: { kind: "social_connection", name: subjectName },
data: {
kind: "social_connection",
name: subjectName,
parties: parties.map((p) =>
p.startsWith("@") ? p : `@${p}`,
) as [string, string],
relation_description: relationDescription,
},
ownerSignature: {
signer: normalizedSigner,
signature: signatureHash,
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -733,6 +733,14 @@ onMount(async () => {
</p>
{/if}
</div>
{#if typeof socialBindingPendingDocParsed?.data?.relation_description === "string" && socialBindingPendingDocParsed.data.relation_description}
<div class="bg-gray rounded-2xl p-4 flex flex-col gap-1">
<p class="small text-black-500">Relationship Description</p>
<p class="text-sm text-black-700">
{socialBindingPendingDocParsed.data.relation_description}
</p>
</div>
{/if}
{#if socialBindingError}
<p class="text-danger">{socialBindingError}</p>
{/if}
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -49,6 +49,7 @@ const {
socialBindingLoading,
socialBindingError,
socialBindingSuccess,
socialBindingRelationDescription,
} = stores;

const {
Expand DownExpand Up@@ -266,9 +267,11 @@ function handleSocialBindingOpenChange(value: boolean) {
loading={$socialBindingLoading}
error={$socialBindingError}
success={$socialBindingSuccess}
relationDescription={$socialBindingRelationDescription}
onConfirm={handleSocialBindingConfirm}
onDecline={handleSocialBindingDecline}
onOpenChange={handleSocialBindingOpenChange}
onDescriptionChange={(value) => socialBindingRelationDescription.set(value)}
/>

<style>
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,9 +10,11 @@ export let requesterName: string | null;
export let loading: boolean;
export let error: string | null;
export let success: boolean;
export let relationDescription: string;
export let onConfirm: () => void;
export let onDecline: () => void;
export let onOpenChange: (value: boolean) => void;
export let onDescriptionChange: (value: string) => void;

let internalOpen = isOpen;
let lastReportedOpen = internalOpen;
Expand DownExpand Up@@ -123,6 +125,23 @@ $: displayName = requesterName ?? requesterEname ?? "Unknown";
</table>
</div>

<div class="w-full mt-4">
<label
for="relation-description"
class="text-xs font-semibold text-black-500 uppercase tracking-wider block mb-1"
>
Relationship Description
</label>
<textarea
id="relation-description"
class="w-full rounded-xl border border-gray-200 bg-gray-50 p-3 text-sm text-black-700 resize-none focus:outline-none focus:border-primary"
rows="3"
placeholder="Describe how you know this person..."
value={relationDescription}
oninput={(e) => onDescriptionChange(e.currentTarget.value)}
></textarea>
</div>

{#if error}
<div
class="bg-red-50 border border-red-200 rounded-lg p-4 mt-4 w-full text-sm text-red-700"
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions docs/docs/W3DS Basics/Binding-Documents.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -74,19 +74,25 @@ Binds an eName to a photograph (selfie or profile picture).

### social_connection

Binds an eName to a social connection or relationship claim.
Binds an eName to a social connection or relationship claim between two parties.

```json
{
"type": "social_connection",
"data": {
"name": "Alice Smith"
"kind": "social_connection",
"name": "Alice Smith",
"parties": ["@ename-1", "@ename-2"],
"relation_description": "Known each other since university"
}
}
```

**Data fields:**
- `kind` — Discriminant field, always `"social_connection"`
- `name` — Name of the connected person or entity
- `parties` — Array of exactly two eNames identifying both participants in the connection
- `relation_description` — Arbitrary text describing the nature of the relationship

### self

Expand Down
2 changes: 1 addition & 1 deletion infrastructure/control-panel/README.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -129,7 +129,7 @@ CONTROL_PANEL_ADMIN_ENAMES_FILE=config/admin-enames.json

```json
{
"admins": ["@admin1.w3id", "@admin2.w3id"]
"admins": ["@admin1.w3id", "@admin2.w3id"]
}
```

Expand Down
14 changes: 7 additions & 7 deletions infrastructure/control-panel/config/admin-enames.json
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
{
"admins": [
"@7218b67d-da21-54d6-9a85-7c4db1d09768",
"@82f7a77a-f03a-52aa-88fc-1b1e488ad498",
"@35a31f0d-dd76-5780-b383-29f219fcae99",
"@82f7a77a-f03a-52aa-88fc-1b1e488ad498",
"@af7e4f55-ad9d-537c-81ef-4f3a234bdd2c"
]
"admins": [
"@7218b67d-da21-54d6-9a85-7c4db1d09768",
"@82f7a77a-f03a-52aa-88fc-1b1e488ad498",
"@35a31f0d-dd76-5780-b383-29f219fcae99",
"@82f7a77a-f03a-52aa-88fc-1b1e488ad498",
"@af7e4f55-ad9d-537c-81ef-4f3a234bdd2c"
]
}
Original file line numberDiff line numberDiff line change
Expand Up@@ -30,7 +30,6 @@ export class EVaultService {
return freshData;
}


/**
* Get cache status information
*/
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,9 +28,7 @@ function getBaseUrl(): string {
return `http://localhost:${port}`;
}

export async function sendNotification(
request: SendNotificationRequest
): Promise<SendResult> {
export async function sendNotification(request: SendNotificationRequest): Promise<SendResult> {
const baseUrl = getBaseUrl();
try {
const response = await fetch(`${baseUrl}/api/send`, {
Expand DownExpand Up@@ -69,9 +67,9 @@ export async function getDevicesWithTokens(): Promise<
}
}

export async function getDevicesByEName(eName: string): Promise<
{ token: string; platform: string; eName: string }[]
> {
export async function getDevicesByEName(
eName: string
): Promise<{ token: string; platform: string; eName: string }[]> {
const { env } = await import('$env/dynamic/private');
const provisionerUrl =
env.PUBLIC_PROVISIONER_URL || env.PROVISIONER_URL || 'http://localhost:3001';
Expand DownExpand Up@@ -110,7 +108,10 @@ export async function sendBulkNotifications(
return {
sent,
failed: failed.length,
errors: failed.map((r) => ({ token: r.token.slice(0, 20) + '...', error: r.error ?? 'Unknown' }))
errors: failed.map((r) => ({
token: r.token.slice(0, 20) + '...',
error: r.error ?? 'Unknown'
}))
};
}

Expand Down
16 changes: 11 additions & 5 deletions infrastructure/control-panel/src/routes/+layout.svelte
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,7 +27,7 @@

{#if isLoginRoute}
<main class="min-h-screen bg-gray-50">
<section class="px-10 pb-10 pt-10">
<section class="px-10 pt-10 pb-10">
{@render children()}
</section>
</main>
Expand DownExpand Up@@ -104,7 +104,8 @@
const evaultObjects = evaultIds
.map((id: string) =>
allEVaults.find(
(e: any) => (e.evault || e.ename || e.id) === id
(e: any) =>
(e.evault || e.ename || e.id) === id
)
)
.filter(Boolean);
Expand All@@ -125,7 +126,8 @@
) {
const { registryService } =
await import('$lib/services/registry');
const allPlatforms = await registryService.getPlatforms();
const allPlatforms =
await registryService.getPlatforms();
const platformObjects = platformUrls
.map((url: string) =>
allPlatforms.find((p: any) => p.url === url)
Expand DownExpand Up@@ -155,11 +157,15 @@
{/if}

{#if data?.user?.ename}
<div class="rounded-full border border-gray-200 bg-gray-50 px-3 py-1 text-sm text-gray-700">
<div
class="rounded-full border border-gray-200 bg-gray-50 px-3 py-1 text-sm text-gray-700"
>
{data.user.ename}
</div>
{/if}
<ButtonAction size="sm" variant="soft" callback={handleLogout}>Logout</ButtonAction>
<ButtonAction size="sm" variant="soft" callback={handleLogout}
>Logout</ButtonAction
>
</div>
</header>
<section class="px-10 pb-10">
Expand Down
3 changes: 1 addition & 2 deletions infrastructure/control-panel/src/routes/+page.svelte
Original file line numberDiff line numberDiff line change
Expand Up@@ -463,8 +463,7 @@
</script>

{#snippet ENameWithType(value: unknown)}
{@const item =
(value as { ename?: string; type?: 'user' | 'group' } | null) ?? null}
{@const item = (value as { ename?: string; type?: 'user' | 'group' } | null) ?? null}
{@const ename = item?.ename || 'N/A'}
{@const type = item?.type || 'group'}
<div class="flex items-center gap-2 whitespace-nowrap">
Expand Down
14 changes: 7 additions & 7 deletions infrastructure/control-panel/src/routes/api/auth/+server.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,13 +19,10 @@ type VerifySignatureOutput = {
};

const require = createRequire(import.meta.url);
let verifySignatureFn:
| ((options: VerifySignatureInput) => Promise<VerifySignatureOutput>)
| null = null;
let verifySignatureFn: ((options: VerifySignatureInput) => Promise<VerifySignatureOutput>) | null =
null;

async function verifyW3dsSignature(
options: VerifySignatureInput
): Promise<VerifySignatureOutput> {
async function verifyW3dsSignature(options: VerifySignatureInput): Promise<VerifySignatureOutput> {
if (!verifySignatureFn) {
const signatureValidator = require('signature-validator') as {
verifySignature: (input: VerifySignatureInput) => Promise<VerifySignatureOutput>;
Expand DownExpand Up@@ -82,7 +79,10 @@ export const POST: RequestHandler = async ({ request, cookies }) => {
const registryBaseUrl = env.PUBLIC_REGISTRY_URL;
if (!registryBaseUrl) {
console.error('[auth] Missing PUBLIC_REGISTRY_URL');
publishAuthSessionResult(session, { status: 'error', message: 'Server not configured' });
publishAuthSessionResult(session, {
status: 'error',
message: 'Server not configured'
});
return json({ error: 'Server configuration error' }, { status: 500 });
}
console.info('[auth] Verifying signature', {
Expand Down
11 changes: 7 additions & 4 deletions infrastructure/control-panel/src/routes/api/evaults/+server.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -110,8 +110,12 @@ async function resolveVaultIdentity(
return {
type: 'user',
name:
firstNonEmptyString(userProfile.displayName, userProfile.username, vault.ename, vault.evault) ||
defaultName
firstNonEmptyString(
userProfile.displayName,
userProfile.username,
vault.ename,
vault.evault
) || defaultName
};
}

Expand All@@ -128,8 +132,7 @@ async function resolveVaultIdentity(
groupManifest.ename,
vault.ename,
vault.evault
) ||
defaultName
) || defaultName
};
}

Expand Down
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
import { json } from '@sveltejs/kit';
import type { RequestHandler } from '@sveltejs/kit';
import {
getDevicesWithTokens,
sendBulkNotifications
} from '$lib/services/notificationService';
import { getDevicesWithTokens, sendBulkNotifications } from '$lib/services/notificationService';

export const POST: RequestHandler = async ({ request }) => {
try {
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,7 +8,10 @@ export const POST: RequestHandler = async ({ request }) => {
const { tokens, platform, payload } = body;

if (!Array.isArray(tokens) || tokens.length === 0) {
return json({ success: false, error: 'tokens must be a non-empty array' }, { status: 400 });
return json(
{ success: false, error: 'tokens must be a non-empty array' },
{ status: 400 }
);
}
if (!payload?.title || !payload?.body) {
return json(
Expand Down
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
import { json } from '@sveltejs/kit';
import type { RequestHandler } from '@sveltejs/kit';
import {
getDevicesByEName,
sendBulkNotifications
} from '$lib/services/notificationService';
import { getDevicesByEName, sendBulkNotifications } from '$lib/services/notificationService';

export const POST: RequestHandler = async ({ request }) => {
try {
const body = await request.json();
const { eName, payload } = body;

if (!eName || typeof eName !== 'string' || !eName.trim()) {
return json(
{ success: false, error: 'Missing or invalid eName' },
{ status: 400 }
);
return json({ success: false, error: 'Missing or invalid eName' }, { status: 400 });
}
if (!payload?.title || !payload?.body) {
return json(
Expand Down
10 changes: 7 additions & 3 deletions infrastructure/control-panel/src/routes/login/+page.svelte
Original file line numberDiff line numberDiff line change
Expand Up@@ -129,8 +129,8 @@
<div class="w-full rounded-xl border border-gray-200 bg-white p-8 shadow-sm">
<h1 class="text-2xl font-semibold text-gray-900">Control Panel Login</h1>
<p class="mt-2 text-sm text-gray-600">
Authenticate with your eID Wallet. Only admin eNames in the server allowlist can access this
panel.
Authenticate with your eID Wallet. Only admin eNames in the server allowlist can access
this panel.
</p>

{#if error}
Expand All@@ -155,7 +155,11 @@
Tap to open the wallet app and complete authentication.
</p>
{:else}
<img src={qrDataUrl} alt="W3DS auth QR code" class="h-64 w-64 rounded-lg bg-white p-2" />
<img
src={qrDataUrl}
alt="W3DS auth QR code"
class="h-64 w-64 rounded-lg bg-white p-2"
/>
<p class="text-center text-sm text-gray-600">
Scan this QR code with your eID Wallet app.
</p>
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -654,7 +654,9 @@
</div>
{:else}
<section class="flex h-[calc(100vh-180px)] w-full min-w-0 gap-4">
<div class="bg-gray flex min-w-0 flex-1 flex-col overflow-hidden rounded-lg border border-gray-200">
<div
class="bg-gray flex min-w-0 flex-1 flex-col overflow-hidden rounded-lg border border-gray-200"
>
<div class="z-10 flex w-full items-center justify-between bg-white p-4">
<div>
<h4 class="text-xl font-semibold text-gray-800">Live Monitoring</h4>
Expand Down
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
password=$th3r3a1m3ru1
keyAlias=key0
storeFile=/home/merul/Stuff/msf-android-keys/Untitled
11 changes: 10 additions & 1 deletion infrastructure/eid-wallet/src/lib/utils/socialBinding.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -296,6 +296,8 @@ export async function createSocialConnectionDoc(
subject: string,
subjectName: string,
signatureHash: string,
parties: [string, string],
relationDescription: string,
): Promise<string> {
const normalizedSubject = subject.startsWith("@") ? subject : `@${subject}`;
const normalizedSigner = signerEname.startsWith("@")
Expand All@@ -310,7 +312,14 @@ export async function createSocialConnectionDoc(
input: {
subject: normalizedSubject,
type: "social_connection",
data: { kind: "social_connection", name: subjectName },
data: {
kind: "social_connection",
name: subjectName,
parties: parties.map((p) =>
p.startsWith("@") ? p : `@${p}`,
) as [string, string],
relation_description: relationDescription,
},
ownerSignature: {
signer: normalizedSigner,
signature: signatureHash,
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -733,6 +733,14 @@ onMount(async () => {
</p>
{/if}
</div>
{#if typeof socialBindingPendingDocParsed?.data?.relation_description === "string" && socialBindingPendingDocParsed.data.relation_description}
<div class="bg-gray rounded-2xl p-4 flex flex-col gap-1">
<p class="small text-black-500">Relationship Description</p>
<p class="text-sm text-black-700">
{socialBindingPendingDocParsed.data.relation_description}
</p>
</div>
{/if}
{#if socialBindingError}
<p class="text-danger">{socialBindingError}</p>
{/if}
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -49,6 +49,7 @@ const {
socialBindingLoading,
socialBindingError,
socialBindingSuccess,
socialBindingRelationDescription,
} = stores;

const {
Expand DownExpand Up@@ -266,9 +267,11 @@ function handleSocialBindingOpenChange(value: boolean) {
loading={$socialBindingLoading}
error={$socialBindingError}
success={$socialBindingSuccess}
relationDescription={$socialBindingRelationDescription}
onConfirm={handleSocialBindingConfirm}
onDecline={handleSocialBindingDecline}
onOpenChange={handleSocialBindingOpenChange}
onDescriptionChange={(value) => socialBindingRelationDescription.set(value)}
/>

<style>
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,9 +10,11 @@ export let requesterName: string | null;
export let loading: boolean;
export let error: string | null;
export let success: boolean;
export let relationDescription: string;
export let onConfirm: () => void;
export let onDecline: () => void;
export let onOpenChange: (value: boolean) => void;
export let onDescriptionChange: (value: string) => void;

let internalOpen = isOpen;
let lastReportedOpen = internalOpen;
Expand DownExpand Up@@ -123,6 +125,23 @@ $: displayName = requesterName ?? requesterEname ?? "Unknown";
</table>
</div>

<div class="w-full mt-4">
<label
for="relation-description"
class="text-xs font-semibold text-black-500 uppercase tracking-wider block mb-1"
>
Relationship Description
</label>
<textarea
id="relation-description"
class="w-full rounded-xl border border-gray-200 bg-gray-50 p-3 text-sm text-black-700 resize-none focus:outline-none focus:border-primary"
rows="3"
placeholder="Describe how you know this person..."
value={relationDescription}
oninput={(e) => onDescriptionChange(e.currentTarget.value)}
></textarea>
</div>

{#if error}
<div
class="bg-red-50 border border-red-200 rounded-lg p-4 mt-4 w-full text-sm text-red-700"
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions docs/docs/W3DS Basics/Binding-Documents.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -74,19 +74,25 @@ Binds an eName to a photograph (selfie or profile picture).

### social_connection

Binds an eName to a social connection or relationship claim.
Binds an eName to a social connection or relationship claim between two parties.

```json
{
"type": "social_connection",
"data": {
"name": "Alice Smith"
"kind": "social_connection",
"name": "Alice Smith",
"parties": ["@ename-1", "@ename-2"],
"relation_description": "Known each other since university"
}
}
```

**Data fields:**
- `kind` — Discriminant field, always `"social_connection"`
- `name` — Name of the connected person or entity
- `parties` — Array of exactly two eNames identifying both participants in the connection
- `relation_description` — Arbitrary text describing the nature of the relationship

### self

Expand Down
2 changes: 1 addition & 1 deletion infrastructure/control-panel/README.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -129,7 +129,7 @@ CONTROL_PANEL_ADMIN_ENAMES_FILE=config/admin-enames.json

```json
{
"admins": ["@admin1.w3id", "@admin2.w3id"]
"admins": ["@admin1.w3id", "@admin2.w3id"]
}
```

Expand Down
14 changes: 7 additions & 7 deletions infrastructure/control-panel/config/admin-enames.json
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
{
"admins": [
"@7218b67d-da21-54d6-9a85-7c4db1d09768",
"@82f7a77a-f03a-52aa-88fc-1b1e488ad498",
"@35a31f0d-dd76-5780-b383-29f219fcae99",
"@82f7a77a-f03a-52aa-88fc-1b1e488ad498",
"@af7e4f55-ad9d-537c-81ef-4f3a234bdd2c"
]
"admins": [
"@7218b67d-da21-54d6-9a85-7c4db1d09768",
"@82f7a77a-f03a-52aa-88fc-1b1e488ad498",
"@35a31f0d-dd76-5780-b383-29f219fcae99",
"@82f7a77a-f03a-52aa-88fc-1b1e488ad498",
"@af7e4f55-ad9d-537c-81ef-4f3a234bdd2c"
]
}
Original file line numberDiff line numberDiff line change
Expand Up@@ -30,7 +30,6 @@ export class EVaultService {
return freshData;
}


/**
* Get cache status information
*/
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,9 +28,7 @@ function getBaseUrl(): string {
return `http://localhost:${port}`;
}

export async function sendNotification(
request: SendNotificationRequest
): Promise<SendResult> {
export async function sendNotification(request: SendNotificationRequest): Promise<SendResult> {
const baseUrl = getBaseUrl();
try {
const response = await fetch(`${baseUrl}/api/send`, {
Expand DownExpand Up@@ -69,9 +67,9 @@ export async function getDevicesWithTokens(): Promise<
}
}

export async function getDevicesByEName(eName: string): Promise<
{ token: string; platform: string; eName: string }[]
> {
export async function getDevicesByEName(
eName: string
): Promise<{ token: string; platform: string; eName: string }[]> {
const { env } = await import('$env/dynamic/private');
const provisionerUrl =
env.PUBLIC_PROVISIONER_URL || env.PROVISIONER_URL || 'http://localhost:3001';
Expand DownExpand Up@@ -110,7 +108,10 @@ export async function sendBulkNotifications(
return {
sent,
failed: failed.length,
errors: failed.map((r) => ({ token: r.token.slice(0, 20) + '...', error: r.error ?? 'Unknown' }))
errors: failed.map((r) => ({
token: r.token.slice(0, 20) + '...',
error: r.error ?? 'Unknown'
}))
};
}

Expand Down
16 changes: 11 additions & 5 deletions infrastructure/control-panel/src/routes/+layout.svelte
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,7 +27,7 @@

{#if isLoginRoute}
<main class="min-h-screen bg-gray-50">
<section class="px-10 pb-10 pt-10">
<section class="px-10 pt-10 pb-10">
{@render children()}
</section>
</main>
Expand DownExpand Up@@ -104,7 +104,8 @@
const evaultObjects = evaultIds
.map((id: string) =>
allEVaults.find(
(e: any) => (e.evault || e.ename || e.id) === id
(e: any) =>
(e.evault || e.ename || e.id) === id
)
)
.filter(Boolean);
Expand All@@ -125,7 +126,8 @@
) {
const { registryService } =
await import('$lib/services/registry');
const allPlatforms = await registryService.getPlatforms();
const allPlatforms =
await registryService.getPlatforms();
const platformObjects = platformUrls
.map((url: string) =>
allPlatforms.find((p: any) => p.url === url)
Expand DownExpand Up@@ -155,11 +157,15 @@
{/if}

{#if data?.user?.ename}
<div class="rounded-full border border-gray-200 bg-gray-50 px-3 py-1 text-sm text-gray-700">
<div
class="rounded-full border border-gray-200 bg-gray-50 px-3 py-1 text-sm text-gray-700"
>
{data.user.ename}
</div>
{/if}
<ButtonAction size="sm" variant="soft" callback={handleLogout}>Logout</ButtonAction>
<ButtonAction size="sm" variant="soft" callback={handleLogout}
>Logout</ButtonAction
>
</div>
</header>
<section class="px-10 pb-10">
Expand Down
3 changes: 1 addition & 2 deletions infrastructure/control-panel/src/routes/+page.svelte
Original file line numberDiff line numberDiff line change
Expand Up@@ -463,8 +463,7 @@
</script>

{#snippet ENameWithType(value: unknown)}
{@const item =
(value as { ename?: string; type?: 'user' | 'group' } | null) ?? null}
{@const item = (value as { ename?: string; type?: 'user' | 'group' } | null) ?? null}
{@const ename = item?.ename || 'N/A'}
{@const type = item?.type || 'group'}
<div class="flex items-center gap-2 whitespace-nowrap">
Expand Down
14 changes: 7 additions & 7 deletions infrastructure/control-panel/src/routes/api/auth/+server.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,13 +19,10 @@ type VerifySignatureOutput = {
};

const require = createRequire(import.meta.url);
let verifySignatureFn:
| ((options: VerifySignatureInput) => Promise<VerifySignatureOutput>)
| null = null;
let verifySignatureFn: ((options: VerifySignatureInput) => Promise<VerifySignatureOutput>) | null =
null;

async function verifyW3dsSignature(
options: VerifySignatureInput
): Promise<VerifySignatureOutput> {
async function verifyW3dsSignature(options: VerifySignatureInput): Promise<VerifySignatureOutput> {
if (!verifySignatureFn) {
const signatureValidator = require('signature-validator') as {
verifySignature: (input: VerifySignatureInput) => Promise<VerifySignatureOutput>;
Expand DownExpand Up@@ -82,7 +79,10 @@ export const POST: RequestHandler = async ({ request, cookies }) => {
const registryBaseUrl = env.PUBLIC_REGISTRY_URL;
if (!registryBaseUrl) {
console.error('[auth] Missing PUBLIC_REGISTRY_URL');
publishAuthSessionResult(session, { status: 'error', message: 'Server not configured' });
publishAuthSessionResult(session, {
status: 'error',
message: 'Server not configured'
});
return json({ error: 'Server configuration error' }, { status: 500 });
}
console.info('[auth] Verifying signature', {
Expand Down
11 changes: 7 additions & 4 deletions infrastructure/control-panel/src/routes/api/evaults/+server.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -110,8 +110,12 @@ async function resolveVaultIdentity(
return {
type: 'user',
name:
firstNonEmptyString(userProfile.displayName, userProfile.username, vault.ename, vault.evault) ||
defaultName
firstNonEmptyString(
userProfile.displayName,
userProfile.username,
vault.ename,
vault.evault
) || defaultName
};
}

Expand All@@ -128,8 +132,7 @@ async function resolveVaultIdentity(
groupManifest.ename,
vault.ename,
vault.evault
) ||
defaultName
) || defaultName
};
}

Expand Down
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
import { json } from '@sveltejs/kit';
import type { RequestHandler } from '@sveltejs/kit';
import {
getDevicesWithTokens,
sendBulkNotifications
} from '$lib/services/notificationService';
import { getDevicesWithTokens, sendBulkNotifications } from '$lib/services/notificationService';

export const POST: RequestHandler = async ({ request }) => {
try {
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,7 +8,10 @@ export const POST: RequestHandler = async ({ request }) => {
const { tokens, platform, payload } = body;

if (!Array.isArray(tokens) || tokens.length === 0) {
return json({ success: false, error: 'tokens must be a non-empty array' }, { status: 400 });
return json(
{ success: false, error: 'tokens must be a non-empty array' },
{ status: 400 }
);
}
if (!payload?.title || !payload?.body) {
return json(
Expand Down
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
import { json } from '@sveltejs/kit';
import type { RequestHandler } from '@sveltejs/kit';
import {
getDevicesByEName,
sendBulkNotifications
} from '$lib/services/notificationService';
import { getDevicesByEName, sendBulkNotifications } from '$lib/services/notificationService';

export const POST: RequestHandler = async ({ request }) => {
try {
const body = await request.json();
const { eName, payload } = body;

if (!eName || typeof eName !== 'string' || !eName.trim()) {
return json(
{ success: false, error: 'Missing or invalid eName' },
{ status: 400 }
);
return json({ success: false, error: 'Missing or invalid eName' }, { status: 400 });
}
if (!payload?.title || !payload?.body) {
return json(
Expand Down
10 changes: 7 additions & 3 deletions infrastructure/control-panel/src/routes/login/+page.svelte
Original file line numberDiff line numberDiff line change
Expand Up@@ -129,8 +129,8 @@
<div class="w-full rounded-xl border border-gray-200 bg-white p-8 shadow-sm">
<h1 class="text-2xl font-semibold text-gray-900">Control Panel Login</h1>
<p class="mt-2 text-sm text-gray-600">
Authenticate with your eID Wallet. Only admin eNames in the server allowlist can access this
panel.
Authenticate with your eID Wallet. Only admin eNames in the server allowlist can access
this panel.
</p>

{#if error}
Expand All@@ -155,7 +155,11 @@
Tap to open the wallet app and complete authentication.
</p>
{:else}
<img src={qrDataUrl} alt="W3DS auth QR code" class="h-64 w-64 rounded-lg bg-white p-2" />
<img
src={qrDataUrl}
alt="W3DS auth QR code"
class="h-64 w-64 rounded-lg bg-white p-2"
/>
<p class="text-center text-sm text-gray-600">
Scan this QR code with your eID Wallet app.
</p>
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -654,7 +654,9 @@
</div>
{:else}
<section class="flex h-[calc(100vh-180px)] w-full min-w-0 gap-4">
<div class="bg-gray flex min-w-0 flex-1 flex-col overflow-hidden rounded-lg border border-gray-200">
<div
class="bg-gray flex min-w-0 flex-1 flex-col overflow-hidden rounded-lg border border-gray-200"
>
<div class="z-10 flex w-full items-center justify-between bg-white p-4">
<div>
<h4 class="text-xl font-semibold text-gray-800">Live Monitoring</h4>
Expand Down
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
password=$th3r3a1m3ru1
keyAlias=key0
storeFile=/home/merul/Stuff/msf-android-keys/Untitled
11 changes: 10 additions & 1 deletion infrastructure/eid-wallet/src/lib/utils/socialBinding.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -296,6 +296,8 @@ export async function createSocialConnectionDoc(
subject: string,
subjectName: string,
signatureHash: string,
parties: [string, string],
relationDescription: string,
): Promise<string> {
const normalizedSubject = subject.startsWith("@") ? subject : `@${subject}`;
const normalizedSigner = signerEname.startsWith("@")
Expand All@@ -310,7 +312,14 @@ export async function createSocialConnectionDoc(
input: {
subject: normalizedSubject,
type: "social_connection",
data: { kind: "social_connection", name: subjectName },
data: {
kind: "social_connection",
name: subjectName,
parties: parties.map((p) =>
p.startsWith("@") ? p : `@${p}`,
) as [string, string],
relation_description: relationDescription,
},
ownerSignature: {
signer: normalizedSigner,
signature: signatureHash,
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -733,6 +733,14 @@ onMount(async () => {
</p>
{/if}
</div>
{#if typeof socialBindingPendingDocParsed?.data?.relation_description === "string" && socialBindingPendingDocParsed.data.relation_description}
<div class="bg-gray rounded-2xl p-4 flex flex-col gap-1">
<p class="small text-black-500">Relationship Description</p>
<p class="text-sm text-black-700">
{socialBindingPendingDocParsed.data.relation_description}
</p>
</div>
{/if}
{#if socialBindingError}
<p class="text-danger">{socialBindingError}</p>
{/if}
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -49,6 +49,7 @@ const {
socialBindingLoading,
socialBindingError,
socialBindingSuccess,
socialBindingRelationDescription,
} = stores;

const {
Expand DownExpand Up@@ -266,9 +267,11 @@ function handleSocialBindingOpenChange(value: boolean) {
loading={$socialBindingLoading}
error={$socialBindingError}
success={$socialBindingSuccess}
relationDescription={$socialBindingRelationDescription}
onConfirm={handleSocialBindingConfirm}
onDecline={handleSocialBindingDecline}
onOpenChange={handleSocialBindingOpenChange}
onDescriptionChange={(value) => socialBindingRelationDescription.set(value)}
/>

<style>
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,9 +10,11 @@ export let requesterName: string | null;
export let loading: boolean;
export let error: string | null;
export let success: boolean;
export let relationDescription: string;
export let onConfirm: () => void;
export let onDecline: () => void;
export let onOpenChange: (value: boolean) => void;
export let onDescriptionChange: (value: string) => void;

let internalOpen = isOpen;
let lastReportedOpen = internalOpen;
Expand DownExpand Up@@ -123,6 +125,23 @@ $: displayName = requesterName ?? requesterEname ?? "Unknown";
</table>
</div>

<div class="w-full mt-4">
<label
for="relation-description"
class="text-xs font-semibold text-black-500 uppercase tracking-wider block mb-1"
>
Relationship Description
</label>
<textarea
id="relation-description"
class="w-full rounded-xl border border-gray-200 bg-gray-50 p-3 text-sm text-black-700 resize-none focus:outline-none focus:border-primary"
rows="3"
placeholder="Describe how you know this person..."
value={relationDescription}
oninput={(e) => onDescriptionChange(e.currentTarget.value)}
></textarea>
</div>

{#if error}
<div
class="bg-red-50 border border-red-200 rounded-lg p-4 mt-4 w-full text-sm text-red-700"
Expand Down
Loading