Skip to content
Open
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 packages/pds/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@atcute/cbor": "^2.2.8",
"@atcute/cid": "^2.3.0",
"@atcute/client": "^4.2.0",
"@atcute/identity": "^1.1.3",
"@atcute/identity": "^1.1.4",
"@atcute/identity-resolver": "^1.2.2",
"@atcute/lexicons": "^1.2.6",
"@atcute/tid": "^1.1.1",
Expand Down
4 changes: 0 additions & 4 deletions packages/pds/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,7 @@ app.get("/.well-known/did.json", (c) => {
});

// Handle verification for AT Protocol
// Only served if handle matches PDS hostname
app.get("/.well-known/atproto-did", (c) => {
if (c.env.HANDLE !== c.env.PDS_HOSTNAME) {
return c.notFound();
}
return new Response(c.env.DID, {
headers: { "Content-Type": "text/plain" },
});
Expand Down
28 changes: 28 additions & 0 deletions packages/pds/test/well-known.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { describe, expect, it } from "vitest";
import { worker } from "./helpers";

describe("well-known endpoints", () => {
it("serves atproto-did even when handle differs from PDS hostname", async () => {
const response = await worker.fetch(
new Request("http://pds.test/.well-known/atproto-did"),
{
DID: "did:web:domain.com",
HANDLE: "domain.com",
PDS_HOSTNAME: "pds.domain.com",
AUTH_TOKEN: "test-token",
SIGNING_KEY:
"e5b452e70de7fb7864fdd7f0d67c6dbd0f128413a1daa1b2b8a871e906fc90cc",
SIGNING_KEY_PUBLIC:
"zQ3shbUq6umkAhwsxEXj6fRZ3ptBtF5CNZbAGoKjvFRatUkVY",
JWT_SECRET: "test-jwt-secret-at-least-32-chars-long",
PASSWORD_HASH:
"$2b$10$B6MKXNJ33Co3RoIVYAAvvO3jImuMiqL1T1YnFDN7E.hTZLtbB4SW6",
INITIAL_ACTIVE: "true",
},
);

expect(response.status).toBe(200);
expect(await response.text()).toBe("did:web:domain.com");
expect(response.headers.get("Content-Type")).toContain("text/plain");
});
});
18 changes: 9 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.