decentralised sync engine

Compare changes

Choose any two refs to compare.

Changed files
+6 -3
src
+1 -1
src/lib/env.ts
···
"Environment variable SERVICE_DID not set. Defaulting to `did:web:localhost`",
);
}
-
export const SERVICE_DID = serviceDidParsed ?? "did:web:localhost";
+
export const SERVICE_DID = serviceDidParsed ?? `did:web:localhost%3A${SERVER_PORT.toString()}`;
const constellationUrl = process.env.CONSTELLATION_URL;
let constellationUrlParsed: URL | undefined;
+5 -2
src/lib/handlers/latticeHandshake.ts
···
-
import { SERVICE_DID } from "@/lib/env";
+
import { SERVER_PORT, SERVICE_DID } from "@/lib/env";
import { issueNewLatticeToken } from "@/lib/sessions";
import { shardSessions } from "@/lib/state";
import { HttpGeneralErrorType } from "@/lib/types/http/errors";
···
// FIXME: this also assumes that the requesting lattice's DID is a did:web
// see below for the rest of the issues.
-
if (routeThroughUri.rKey !== SERVICE_DID.slice(8)) {
+
let thisLatticeDomain = SERVICE_DID.slice(8);
+
if (thisLatticeDomain === "localhost")
+
thisLatticeDomain = `localhost:${SERVER_PORT.toString()}`;
+
if (routeThroughUri.rKey !== thisLatticeDomain) {
errors.push(
"Mismatch between claimant lattice and channel routeThrough. Request wants to validate for",
routeThroughUri.rKey,