diff --git a/packages/pds/package.json b/packages/pds/package.json index 71e47ca..4a25135 100644 --- a/packages/pds/package.json +++ b/packages/pds/package.json @@ -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", diff --git a/packages/pds/src/index.ts b/packages/pds/src/index.ts index 04625ed..eb75f09 100644 --- a/packages/pds/src/index.ts +++ b/packages/pds/src/index.ts @@ -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" }, }); diff --git a/packages/pds/test/well-known.test.ts b/packages/pds/test/well-known.test.ts new file mode 100644 index 0000000..ae6f54a --- /dev/null +++ b/packages/pds/test/well-known.test.ts @@ -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"); + }); +}); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0555f94..5373f3b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -120,11 +120,11 @@ importers: specifier: ^4.2.0 version: 4.2.1 '@atcute/identity': - specifier: ^1.1.3 - version: 1.1.3 + specifier: ^1.1.4 + version: 1.1.4 '@atcute/identity-resolver': specifier: ^1.2.2 - version: 1.2.2(@atcute/identity@1.1.3) + version: 1.2.2(@atcute/identity@1.1.4) '@atcute/lexicons': specifier: ^1.2.6 version: 1.2.7 @@ -257,8 +257,8 @@ packages: peerDependencies: '@atcute/identity': ^1.0.0 - '@atcute/identity@1.1.3': - resolution: {integrity: sha512-oIqPoI8TwWeQxvcLmFEZLdN2XdWcaLVtlm8pNk0E72As9HNzzD9pwKPrLr3rmTLRIoULPPFmq9iFNsTeCIU9ng==} + '@atcute/identity@1.1.4': + resolution: {integrity: sha512-RCw1IqflfuSYCxK5m0lZCm0UnvIzcUnuhngiBhJEJb9a9Mc2SEf1xP3H8N5r8pvEH1LoAYd6/zrvCNU+uy9esw==} '@atcute/lexicons@1.2.7': resolution: {integrity: sha512-gCvkSMI1F1zx7xXa59iPiSKMH3L5Hga6iurGqQjaQbE2V/np/2QuDqQzt96TNbWfaFAXE9f9oY+0z3ljf/bweA==} @@ -2922,17 +2922,17 @@ snapshots: '@atcute/client@4.2.1': dependencies: - '@atcute/identity': 1.1.3 + '@atcute/identity': 1.1.4 '@atcute/lexicons': 1.2.7 - '@atcute/identity-resolver@1.2.2(@atcute/identity@1.1.3)': + '@atcute/identity-resolver@1.2.2(@atcute/identity@1.1.4)': dependencies: - '@atcute/identity': 1.1.3 + '@atcute/identity': 1.1.4 '@atcute/lexicons': 1.2.7 '@atcute/util-fetch': 1.0.5 '@badrap/valita': 0.4.6 - '@atcute/identity@1.1.3': + '@atcute/identity@1.1.4': dependencies: '@atcute/lexicons': 1.2.7 '@badrap/valita': 0.4.6