diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5de893e..9667309 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,17 +1,12 @@ version: 2 -# Private registries used by Dependabot registries: maven-releases: type: maven-repository url: https://maven.398ja.xyz/releases - username: ${{secrets.MVN_USER}} - password: ${{secrets.MVN_PASSWORD}} maven-snapshots: type: maven-repository url: https://maven.398ja.xyz/snapshots - username: ${{secrets.MVN_USER}} - password: ${{secrets.MVN_PASSWORD}} updates: - package-ecosystem: "maven" @@ -20,6 +15,9 @@ updates: interval: "weekly" open-pull-requests-limit: 5 target-branch: "develop" + registries: + - maven-releases + - maven-snapshots - package-ecosystem: "github-actions" directory: "/" schedule: diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..776cc7d --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,48 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [0.2.0] - 2026-01-30 + +### Added +- Docker image build bound to Maven deploy phase for streamlined CI/CD +- E2E testing documentation and architecture guide +- CI configuration with build and test jobs + +### Changed +- Domain verification now uses `_nostr-verification` naming for better protocol alignment +- Admin UI shows both DNS and Well-Known verification options without method selection +- Verification attempts both DNS and Well-Known methods automatically +- Auto-generates verification token when viewing unverified domains +- Updated nostr-java dependency to 1.3.0 +- Removed nsecbunker-account dependency from bottin-core + +### Fixed +- SecurityFilterChain conflict in E2E tests +- Qodana security findings addressed +- CI workflow fixes for google-java-format and Maven wrapper +- Admin credentials now properly use environment variables +- Fixed 500 error when viewing domains list + +### Security +- Removed credentials from dependabot registry configuration + +## [0.1.0] - 2025-01-15 + +### Added +- Initial release of Bottin NIP-05 Registry Service +- REST API for NIP-05 record management +- Admin dashboard with domain and record management +- Domain verification via DNS TXT and Well-Known file methods +- PostgreSQL and H2 database support +- Spring Boot starter for easy integration +- Docker support with Jib + +[Unreleased]: https://github.com/tcheeric/bottin/compare/v0.2.0...HEAD +[0.2.0]: https://github.com/tcheeric/bottin/compare/v0.1.0...v0.2.0 +[0.1.0]: https://github.com/tcheeric/bottin/releases/tag/v0.1.0 diff --git a/README.md b/README.md index 1497783..291ad17 100644 --- a/README.md +++ b/README.md @@ -100,16 +100,16 @@ bottin: ### Method 1: DNS TXT Record 1. Register domain via API or admin dashboard -2. Add TXT record to `_bottin-verification.yourdomain.com`: +2. Add TXT record to `_nostr-verification.yourdomain.com`: ``` - bottin-verification= + nostr-verification= ``` 3. Trigger verification check (DNS propagation may take up to 24 hours) ### Method 2: Well-Known File 1. Register domain via API or admin dashboard -2. Create file at `https://yourdomain.com/.well-known/bottin-verification.txt` +2. Create file at `https://yourdomain.com/.well-known/nostr-verification.txt` 3. Add the exact verification token as file contents 4. Trigger verification check @@ -222,5 +222,5 @@ MIT License - see LICENSE file for details. ## Related Projects -- [nsecbunker-java](https://github.com/tcheeric/nsecbunker-java) - Key management +- [nsecbunker-java](https://github.com/398ja/nsecbunker-java) - Key management - [nostr-java](https://github.com/tcheeric/nostr-java) - Nostr protocol library diff --git a/bottin-admin-ui/pom.xml b/bottin-admin-ui/pom.xml index 74cb1ae..a8969f7 100644 --- a/bottin-admin-ui/pom.xml +++ b/bottin-admin-ui/pom.xml @@ -8,7 +8,7 @@ xyz.tcheeric bottin - 0.1.0 + 0.2.0 bottin-admin-ui diff --git a/bottin-admin-ui/src/main/java/xyz/tcheeric/bottin/admin/controller/AdminDomainsController.java b/bottin-admin-ui/src/main/java/xyz/tcheeric/bottin/admin/controller/AdminDomainsController.java index e9d5288..cec4c6c 100644 --- a/bottin-admin-ui/src/main/java/xyz/tcheeric/bottin/admin/controller/AdminDomainsController.java +++ b/bottin-admin-ui/src/main/java/xyz/tcheeric/bottin/admin/controller/AdminDomainsController.java @@ -55,6 +55,13 @@ public String listDomains( public String viewDomain(@PathVariable Long id, Model model) { return domainService.findById(id) .map(domain -> { + // Auto-initiate verification for unverified domains without a token + if (!domain.isVerified() && domain.getVerificationToken() == null) { + verificationService.initiateVerification(id); + // Reload domain to get the new token + domain = domainService.findById(id).orElse(domain); + } + VerificationStatus status = verificationService.getVerificationStatus(id); model.addAttribute("domain", domain); model.addAttribute("verificationStatus", status); diff --git a/bottin-admin-ui/src/main/resources/templates/admin/domain-detail.html b/bottin-admin-ui/src/main/resources/templates/admin/domain-detail.html index 2135496..7271d17 100644 --- a/bottin-admin-ui/src/main/resources/templates/admin/domain-detail.html +++ b/bottin-admin-ui/src/main/resources/templates/admin/domain-detail.html @@ -91,81 +91,45 @@

Domain Information

Domain Verification

-
-

- Current method: DNS_TXT -

- - -
-

DNS TXT Record

-

Add a TXT record to your DNS:

-
-

Name:

- _bottin-verification.example.com -

Value:

- bottin-verification=token-here -
-
+

+ Complete one of the following methods to verify domain ownership: +

- -
-

Well-Known File

-

Create a file at this URL:

-
- - https://example.com/.well-known/bottin-verification.txt - -

With content:

- token-here -
+ +
+

Option 1: DNS TXT Record

+

Add a TXT record to your DNS:

+
+

Name:

+ _nostr-verification.example.com +

Value:

+ nostr-verification=token-here
+
-
-
- -
- -

or change verification method:

-
- - -
+ +
+

Option 2: Well-Known File

+

Create a file at this URL:

+
+ + https://example.com/.well-known/nostr-verification.txt + +

With content:

+ token-here
-
-

- Choose a verification method to prove ownership of this domain. -

-
-
- - -
- -
-
+ +
+ +
diff --git a/bottin-core/pom.xml b/bottin-core/pom.xml index 2dfa523..89d091c 100644 --- a/bottin-core/pom.xml +++ b/bottin-core/pom.xml @@ -8,7 +8,7 @@ xyz.tcheeric bottin - 0.1.0 + 0.2.0 bottin-core diff --git a/bottin-core/src/main/java/xyz/tcheeric/bottin/core/exception/VerificationFailedException.java b/bottin-core/src/main/java/xyz/tcheeric/bottin/core/exception/VerificationFailedException.java index d2dfd60..cd5a2c2 100644 --- a/bottin-core/src/main/java/xyz/tcheeric/bottin/core/exception/VerificationFailedException.java +++ b/bottin-core/src/main/java/xyz/tcheeric/bottin/core/exception/VerificationFailedException.java @@ -7,9 +7,9 @@ public class VerificationFailedException extends BottinException { private static final String ERROR_CODE = "VERIFICATION_FAILED"; private static final String DNS_SUGGESTION = - "Ensure the DNS TXT record '_bottin-verification.{domain}' contains the verification token. DNS propagation may take up to 24 hours."; + "Ensure the DNS TXT record '_nostr-verification.{domain}' contains the verification token. DNS propagation may take up to 24 hours."; private static final String WELLKNOWN_SUGGESTION = - "Ensure the file at 'https://{domain}/.well-known/bottin-verification.txt' contains the exact verification token."; + "Ensure the file at 'https://{domain}/.well-known/nostr-verification.txt' contains the exact verification token."; public VerificationFailedException(String domain, String method, String reason) { super(ERROR_CODE, true, diff --git a/bottin-core/src/main/java/xyz/tcheeric/bottin/core/model/VerificationChallenge.java b/bottin-core/src/main/java/xyz/tcheeric/bottin/core/model/VerificationChallenge.java index af784c5..ea145e0 100644 --- a/bottin-core/src/main/java/xyz/tcheeric/bottin/core/model/VerificationChallenge.java +++ b/bottin-core/src/main/java/xyz/tcheeric/bottin/core/model/VerificationChallenge.java @@ -48,7 +48,7 @@ public class VerificationChallenge { */ public static VerificationChallenge forDnsTxt(String domain, String token, Instant expiresAt) { String instructions = String.format( - "Add a TXT record to _bottin-verification.%s with value: bottin-verification=%s", + "Add a TXT record to _nostr-verification.%s with value: nostr-verification=%s", domain, token); return VerificationChallenge.builder() .domain(domain) @@ -65,7 +65,7 @@ public static VerificationChallenge forDnsTxt(String domain, String token, Insta */ public static VerificationChallenge forWellKnown(String domain, String token, Instant expiresAt) { String instructions = String.format( - "Create a file at https://%s/.well-known/bottin-verification.txt with content: %s", + "Create a file at https://%s/.well-known/nostr-verification.txt with content: %s", domain, token); return VerificationChallenge.builder() .domain(domain) @@ -88,6 +88,6 @@ public boolean isExpired() { * Returns the full verification value for DNS TXT records. */ public String getDnsTxtValue() { - return "bottin-verification=" + token; + return "nostr-verification=" + token; } } diff --git a/bottin-core/src/main/java/xyz/tcheeric/bottin/core/model/VerificationMethod.java b/bottin-core/src/main/java/xyz/tcheeric/bottin/core/model/VerificationMethod.java index b367bd0..9739d5d 100644 --- a/bottin-core/src/main/java/xyz/tcheeric/bottin/core/model/VerificationMethod.java +++ b/bottin-core/src/main/java/xyz/tcheeric/bottin/core/model/VerificationMethod.java @@ -7,15 +7,15 @@ public enum VerificationMethod { /** * DNS TXT record verification. - * User adds a TXT record to _bottin-verification.{domain} with the verification token. + * User adds a TXT record to _nostr-verification.{domain} with the verification token. */ - DNS_TXT("DNS TXT Record", "_bottin-verification.{domain}"), + DNS_TXT("DNS TXT Record", "_nostr-verification.{domain}"), /** * Well-known file verification. - * User creates a file at https://{domain}/.well-known/bottin-verification.txt + * User creates a file at https://{domain}/.well-known/nostr-verification.txt */ - WELL_KNOWN_FILE("Well-Known File", "/.well-known/bottin-verification.txt"); + WELL_KNOWN_FILE("Well-Known File", "/.well-known/nostr-verification.txt"); private final String displayName; private final String location; diff --git a/bottin-persistence/pom.xml b/bottin-persistence/pom.xml index e0cbe84..1499f39 100644 --- a/bottin-persistence/pom.xml +++ b/bottin-persistence/pom.xml @@ -8,7 +8,7 @@ xyz.tcheeric bottin - 0.1.0 + 0.2.0 bottin-persistence diff --git a/bottin-service/pom.xml b/bottin-service/pom.xml index 58e370f..3e55090 100644 --- a/bottin-service/pom.xml +++ b/bottin-service/pom.xml @@ -8,7 +8,7 @@ xyz.tcheeric bottin - 0.1.0 + 0.2.0 bottin-service diff --git a/bottin-spring-boot-starter/pom.xml b/bottin-spring-boot-starter/pom.xml index 0d51e8b..91313a1 100644 --- a/bottin-spring-boot-starter/pom.xml +++ b/bottin-spring-boot-starter/pom.xml @@ -8,7 +8,7 @@ xyz.tcheeric bottin - 0.1.0 + 0.2.0 bottin-spring-boot-starter diff --git a/bottin-tests/bottin-e2e/pom.xml b/bottin-tests/bottin-e2e/pom.xml index 006bfd0..209f3a9 100644 --- a/bottin-tests/bottin-e2e/pom.xml +++ b/bottin-tests/bottin-e2e/pom.xml @@ -8,7 +8,7 @@ xyz.tcheeric bottin-tests - 0.1.0 + 0.2.0 bottin-e2e diff --git a/bottin-tests/bottin-it/pom.xml b/bottin-tests/bottin-it/pom.xml index acf08c8..b4206ed 100644 --- a/bottin-tests/bottin-it/pom.xml +++ b/bottin-tests/bottin-it/pom.xml @@ -8,7 +8,7 @@ xyz.tcheeric bottin-tests - 0.1.0 + 0.2.0 bottin-it diff --git a/bottin-tests/pom.xml b/bottin-tests/pom.xml index 3ce1c5a..22d9059 100644 --- a/bottin-tests/pom.xml +++ b/bottin-tests/pom.xml @@ -8,7 +8,7 @@ xyz.tcheeric bottin - 0.1.0 + 0.2.0 bottin-tests diff --git a/bottin-verification/pom.xml b/bottin-verification/pom.xml index c0e6d56..4e76c81 100644 --- a/bottin-verification/pom.xml +++ b/bottin-verification/pom.xml @@ -8,7 +8,7 @@ xyz.tcheeric bottin - 0.1.0 + 0.2.0 bottin-verification diff --git a/bottin-verification/src/main/java/xyz/tcheeric/bottin/verification/DnsVerificationService.java b/bottin-verification/src/main/java/xyz/tcheeric/bottin/verification/DnsVerificationService.java index e8c3352..6dbf54a 100644 --- a/bottin-verification/src/main/java/xyz/tcheeric/bottin/verification/DnsVerificationService.java +++ b/bottin-verification/src/main/java/xyz/tcheeric/bottin/verification/DnsVerificationService.java @@ -16,15 +16,15 @@ /** * Service for verifying domain ownership via DNS TXT records. * - *

Looks for a TXT record at {@code _bottin-verification.} containing + *

Looks for a TXT record at {@code _nostr-verification.} containing * the expected verification token. */ @Service @Slf4j public class DnsVerificationService { - private static final String TXT_RECORD_PREFIX = "_bottin-verification."; - private static final String TOKEN_PREFIX = "bottin-verification="; + private static final String TXT_RECORD_PREFIX = "_nostr-verification."; + private static final String TOKEN_PREFIX = "nostr-verification="; @Value("${bottin.verification.dns.timeout-seconds:10}") private int timeoutSeconds; diff --git a/bottin-verification/src/main/java/xyz/tcheeric/bottin/verification/DomainVerificationService.java b/bottin-verification/src/main/java/xyz/tcheeric/bottin/verification/DomainVerificationService.java index e271f3f..d11d649 100644 --- a/bottin-verification/src/main/java/xyz/tcheeric/bottin/verification/DomainVerificationService.java +++ b/bottin-verification/src/main/java/xyz/tcheeric/bottin/verification/DomainVerificationService.java @@ -27,11 +27,23 @@ public class DomainVerificationService { private final DnsVerificationService dnsVerificationService; private final WellKnownVerificationService wellKnownVerificationService; + /** + * Initiates verification for a domain, generating a token if needed. + * Does not require a specific method since both DNS and Well-Known are supported. + * + * @param domainId the domain ID + * @return the verification challenge with setup instructions + */ + @Transactional + public VerificationChallenge initiateVerification(Long domainId) { + return initiateVerification(domainId, VerificationMethod.DNS_TXT); + } + /** * Initiates verification for a domain using the specified method. * * @param domainId the domain ID - * @param method the verification method to use + * @param method the verification method to use (stored for logging purposes) * @return the verification challenge with setup instructions */ @Transactional @@ -70,7 +82,8 @@ public VerificationChallenge initiateVerification(Long domainId, VerificationMet } /** - * Attempts to verify a domain using its configured verification method. + * Attempts to verify a domain by trying both DNS and Well-Known methods. + * Succeeds if either method validates the token. * * @param domainId the domain ID * @return the verification result @@ -87,45 +100,60 @@ public VerificationResult attemptVerification(Long domainId) { ); } - if (domain.getVerificationToken() == null || domain.getVerificationMethod() == null) { + if (domain.getVerificationToken() == null) { return VerificationResult.failure( null, "Verification has not been initiated. Call initiate first." ); } - log.debug("domain_verification_attempt id={} name={} method={}", - domainId, domain.getName(), domain.getVerificationMethod()); + log.debug("domain_verification_attempt id={} name={}", domainId, domain.getName()); - VerificationResult result = switch (domain.getVerificationMethod()) { - case DNS_TXT -> dnsVerificationService.verify( - domain.getName(), - domain.getVerificationToken() - ); - case WELL_KNOWN_FILE -> wellKnownVerificationService.verify( - domain.getName(), - domain.getVerificationToken() - ); - }; + // Try DNS verification first + VerificationResult dnsResult = dnsVerificationService.verify( + domain.getName(), + domain.getVerificationToken() + ); - // Log the verification attempt - logVerificationAttempt(domain, result); - - if (result.isSuccess()) { - domain.setVerified(true); - domain.setVerifiedAt(Instant.now()); - domain.setVerificationToken(null); // Clear token after successful verification - domain.setUpdatedAt(Instant.now()); - domainRepository.save(domain); + if (dnsResult.isSuccess()) { + domain.setVerificationMethod(VerificationMethod.DNS_TXT); + logVerificationAttempt(domain, dnsResult); + markDomainVerified(domain); + log.info("domain_verified id={} name={} method=DNS_TXT", domainId, domain.getName()); + return dnsResult; + } - log.info("domain_verified id={} name={} method={}", - domainId, domain.getName(), domain.getVerificationMethod()); - } else { - log.debug("domain_verification_failed id={} name={} reason={}", - domainId, domain.getName(), result.getMessage()); + // Try Well-Known verification if DNS failed + VerificationResult wellKnownResult = wellKnownVerificationService.verify( + domain.getName(), + domain.getVerificationToken() + ); + + if (wellKnownResult.isSuccess()) { + domain.setVerificationMethod(VerificationMethod.WELL_KNOWN_FILE); + logVerificationAttempt(domain, wellKnownResult); + markDomainVerified(domain); + log.info("domain_verified id={} name={} method=WELL_KNOWN_FILE", domainId, domain.getName()); + return wellKnownResult; } - return result; + // Both methods failed + logVerificationAttempt(domain, dnsResult); + log.debug("domain_verification_failed id={} name={} dns_error={} wellknown_error={}", + domainId, domain.getName(), dnsResult.getMessage(), wellKnownResult.getMessage()); + + return VerificationResult.failure( + null, + "Verification failed. DNS: " + dnsResult.getMessage() + ". Well-Known: " + wellKnownResult.getMessage() + ); + } + + private void markDomainVerified(DomainEntity domain) { + domain.setVerified(true); + domain.setVerifiedAt(Instant.now()); + domain.setVerificationToken(null); + domain.setUpdatedAt(Instant.now()); + domainRepository.save(domain); } /** diff --git a/bottin-verification/src/main/java/xyz/tcheeric/bottin/verification/WellKnownVerificationService.java b/bottin-verification/src/main/java/xyz/tcheeric/bottin/verification/WellKnownVerificationService.java index 5c8809e..f0cd25b 100644 --- a/bottin-verification/src/main/java/xyz/tcheeric/bottin/verification/WellKnownVerificationService.java +++ b/bottin-verification/src/main/java/xyz/tcheeric/bottin/verification/WellKnownVerificationService.java @@ -13,14 +13,14 @@ /** * Service for verifying domain ownership via well-known file. * - *

Fetches {@code https:///.well-known/bottin-verification.txt} + *

Fetches {@code https:///.well-known/nostr-verification.txt} * and checks that it contains the expected verification token. */ @Service @Slf4j public class WellKnownVerificationService { - private static final String WELL_KNOWN_PATH = "/.well-known/bottin-verification.txt"; + private static final String WELL_KNOWN_PATH = "/.well-known/nostr-verification.txt"; private final WebClient webClient; diff --git a/bottin-verification/src/test/java/xyz/tcheeric/bottin/verification/DnsVerificationServiceTest.java b/bottin-verification/src/test/java/xyz/tcheeric/bottin/verification/DnsVerificationServiceTest.java index 0361ab8..e9120c0 100644 --- a/bottin-verification/src/test/java/xyz/tcheeric/bottin/verification/DnsVerificationServiceTest.java +++ b/bottin-verification/src/test/java/xyz/tcheeric/bottin/verification/DnsVerificationServiceTest.java @@ -68,7 +68,7 @@ void shouldGenerateInstructionsWithTxtRecordType() { } /** - * Tests that setup instructions include the bottin-verification prefix. + * Tests that setup instructions include the nostr-verification prefix. */ @Test void shouldGenerateInstructionsWithCorrectPrefix() { @@ -80,8 +80,8 @@ void shouldGenerateInstructionsWithCorrectPrefix() { String instructions = dnsVerificationService.getSetupInstructions(domain, token); // Assert: Instructions include the correct prefix for the record name - assertThat(instructions).contains("_bottin-verification.example.com"); - assertThat(instructions).contains("bottin-verification=testtoken123"); + assertThat(instructions).contains("_nostr-verification.example.com"); + assertThat(instructions).contains("nostr-verification=testtoken123"); } /** diff --git a/bottin-verification/src/test/java/xyz/tcheeric/bottin/verification/DomainVerificationServiceTest.java b/bottin-verification/src/test/java/xyz/tcheeric/bottin/verification/DomainVerificationServiceTest.java index 13bbb43..93b8d66 100644 --- a/bottin-verification/src/test/java/xyz/tcheeric/bottin/verification/DomainVerificationServiceTest.java +++ b/bottin-verification/src/test/java/xyz/tcheeric/bottin/verification/DomainVerificationServiceTest.java @@ -180,36 +180,41 @@ void shouldMarkDomainAsVerifiedOnDnsSuccess() { } /** - * Tests successful well-known verification updates domain state. + * Tests successful well-known verification updates domain state when DNS fails. */ @Test void shouldMarkDomainAsVerifiedOnWellKnownSuccess() { - // Arrange: Domain with pending well-known verification + // Arrange: Domain with pending verification, DNS fails but well-known succeeds testDomain.setVerificationToken("test-token"); testDomain.setVerificationMethod(VerificationMethod.WELL_KNOWN_FILE); when(domainRepository.findById(1L)).thenReturn(Optional.of(testDomain)); + when(dnsVerificationService.verify("example.com", "test-token")) + .thenReturn(VerificationResult.failure(VerificationMethod.DNS_TXT, "No record found")); when(wellKnownVerificationService.verify("example.com", "test-token")) .thenReturn(VerificationResult.success(VerificationMethod.WELL_KNOWN_FILE, "Success")); // Act: Attempt verification VerificationResult result = verificationService.attemptVerification(1L); - // Assert: Domain is marked as verified + // Assert: Domain is marked as verified via well-known assertThat(result.isSuccess()).isTrue(); assertThat(testDomain.isVerified()).isTrue(); + assertThat(testDomain.getVerificationMethod()).isEqualTo(VerificationMethod.WELL_KNOWN_FILE); } /** - * Tests failed verification does not change domain verified status. + * Tests failed verification does not change domain verified status when both methods fail. */ @Test void shouldNotUpdateDomainOnVerificationFailure() { - // Arrange: Domain with pending verification + // Arrange: Domain with pending verification, both methods fail testDomain.setVerificationToken("test-token"); testDomain.setVerificationMethod(VerificationMethod.DNS_TXT); when(domainRepository.findById(1L)).thenReturn(Optional.of(testDomain)); when(dnsVerificationService.verify("example.com", "test-token")) .thenReturn(VerificationResult.failure(VerificationMethod.DNS_TXT, "No record found")); + when(wellKnownVerificationService.verify("example.com", "test-token")) + .thenReturn(VerificationResult.failure(VerificationMethod.WELL_KNOWN_FILE, "File not found")); // Act: Attempt verification VerificationResult result = verificationService.attemptVerification(1L); diff --git a/bottin-verification/src/test/java/xyz/tcheeric/bottin/verification/WellKnownVerificationServiceTest.java b/bottin-verification/src/test/java/xyz/tcheeric/bottin/verification/WellKnownVerificationServiceTest.java index be7ed98..a3a5b60 100644 --- a/bottin-verification/src/test/java/xyz/tcheeric/bottin/verification/WellKnownVerificationServiceTest.java +++ b/bottin-verification/src/test/java/xyz/tcheeric/bottin/verification/WellKnownVerificationServiceTest.java @@ -47,7 +47,7 @@ void tearDown() { void shouldReturnSuccessWhenTokenMatches() { // Arrange: Mock server returns expected token String token = "test-token-123"; - wireMockServer.stubFor(get(urlEqualTo("/.well-known/bottin-verification.txt")) + wireMockServer.stubFor(get(urlEqualTo("/.well-known/nostr-verification.txt")) .willReturn(aResponse() .withStatus(200) .withBody(token))); @@ -69,7 +69,7 @@ void shouldReturnSuccessWhenTokenMatches() { void shouldSucceedWhenTokenHasTrailingWhitespace() { // Arrange: Mock server returns token with whitespace String token = "test-token-123"; - wireMockServer.stubFor(get(urlEqualTo("/.well-known/bottin-verification.txt")) + wireMockServer.stubFor(get(urlEqualTo("/.well-known/nostr-verification.txt")) .willReturn(aResponse() .withStatus(200) .withBody(" " + token + " \n"))); @@ -90,7 +90,7 @@ void shouldReturnFailureWhenTokenMismatch() { // Arrange: Mock server returns wrong token String expectedToken = "expected-token"; String actualToken = "wrong-token"; - wireMockServer.stubFor(get(urlEqualTo("/.well-known/bottin-verification.txt")) + wireMockServer.stubFor(get(urlEqualTo("/.well-known/nostr-verification.txt")) .willReturn(aResponse() .withStatus(200) .withBody(actualToken))); @@ -111,7 +111,7 @@ void shouldReturnFailureWhenTokenMismatch() { @Test void shouldReturnFailureWhenFileIsEmpty() { // Arrange: Mock server returns empty content - wireMockServer.stubFor(get(urlEqualTo("/.well-known/bottin-verification.txt")) + wireMockServer.stubFor(get(urlEqualTo("/.well-known/nostr-verification.txt")) .willReturn(aResponse() .withStatus(200) .withBody(""))); @@ -131,7 +131,7 @@ void shouldReturnFailureWhenFileIsEmpty() { @Test void shouldReturnFailureWhenFileNotFound() { // Arrange: Mock server returns 404 - wireMockServer.stubFor(get(urlEqualTo("/.well-known/bottin-verification.txt")) + wireMockServer.stubFor(get(urlEqualTo("/.well-known/nostr-verification.txt")) .willReturn(aResponse() .withStatus(404))); @@ -151,7 +151,7 @@ void shouldReturnFailureWhenFileNotFound() { @Test void shouldReturnFailureOnServerError() { // Arrange: Mock server returns 500 - wireMockServer.stubFor(get(urlEqualTo("/.well-known/bottin-verification.txt")) + wireMockServer.stubFor(get(urlEqualTo("/.well-known/nostr-verification.txt")) .willReturn(aResponse() .withStatus(500))); @@ -179,7 +179,7 @@ void shouldGenerateInstructionsWithCorrectUrl() { String instructions = verificationService.getSetupInstructions(domain, token); // Assert: Instructions contain the correct URL - assertThat(instructions).contains("https://example.com/.well-known/bottin-verification.txt"); + assertThat(instructions).contains("https://example.com/.well-known/nostr-verification.txt"); } /** @@ -205,7 +205,7 @@ void shouldGenerateInstructionsWithToken() { void shouldTruncateLongContentInErrorMessage() { // Arrange: Mock server returns very long content String longContent = "a".repeat(200); - wireMockServer.stubFor(get(urlEqualTo("/.well-known/bottin-verification.txt")) + wireMockServer.stubFor(get(urlEqualTo("/.well-known/nostr-verification.txt")) .willReturn(aResponse() .withStatus(200) .withBody(longContent))); diff --git a/bottin-web/pom.xml b/bottin-web/pom.xml index 7d0a5db..c23b81f 100644 --- a/bottin-web/pom.xml +++ b/bottin-web/pom.xml @@ -8,7 +8,7 @@ xyz.tcheeric bottin - 0.1.0 + 0.2.0 bottin-web diff --git a/pom.xml b/pom.xml index a48579f..d6d81e6 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ xyz.tcheeric bottin - 0.1.0 + 0.2.0 pom Bottin - NIP-05 Registry Service @@ -57,7 +57,7 @@ 0.1.0 - 1.2.0 + 1.3.0 10.10.0