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
2 changes: 1 addition & 1 deletion docker-compose.databases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
environment:
- POSTGRES_USER=${POSTGRES_USER:-postgres}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-postgres}
- POSTGRES_MULTIPLE_DATABASES=registry,provisioner
- POSTGRES_MULTIPLE_DATABASES=registry,provisioner,evoting
volumes:
- postgres_data:/var/lib/postgresql/data
- ./db/init-multiple-databases.sh:/docker-entrypoint-initdb.d/init-multiple-databases.sh
Expand Down
27 changes: 21 additions & 6 deletions infrastructure/dev-sandbox/src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,11 @@
if (text) {
w3dsInput = text.trim();
actionError = null;
addLog("info", "Decoded QR", text.slice(0, 50) + (text.length > 50 ? "…" : ""));
addLog(
"info",
"Decoded QR",
text.slice(0, 50) + (text.length > 50 ? "…" : ""),
);
} else {
qrDecodeError = "No QR code found in image.";
}
Expand All @@ -354,8 +358,8 @@
}

function handlePaste(e: ClipboardEvent) {
const item = Array.from(e.clipboardData?.items ?? []).find(
(it) => it.type.startsWith("image/"),
const item = Array.from(e.clipboardData?.items ?? []).find((it) =>
it.type.startsWith("image/"),
);
const file = item?.getAsFile();
if (file) {
Expand Down Expand Up @@ -428,21 +432,31 @@
} else {
const sessionId = url.searchParams.get("session") ?? "";
const redirectUri = url.searchParams.get("redirect_uri") ?? "";
const dataParam = url.searchParams.get("data") ?? "";
if (!sessionId || !redirectUri) {
actionError = "w3ds://sign needs session and redirect_uri.";
return;
}
// Decode base64 data if present, otherwise fallback to sessionId
let messageToSign = sessionId;
if (dataParam) {
try {
messageToSign = atob(dataParam);
} catch {
messageToSign = dataParam;
}
}
const signature = await signPayload({
cryptoAdapter: adapter,
keyId: selectedIdentity.keyId,
context: "onboarding",
payload: sessionId,
payload: messageToSign,
});
const body = {
sessionId,
signature,
w3id: selectedIdentity.w3id,
message: sessionId,
message: messageToSign,
};
const res = await fetch(redirectUri, {
method: "POST",
Expand Down Expand Up @@ -578,7 +592,8 @@
<p>
Paste a <code>w3ds://auth</code> or
<code>w3ds://sign</code> URI (or HTTP URL with session/redirect_uri).
You can also upload or paste an image of a QR code to decode the request.
You can also upload or paste an image of a QR code to decode
the request.
</p>
<div class="w3ds-qr-actions">
<input
Expand Down
2 changes: 1 addition & 1 deletion platforms/evoting/api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { CronManagerService } from "./services/CronManagerService";
config({ path: path.resolve(__dirname, "../../../.env") });

const app = express();
const port = process.env.PORT || 4000;
const port = process.env.EVOTING_API_PORT || process.env.PORT || 4001;

// Initialize database connection and adapter
AppDataSource.initialize()
Expand Down
2 changes: 1 addition & 1 deletion platforms/registry/api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fs.watchFile(path.resolve(__dirname, "../motd.json"), (_curr, _prev) => {
motd = loadMotdJSON();
});

dotenv.config({ path: path.resolve(__dirname, "../../../.env") });
dotenv.config({ path: path.resolve(__dirname, "../../../../.env") });

const server = fastify({ logger: true });

Expand Down