decentralised sync engine
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor: domain fallback

serenity be18c6f8 186f4ed3

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