Skip to content

Commit f34c980

Browse files
रुद्राक्ष अवतारJaydatt Khodaveascorbic
authored
fix(pds): serve atproto-did for custom handles (#152)
* fix(pds): update @atcute/identity to 1.1.4 * fix(pds): serve atproto-did for custom handles * test(pds): use fixture env in atproto-did test The per-call env arg to worker.fetch doesn't override miniflare's configured bindings, so the test was reading did:web:pds.test from the fixture. The fixture already has HANDLE != PDS_HOSTNAME, so it exercises the bug scenario directly. --------- Co-authored-by: Jaydatt Khodave <249572022+rudraksha-avatara@users.noreply.github.com> Co-authored-by: Matt Kane <m@mk.gg>
1 parent d1a7074 commit f34c980

2 files changed

Lines changed: 17 additions & 4 deletions

File tree

packages/pds/src/index.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,7 @@ app.get("/.well-known/did.json", (c) => {
135135
});
136136

137137
// Handle verification for AT Protocol
138-
// Only served if handle matches PDS hostname
139138
app.get("/.well-known/atproto-did", (c) => {
140-
if (c.env.HANDLE !== c.env.PDS_HOSTNAME) {
141-
return c.notFound();
142-
}
143139
return new Response(c.env.DID, {
144140
headers: { "Content-Type": "text/plain" },
145141
});
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { describe, expect, it } from "vitest";
2+
import { env, worker } from "./helpers";
3+
4+
describe("well-known endpoints", () => {
5+
it("serves atproto-did even when handle differs from PDS hostname", async () => {
6+
expect(env.HANDLE).not.toBe(env.PDS_HOSTNAME);
7+
8+
const response = await worker.fetch(
9+
new Request(`http://${env.PDS_HOSTNAME}/.well-known/atproto-did`),
10+
env,
11+
);
12+
13+
expect(response.status).toBe(200);
14+
expect(await response.text()).toBe(env.DID);
15+
expect(response.headers.get("Content-Type")).toContain("text/plain");
16+
});
17+
});

0 commit comments

Comments
 (0)