decentralised message store

fix: handle localhost case

should we enforce it in the env var level instead?

serenity 1a19bfd9 c5a902f2

Changed files
+4 -2
src
+4 -2
src/lib/sessions.ts
···
import type { Result } from "@/lib/utils/result";
import type { AtUri, Did } from "@/lib/types/atproto";
import { atUriSchema, didSchema } from "@/lib/types/atproto";
-
import { SERVICE_DID } from "@/lib/env";
+
import { SERVER_PORT, SERVICE_DID } from "@/lib/env";
export const sessionInfoSchema = z.object({
id: z.string(),
···
hmac.update(`${token}:${sessionId}`);
const fingerprint = hmac.digest("hex");
-
const shardDid = SERVICE_DID;
+
const shardDid: Did = SERVICE_DID.includes("localhost")
+
? `${SERVICE_DID}%3A${SERVER_PORT.toString()}`
+
: SERVICE_DID;
return {
id: sessionId,