-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from planetary-social/fix_underscore_name_with…
…_root_domain Fix underscore name for a root domain
- Loading branch information
Showing
4 changed files
with
61 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -261,6 +261,12 @@ describe("Nostr NIP 05 API tests", () => { | |
.send(userData) | ||
.expect(200); | ||
|
||
await request(app) | ||
.get("/.well-known/webfinger") | ||
.set("Host", "nos.social") | ||
.query({ resource: "acctWRONG:[email protected]" }) | ||
.expect(422); | ||
|
||
const getResponse = await request(app) | ||
.get("/.well-known/webfinger") | ||
.set("Host", "nos.social") | ||
|
@@ -302,6 +308,36 @@ describe("Nostr NIP 05 API tests", () => { | |
}); | ||
}); | ||
|
||
it("should store and retrieve Nostr NIP 05 data through an empty subdomain", async () => { | ||
const userData = createUserPayload({ name: "_" }); | ||
|
||
await request(app) | ||
.post("/api/names") | ||
.set("Host", "nos.social") | ||
.set("Authorization", `Nostr ${nip98PostAuthToken}`) | ||
.send(userData) | ||
.expect(200); | ||
|
||
const getResponse = await request(app) | ||
.get("/.well-known/nostr.json") | ||
.set("Host", "nos.social") | ||
.query({ name: "_" }) | ||
.expect(200); | ||
|
||
const jsonResponse = JSON.parse(getResponse.text); | ||
|
||
expect(jsonResponse).toEqual({ | ||
names: { _: config.servicePubkey }, | ||
relays: { | ||
[config.servicePubkey]: [ | ||
"wss://relay1.com", | ||
"wss://relay2.com", | ||
"wss://relay.nos.social", | ||
], | ||
}, | ||
}); | ||
}); | ||
|
||
it("should not use components of the root domain as a subdomain", async () => { | ||
const userData = createUserPayload({ name: "nos" }); | ||
|
||
|