From 1c0349b47f09f1b510e3229f04de9b014fba983b Mon Sep 17 00:00:00 2001 From: Mateusz Czeladka Date: Mon, 18 Sep 2023 11:05:20 +0200 Subject: [PATCH 1/7] Fix: ability to run voting-app from command line. --- .../voting-admin-app/build.gradle.kts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/backend-services/voting-admin-app/build.gradle.kts b/backend-services/voting-admin-app/build.gradle.kts index c13988310..50c635947 100644 --- a/backend-services/voting-admin-app/build.gradle.kts +++ b/backend-services/voting-admin-app/build.gradle.kts @@ -3,10 +3,11 @@ plugins { id("io.spring.dependency-management") version "1.1.3" id("org.graalvm.buildtools.native") version "0.9.27" id("com.github.ben-manes.versions") version "0.48.0" + id("org.springframework.boot") version "3.1.2" } group = "org.cardano.foundation" -version = "0.0.1-SNAPSHOT" +version = "1.0.0-SNAPSHOT" java.sourceCompatibility = JavaVersion.VERSION_17 configurations { @@ -17,12 +18,12 @@ configurations { repositories { mavenCentral() - mavenLocal() maven { url = uri("https://repo.spring.io/milestone") } } +extra["springShellVersion"] = "3.1.2" + dependencies { - implementation("org.springframework.boot:spring-boot-starter") implementation("org.springframework.shell:spring-shell-starter") testImplementation("org.springframework.boot:spring-boot-starter-test") @@ -32,9 +33,9 @@ dependencies { testCompileOnly("org.projectlombok:lombok:1.18.28") testAnnotationProcessor("org.projectlombok:lombok:1.18.28") - implementation("com.bloxbean.cardano:cardano-client-crypto:0.5.0-beta3") - implementation("com.bloxbean.cardano:cardano-client-address:0.5.0-beta3") - implementation("com.bloxbean.cardano:cardano-client-metadata:0.5.0-beta3") + implementation("com.bloxbean.cardano:cardano-client-crypto:0.5.0-beta3") + implementation("com.bloxbean.cardano:cardano-client-address:0.5.0-beta3") + implementation("com.bloxbean.cardano:cardano-client-metadata:0.5.0-beta3") implementation("com.bloxbean.cardano:cardano-client-quicktx:0.5.0-beta3") implementation("com.bloxbean.cardano:cardano-client-backend-blockfrost:0.5.0-beta3") implementation("com.bloxbean.cardano:cardano-client-cip30:0.5.0-beta3") @@ -47,7 +48,7 @@ dependencies { dependencyManagement { imports { - mavenBom("org.springframework.shell:spring-shell-dependencies:3.1.3") + mavenBom("org.springframework.shell:spring-shell-dependencies:${property("springShellVersion")}") } } From e8c69d4b99e1268a40577db6e369ce45704b3344 Mon Sep 17 00:00:00 2001 From: "Roberto C. Morano" Date: Mon, 18 Sep 2023 11:40:39 +0200 Subject: [PATCH 2/7] chore(gha): add voting-admin-app docker image integration --- .github/workflows/publish.yaml | 27 ++++++++++++++++++++ backend-services/voting-admin-app/Dockerfile | 9 +++++++ 2 files changed, 36 insertions(+) create mode 100644 backend-services/voting-admin-app/Dockerfile diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 3bb7d7c1a..320b3624b 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -272,3 +272,30 @@ jobs: "REACT_APP_USER_VERIFICATION_SERVER_URL=${{ env.REACT_APP_USER_VERIFICATION_SERVER_URL }}" tags: | ${{ env.PRIVATE_DOCKER_REGISTRY_URL }}/${{ env.APP_NAME }}:${{ env.ARTIFACT_VERSION }} + + publish-admin-cli: + runs-on: self-hosted + env: + APP_NAME: voting-admin-app + needs: build-version + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Docker Login + uses: docker/login-action@v2 + with: + registry: ${{ env.PRIVATE_DOCKER_REGISTRY_URL }} + username: ${{ env.PRIVATE_DOCKER_REGISTRY_USER }} + password: ${{ env.PRIVATE_DOCKER_REGISTRY_PASS }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Build and Push docker image + uses: docker/build-push-action@v4 + with: + context: backend-services/${{ env.APP_NAME }} + push: true + tags: | + ${{ env.PRIVATE_DOCKER_REGISTRY_URL }}/${{ env.APP_NAME }}:${{ env.ARTIFACT_VERSION }} diff --git a/backend-services/voting-admin-app/Dockerfile b/backend-services/voting-admin-app/Dockerfile new file mode 100644 index 000000000..b76582743 --- /dev/null +++ b/backend-services/voting-admin-app/Dockerfile @@ -0,0 +1,9 @@ +FROM openjdk:20-jdk-slim AS build +WORKDIR /app +COPY . /app +RUN ./gradlew clean build + +FROM openjdk:20-jdk-slim AS runtime +WORKDIR /app +COPY --from=build /app/build/libs/*SNAPSHOT.jar /app/app.jar +ENTRYPOINT ["java", "-jar", "app.jar"] From fd811951f07be8da0da5d7408dc71d7a3a955ecc Mon Sep 17 00:00:00 2001 From: "Roberto C. Morano" Date: Mon, 18 Sep 2023 11:54:44 +0200 Subject: [PATCH 3/7] doc(voting-app-doc): added docker run example --- backend-services/voting-admin-app/README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/backend-services/voting-admin-app/README.md b/backend-services/voting-admin-app/README.md index f352bb34b..87667f2d7 100644 --- a/backend-services/voting-admin-app/README.md +++ b/backend-services/voting-admin-app/README.md @@ -2,3 +2,15 @@ # Application Description Application to be used by the organisers to create events and proposals. + +# Run in docker + +``` +docker run -it --rm \ + -e SPRING_PROFILES_ACTIVE=prod \ + -e CARDANO_NETWORK=main \ + -e BLOCKFROST_URL=https://blockfrost-api.pro.dandelion-mainnet.eu-west-1.metadata.dev.cf-deployments.org \ + -e BLOCKFROST_PASSWORD=password \ + -e TX_SUBMIT_URL=https://submit-api.pro.dandelion-mainnet.eu-west-1.metadata.dev.cf-deployments.org/api/submit/tx \ + -e ORGANISER_MNEMONIC_PHRASE="_CHANGE_ME_" \ + pro.registry.gitlab.metadata.dev.cf-deployments.org/base-infrastructure/docker-registry/voting-admin-app From a0593e4539df5cc9b8a4cbbe5e5eb24514dadb5c Mon Sep 17 00:00:00 2001 From: "Roberto C. Morano" Date: Mon, 18 Sep 2023 11:58:31 +0200 Subject: [PATCH 4/7] chore(gha): fixed voting-admin-app docker build --- .github/workflows/publish.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 320b3624b..552d997b6 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -294,6 +294,8 @@ jobs: - name: Build and Push docker image uses: docker/build-push-action@v4 + env: + ARTIFACT_VERSION: ${{needs.build-version.outputs.ARTIFACT_VERSION}} with: context: backend-services/${{ env.APP_NAME }} push: true From 4195aef0eb8cf99076584f6f715d595e7c7d4fe8 Mon Sep 17 00:00:00 2001 From: matiwinnetou Date: Mon, 18 Sep 2023 13:53:21 +0200 Subject: [PATCH 5/7] Feature: discord fixes. (#243) Co-authored-by: Mateusz Czeladka --- .../config/SpringSecurityConfiguration.java | 10 ++- .../DiscordCheckVerificationRequest.java | 3 + .../DiscordUserVerificationRepository.java | 4 +- .../DiscordUserVerificationResource.java | 18 ++++-- .../resource/UserVerificationResource.java | 45 +++---------- .../DefaultUserVerificationService.java | 64 +++++++++++++++++++ .../common/UserVerificationService.java | 12 ++++ ...DefaultDiscordUserVerificationService.java | 7 +- .../DiscordUserVerificationService.java | 2 +- 9 files changed, 118 insertions(+), 47 deletions(-) create mode 100644 backend-services/user-verification-service/src/main/java/org/cardano/foundation/voting/service/common/DefaultUserVerificationService.java create mode 100644 backend-services/user-verification-service/src/main/java/org/cardano/foundation/voting/service/common/UserVerificationService.java diff --git a/backend-services/user-verification-service/src/main/java/org/cardano/foundation/voting/config/SpringSecurityConfiguration.java b/backend-services/user-verification-service/src/main/java/org/cardano/foundation/voting/config/SpringSecurityConfiguration.java index 9dd771027..779cd484a 100644 --- a/backend-services/user-verification-service/src/main/java/org/cardano/foundation/voting/config/SpringSecurityConfiguration.java +++ b/backend-services/user-verification-service/src/main/java/org/cardano/foundation/voting/config/SpringSecurityConfiguration.java @@ -24,6 +24,8 @@ import java.util.Arrays; import java.util.List; +import static org.springframework.http.HttpMethod.*; + @Configuration @Import(SecurityProblemSupport.class) public class SpringSecurityConfiguration { @@ -77,8 +79,12 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti .anonymous(AbstractHttpConfigurer::disable) .authorizeHttpRequests(authorizeHttpRequests -> authorizeHttpRequests .requestMatchers(new AntPathRequestMatcher("/api/sms/**")).permitAll() - .requestMatchers(new AntPathRequestMatcher("/api/discord/**")).hasRole("BOT") - .requestMatchers(new AntPathRequestMatcher("/api/user-verification/**")).permitAll() + .requestMatchers(new AntPathRequestMatcher("/api/discord/user-verification/is-verified/**", GET.name())).hasRole("BOT") + .requestMatchers(new AntPathRequestMatcher("/api/discord/user-verification/start-verification", POST.name())).hasRole("BOT") + .requestMatchers(new AntPathRequestMatcher("/api/discord/user-verification/start-verification", PUT.name())).hasRole("BOT") + .requestMatchers(new AntPathRequestMatcher("/api/discord/user-verification/check-verification", POST.name())).permitAll() + + .requestMatchers(new AntPathRequestMatcher("/api/user-verification/verified/**", GET.name())).permitAll() .anyRequest().denyAll() ) .rememberMe(AbstractHttpConfigurer::disable) diff --git a/backend-services/user-verification-service/src/main/java/org/cardano/foundation/voting/domain/discord/DiscordCheckVerificationRequest.java b/backend-services/user-verification-service/src/main/java/org/cardano/foundation/voting/domain/discord/DiscordCheckVerificationRequest.java index 42584e373..96651bfe5 100644 --- a/backend-services/user-verification-service/src/main/java/org/cardano/foundation/voting/domain/discord/DiscordCheckVerificationRequest.java +++ b/backend-services/user-verification-service/src/main/java/org/cardano/foundation/voting/domain/discord/DiscordCheckVerificationRequest.java @@ -14,6 +14,9 @@ @ToString public class DiscordCheckVerificationRequest { + @NotBlank + private String eventId; + @NotBlank private String stakeAddress; diff --git a/backend-services/user-verification-service/src/main/java/org/cardano/foundation/voting/repository/DiscordUserVerificationRepository.java b/backend-services/user-verification-service/src/main/java/org/cardano/foundation/voting/repository/DiscordUserVerificationRepository.java index f760da923..a6ed43f28 100644 --- a/backend-services/user-verification-service/src/main/java/org/cardano/foundation/voting/repository/DiscordUserVerificationRepository.java +++ b/backend-services/user-verification-service/src/main/java/org/cardano/foundation/voting/repository/DiscordUserVerificationRepository.java @@ -13,8 +13,8 @@ public interface DiscordUserVerificationRepository extends JpaRepository { @Query("SELECT uv FROM DiscordUserVerification uv WHERE uv.status = 'VERIFIED' AND uv.eventId = :eventId AND uv.stakeAddress = :stakeAddress") - Optional findCompletedVerification(@Param("eventId") String eventId, - @Param("stakeAddress") String stakeAddress + List findCompletedVerifications(@Param("eventId") String eventId, + @Param("stakeAddress") String stakeAddress ); @Query("SELECT uv FROM DiscordUserVerification uv WHERE uv.status = 'VERIFIED' AND uv.eventId = :eventId AND uv.discordIdHash = :discordIdHash") diff --git a/backend-services/user-verification-service/src/main/java/org/cardano/foundation/voting/resource/DiscordUserVerificationResource.java b/backend-services/user-verification-service/src/main/java/org/cardano/foundation/voting/resource/DiscordUserVerificationResource.java index b25064a59..6d33bbc9a 100644 --- a/backend-services/user-verification-service/src/main/java/org/cardano/foundation/voting/resource/DiscordUserVerificationResource.java +++ b/backend-services/user-verification-service/src/main/java/org/cardano/foundation/voting/resource/DiscordUserVerificationResource.java @@ -13,10 +13,10 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; - -import java.util.Objects; +import org.zalando.problem.Problem; import static org.springframework.web.bind.annotation.RequestMethod.*; +import static org.zalando.problem.Status.BAD_REQUEST; @RestController @RequestMapping("/api/discord/user-verification") @@ -36,7 +36,7 @@ public ResponseEntity isDiscordUserVerified(@PathVariable("discordIdHash") St return discordUserVerificationService.isVerifiedBasedOnDiscordIdHash(discordBotEventIdBinding, discordIdHash) .fold(problem -> { - return ResponseEntity.status(Objects.requireNonNull(problem.getStatus()).getStatusCode()).body(problem); + return ResponseEntity.status(problem.getStatus().getStatusCode()).body(problem); }, userVerification -> { return ResponseEntity.ok().body(userVerification); @@ -59,12 +59,20 @@ public ResponseEntity startVerification(@RequestBody @Valid DiscordStartVerif ); } - @RequestMapping(value = "/check-verification", method = { POST , PUT }, produces = "application/json") + @RequestMapping(value = "/check-verification", method = { POST }, produces = "application/json") @Timed(value = "resource.discord.checkVerification", histogram = true) public ResponseEntity checkVerification(@RequestBody @Valid DiscordCheckVerificationRequest checkVerificationRequest) { log.info("Received discord checkVerification request: {}", checkVerificationRequest); - return discordUserVerificationService.checkVerification(discordBotEventIdBinding, checkVerificationRequest) + if (!checkVerificationRequest.getEventId().equals(discordBotEventIdBinding)) { + return ResponseEntity.badRequest(). + body(Problem.builder().withTitle("EVENT_ID_AND_DISCORD_ID_BOT_MISMATCH") + .withDetail("Event id and discord id bot mismatch!") + .withStatus(BAD_REQUEST) + .build()); + } + + return discordUserVerificationService.checkVerification(checkVerificationRequest) .fold(problem -> { return ResponseEntity.status(problem.getStatus().getStatusCode()).body(problem); }, diff --git a/backend-services/user-verification-service/src/main/java/org/cardano/foundation/voting/resource/UserVerificationResource.java b/backend-services/user-verification-service/src/main/java/org/cardano/foundation/voting/resource/UserVerificationResource.java index e006ecf53..ec76001c7 100644 --- a/backend-services/user-verification-service/src/main/java/org/cardano/foundation/voting/resource/UserVerificationResource.java +++ b/backend-services/user-verification-service/src/main/java/org/cardano/foundation/voting/resource/UserVerificationResource.java @@ -6,8 +6,7 @@ import lombok.extern.slf4j.Slf4j; import org.cardano.foundation.voting.domain.IsVerifiedRequest; import org.cardano.foundation.voting.domain.IsVerifiedResponse; -import org.cardano.foundation.voting.service.discord.DiscordUserVerificationService; -import org.cardano.foundation.voting.service.sms.SMSUserVerificationService; +import org.cardano.foundation.voting.service.common.UserVerificationService; import org.cardano.foundation.voting.utils.CompletableFutures; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; @@ -27,9 +26,7 @@ @RequiredArgsConstructor public class UserVerificationResource { - private final SMSUserVerificationService smsUserVerificationService; - - private final DiscordUserVerificationService discordUserVerificationService; + private final UserVerificationService userVerificationService; @RequestMapping(value = "/verified/{eventId}/{stakeAddress}", method = GET, produces = "application/json") @Timed(value = "resource.isVerified", histogram = true) @@ -37,36 +34,14 @@ public ResponseEntity isVerified(@PathVariable("eventId") String eventId, @PathVariable("stakeAddress") String stakeAddress) { var isVerifiedRequest = new IsVerifiedRequest(eventId, stakeAddress); - log.info("Received isVerified request: {}", isVerifiedRequest); - - CompletableFuture> smsVerificationFuture = CompletableFuture.supplyAsync(() -> { - return smsUserVerificationService.isVerified(isVerifiedRequest); - }); - - CompletableFuture> discordVerificationFuture = CompletableFuture.supplyAsync(() -> { - return discordUserVerificationService.isVerifiedBasedOnStakeAddress(isVerifiedRequest); - }); - - var allFutures = CompletableFutures.anyResultsOf(List.of(smsVerificationFuture, discordVerificationFuture)); - - List> allResponses = allFutures.orTimeout(30, SECONDS) - .join(); - - var successCount = allResponses.stream().filter(Either::isRight).count(); - - if (successCount != 2) { - var problem = allResponses.stream().filter(Either::isLeft).findFirst().orElseThrow().getLeft(); - - return ResponseEntity.status(problem.getStatus().getStatusCode()).body(problem); - } - - var successes = allResponses.stream().filter(Either::isRight).toList().stream().map(Either::get).toList(); - - var isVerified = successes.stream().reduce((a, b) -> { - return new IsVerifiedResponse(a.isVerified() || b.isVerified()); - }).orElse(new IsVerifiedResponse(false)); - - return ResponseEntity.ok().body(isVerified); + return userVerificationService.isVerified(isVerifiedRequest) + .fold(problem -> { + return ResponseEntity.status(problem.getStatus().getStatusCode()).body(problem); + }, + isVerifiedResponse -> { + return ResponseEntity.ok().body(isVerifiedResponse); + } + ); } } diff --git a/backend-services/user-verification-service/src/main/java/org/cardano/foundation/voting/service/common/DefaultUserVerificationService.java b/backend-services/user-verification-service/src/main/java/org/cardano/foundation/voting/service/common/DefaultUserVerificationService.java new file mode 100644 index 000000000..addce8922 --- /dev/null +++ b/backend-services/user-verification-service/src/main/java/org/cardano/foundation/voting/service/common/DefaultUserVerificationService.java @@ -0,0 +1,64 @@ +package org.cardano.foundation.voting.service.common; + +import io.vavr.control.Either; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.cardano.foundation.voting.domain.IsVerifiedRequest; +import org.cardano.foundation.voting.domain.IsVerifiedResponse; +import org.cardano.foundation.voting.service.discord.DiscordUserVerificationService; +import org.cardano.foundation.voting.service.sms.SMSUserVerificationService; +import org.cardano.foundation.voting.utils.CompletableFutures; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.zalando.problem.Problem; + +import java.util.List; +import java.util.concurrent.CompletableFuture; + +import static java.util.concurrent.TimeUnit.SECONDS; + +@Service +@Slf4j +@RequiredArgsConstructor +public class DefaultUserVerificationService implements UserVerificationService { + + private final SMSUserVerificationService smsUserVerificationService; + + private final DiscordUserVerificationService discordUserVerificationService; + + @Override + @Transactional(readOnly = true) + public Either isVerified(IsVerifiedRequest isVerifiedRequest) { + log.info("Received isVerified request: {}", isVerifiedRequest); + + CompletableFuture> smsVerificationFuture = CompletableFuture.supplyAsync(() -> { + return smsUserVerificationService.isVerified(isVerifiedRequest); + }); + + CompletableFuture> discordVerificationFuture = CompletableFuture.supplyAsync(() -> { + return discordUserVerificationService.isVerifiedBasedOnStakeAddress(isVerifiedRequest); + }); + + var allFutures = CompletableFutures.anyResultsOf(List.of(smsVerificationFuture, discordVerificationFuture)); + + List> allResponses = allFutures.orTimeout(30, SECONDS) + .join(); + + var successCount = allResponses.stream().filter(Either::isRight).count(); + + if (successCount != 2) { + var problem = allResponses.stream().filter(Either::isLeft).findFirst().orElseThrow().getLeft(); + + return Either.left(problem); + } + + var successes = allResponses.stream().filter(Either::isRight).toList().stream().map(Either::get).toList(); + + var isVerified = successes.stream().reduce((a, b) -> { + return new IsVerifiedResponse(a.isVerified() || b.isVerified()); + }).orElse(new IsVerifiedResponse(false)); + + return Either.right(isVerified); + } + +} diff --git a/backend-services/user-verification-service/src/main/java/org/cardano/foundation/voting/service/common/UserVerificationService.java b/backend-services/user-verification-service/src/main/java/org/cardano/foundation/voting/service/common/UserVerificationService.java new file mode 100644 index 000000000..faf6ec481 --- /dev/null +++ b/backend-services/user-verification-service/src/main/java/org/cardano/foundation/voting/service/common/UserVerificationService.java @@ -0,0 +1,12 @@ +package org.cardano.foundation.voting.service.common; + +import io.vavr.control.Either; +import org.cardano.foundation.voting.domain.IsVerifiedRequest; +import org.cardano.foundation.voting.domain.IsVerifiedResponse; +import org.zalando.problem.Problem; + +public interface UserVerificationService { + + Either isVerified(IsVerifiedRequest isVerifiedRequest); + +} diff --git a/backend-services/user-verification-service/src/main/java/org/cardano/foundation/voting/service/discord/DefaultDiscordUserVerificationService.java b/backend-services/user-verification-service/src/main/java/org/cardano/foundation/voting/service/discord/DefaultDiscordUserVerificationService.java index 67f83592f..a61a93c1b 100644 --- a/backend-services/user-verification-service/src/main/java/org/cardano/foundation/voting/service/discord/DefaultDiscordUserVerificationService.java +++ b/backend-services/user-verification-service/src/main/java/org/cardano/foundation/voting/service/discord/DefaultDiscordUserVerificationService.java @@ -119,7 +119,8 @@ public Either startVerification(Strin @Override @Transactional - public Either checkVerification(String eventId, DiscordCheckVerificationRequest checkVerificationRequest) { + public Either checkVerification(DiscordCheckVerificationRequest checkVerificationRequest) { + var eventId = checkVerificationRequest.getEventId(); var eventDetails = chainFollowerClient.findEventById(eventId); if (eventDetails.isEmpty()) { @@ -281,8 +282,10 @@ public Either checkVerification(String eventId, Dis } @Override + @Transactional(readOnly = true) public Either isVerifiedBasedOnStakeAddress(IsVerifiedRequest isVerifiedRequest) { - var isVerified = userVerificationRepository.findCompletedVerification(isVerifiedRequest.getEventId(), isVerifiedRequest.getStakeAddress()) + var isVerified = userVerificationRepository.findCompletedVerifications(isVerifiedRequest.getEventId(), isVerifiedRequest.getStakeAddress()) + .stream().findFirst() .map(uv -> new IsVerifiedResponse(true)).orElse(new IsVerifiedResponse(false)); return Either.right(isVerified); diff --git a/backend-services/user-verification-service/src/main/java/org/cardano/foundation/voting/service/discord/DiscordUserVerificationService.java b/backend-services/user-verification-service/src/main/java/org/cardano/foundation/voting/service/discord/DiscordUserVerificationService.java index 177ed859c..45645f0d0 100644 --- a/backend-services/user-verification-service/src/main/java/org/cardano/foundation/voting/service/discord/DiscordUserVerificationService.java +++ b/backend-services/user-verification-service/src/main/java/org/cardano/foundation/voting/service/discord/DiscordUserVerificationService.java @@ -15,7 +15,7 @@ public interface DiscordUserVerificationService { Either startVerification(String eventId, DiscordStartVerificationRequest startVerificationRequest); - Either checkVerification(String eventId, DiscordCheckVerificationRequest checkVerificationRequest); + Either checkVerification(DiscordCheckVerificationRequest checkVerificationRequest); Either isVerifiedBasedOnStakeAddress(IsVerifiedRequest isVerifiedRequest); From a615b402c383a3dc75e91bd8b65772ee9cd924b7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 18 Sep 2023 11:53:57 +0000 Subject: [PATCH 6/7] chore(main): release 0.2.37 --- CHANGELOG.md | 20 ++++++++++++++++++++ version.txt | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 90ef58f7b..1e067c4c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,25 @@ # Changelog +## [0.2.37](https://github.com/cardano-foundation/cf-cardano-ballot/compare/v0.2.36...v0.2.37) (2023-09-18) + + +### Features + +* discord fixes. ([#243](https://github.com/cardano-foundation/cf-cardano-ballot/issues/243)) ([4195aef](https://github.com/cardano-foundation/cf-cardano-ballot/commit/4195aef0eb8cf99076584f6f715d595e7c7d4fe8)) +* Discord user-verification flow and integration with Discord Bot. ([#210](https://github.com/cardano-foundation/cf-cardano-ballot/issues/210)) ([f9189fa](https://github.com/cardano-foundation/cf-cardano-ballot/commit/f9189facd37c9dc4579b9490f651f5c91c8ff5f5)) +* prod test - git ignore. ([0b58fd2](https://github.com/cardano-foundation/cf-cardano-ballot/commit/0b58fd2b9fd9fb88b690b97c72a2bccaae2096df)) +* prod test. ([c533b2a](https://github.com/cardano-foundation/cf-cardano-ballot/commit/c533b2a72568577149611c8eb0c10d7f5f3f0b13)) +* shelley account generation ([c53c6ef](https://github.com/cardano-foundation/cf-cardano-ballot/commit/c53c6ef88420c34e7cff2aca3679ed84586f001c)) +* shelley account generation. ([a30499e](https://github.com/cardano-foundation/cf-cardano-ballot/commit/a30499e49d0db72855a5faae5ddd220c43f450b8)) + + +### Bug Fixes + +* ability to run voting-app from command line. ([1c0349b](https://github.com/cardano-foundation/cf-cardano-ballot/commit/1c0349b47f09f1b510e3229f04de9b014fba983b)) +* **admin-cli:** ability to run voting-app from command line. ([af196ca](https://github.com/cardano-foundation/cf-cardano-ballot/commit/af196ca326a08b5e2a750aa124189f83bed030c9)) +* **cip-1694-ui:** support second question on ui ([02a87f3](https://github.com/cardano-foundation/cf-cardano-ballot/commit/02a87f3af48b5243ae75be9d3af31ea5753d446c)) +* **cip-1694-ui:** update to the latest be services ([8057e40](https://github.com/cardano-foundation/cf-cardano-ballot/commit/8057e40401eec41047ad493bf046f25b5fe795c5)) + ## [0.2.36](https://github.com/cardano-foundation/cf-cardano-ballot/compare/v0.2.35...v0.2.36) (2023-09-14) diff --git a/version.txt b/version.txt index d4ca806c1..aa0499977 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.2.36 +0.2.37 From cd0ac251b16736cbf229780656fb7588047390d4 Mon Sep 17 00:00:00 2001 From: matiwinnetou Date: Mon, 18 Sep 2023 13:55:35 +0200 Subject: [PATCH 7/7] License change MPL 2.0 -> MIT --- LICENSE | 394 +++----------------------------------------------------- 1 file changed, 21 insertions(+), 373 deletions(-) diff --git a/LICENSE b/LICENSE index a612ad981..1ed50d492 100644 --- a/LICENSE +++ b/LICENSE @@ -1,373 +1,21 @@ -Mozilla Public License Version 2.0 -================================== - -1. Definitions --------------- - -1.1. "Contributor" - means each individual or legal entity that creates, contributes to - the creation of, or owns Covered Software. - -1.2. "Contributor Version" - means the combination of the Contributions of others (if any) used - by a Contributor and that particular Contributor's Contribution. - -1.3. "Contribution" - means Covered Software of a particular Contributor. - -1.4. "Covered Software" - means Source Code Form to which the initial Contributor has attached - the notice in Exhibit A, the Executable Form of such Source Code - Form, and Modifications of such Source Code Form, in each case - including portions thereof. - -1.5. "Incompatible With Secondary Licenses" - means - - (a) that the initial Contributor has attached the notice described - in Exhibit B to the Covered Software; or - - (b) that the Covered Software was made available under the terms of - version 1.1 or earlier of the License, but not also under the - terms of a Secondary License. - -1.6. "Executable Form" - means any form of the work other than Source Code Form. - -1.7. "Larger Work" - means a work that combines Covered Software with other material, in - a separate file or files, that is not Covered Software. - -1.8. "License" - means this document. - -1.9. "Licensable" - means having the right to grant, to the maximum extent possible, - whether at the time of the initial grant or subsequently, any and - all of the rights conveyed by this License. - -1.10. "Modifications" - means any of the following: - - (a) any file in Source Code Form that results from an addition to, - deletion from, or modification of the contents of Covered - Software; or - - (b) any new file in Source Code Form that contains any Covered - Software. - -1.11. "Patent Claims" of a Contributor - means any patent claim(s), including without limitation, method, - process, and apparatus claims, in any patent Licensable by such - Contributor that would be infringed, but for the grant of the - License, by the making, using, selling, offering for sale, having - made, import, or transfer of either its Contributions or its - Contributor Version. - -1.12. "Secondary License" - means either the GNU General Public License, Version 2.0, the GNU - Lesser General Public License, Version 2.1, the GNU Affero General - Public License, Version 3.0, or any later versions of those - licenses. - -1.13. "Source Code Form" - means the form of the work preferred for making modifications. - -1.14. "You" (or "Your") - means an individual or a legal entity exercising rights under this - License. For legal entities, "You" includes any entity that - controls, is controlled by, or is under common control with You. For - purposes of this definition, "control" means (a) the power, direct - or indirect, to cause the direction or management of such entity, - whether by contract or otherwise, or (b) ownership of more than - fifty percent (50%) of the outstanding shares or beneficial - ownership of such entity. - -2. License Grants and Conditions --------------------------------- - -2.1. Grants - -Each Contributor hereby grants You a world-wide, royalty-free, -non-exclusive license: - -(a) under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or - as part of a Larger Work; and - -(b) under Patent Claims of such Contributor to make, use, sell, offer - for sale, have made, import, and otherwise transfer either its - Contributions or its Contributor Version. - -2.2. Effective Date - -The licenses granted in Section 2.1 with respect to any Contribution -become effective for each Contribution on the date the Contributor first -distributes such Contribution. - -2.3. Limitations on Grant Scope - -The licenses granted in this Section 2 are the only rights granted under -this License. No additional rights or licenses will be implied from the -distribution or licensing of Covered Software under this License. -Notwithstanding Section 2.1(b) above, no patent license is granted by a -Contributor: - -(a) for any code that a Contributor has removed from Covered Software; - or - -(b) for infringements caused by: (i) Your and any other third party's - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - -(c) under Patent Claims infringed by Covered Software in the absence of - its Contributions. - -This License does not grant any rights in the trademarks, service marks, -or logos of any Contributor (except as may be necessary to comply with -the notice requirements in Section 3.4). - -2.4. Subsequent Licenses - -No Contributor makes additional grants as a result of Your choice to -distribute the Covered Software under a subsequent version of this -License (see Section 10.2) or under the terms of a Secondary License (if -permitted under the terms of Section 3.3). - -2.5. Representation - -Each Contributor represents that the Contributor believes its -Contributions are its original creation(s) or it has sufficient rights -to grant the rights to its Contributions conveyed by this License. - -2.6. Fair Use - -This License is not intended to limit any rights You have under -applicable copyright doctrines of fair use, fair dealing, or other -equivalents. - -2.7. Conditions - -Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted -in Section 2.1. - -3. Responsibilities -------------------- - -3.1. Distribution of Source Form - -All distribution of Covered Software in Source Code Form, including any -Modifications that You create or to which You contribute, must be under -the terms of this License. You must inform recipients that the Source -Code Form of the Covered Software is governed by the terms of this -License, and how they can obtain a copy of this License. You may not -attempt to alter or restrict the recipients' rights in the Source Code -Form. - -3.2. Distribution of Executable Form - -If You distribute Covered Software in Executable Form then: - -(a) such Covered Software must also be made available in Source Code - Form, as described in Section 3.1, and You must inform recipients of - the Executable Form how they can obtain a copy of such Source Code - Form by reasonable means in a timely manner, at a charge no more - than the cost of distribution to the recipient; and - -(b) You may distribute such Executable Form under the terms of this - License, or sublicense it under different terms, provided that the - license for the Executable Form does not attempt to limit or alter - the recipients' rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - -You may create and distribute a Larger Work under terms of Your choice, -provided that You also comply with the requirements of this License for -the Covered Software. If the Larger Work is a combination of Covered -Software with a work governed by one or more Secondary Licenses, and the -Covered Software is not Incompatible With Secondary Licenses, this -License permits You to additionally distribute such Covered Software -under the terms of such Secondary License(s), so that the recipient of -the Larger Work may, at their option, further distribute the Covered -Software under the terms of either this License or such Secondary -License(s). - -3.4. Notices - -You may not remove or alter the substance of any license notices -(including copyright notices, patent notices, disclaimers of warranty, -or limitations of liability) contained within the Source Code Form of -the Covered Software, except that You may alter any license notices to -the extent required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - -You may choose to offer, and to charge a fee for, warranty, support, -indemnity or liability obligations to one or more recipients of Covered -Software. However, You may do so only on Your own behalf, and not on -behalf of any Contributor. You must make it absolutely clear that any -such warranty, support, indemnity, or liability obligation is offered by -You alone, and You hereby agree to indemnify every Contributor for any -liability incurred by such Contributor as a result of warranty, support, -indemnity or liability terms You offer. You may include additional -disclaimers of warranty and limitations of liability specific to any -jurisdiction. - -4. Inability to Comply Due to Statute or Regulation ---------------------------------------------------- - -If it is impossible for You to comply with any of the terms of this -License with respect to some or all of the Covered Software due to -statute, judicial order, or regulation then You must: (a) comply with -the terms of this License to the maximum extent possible; and (b) -describe the limitations and the code they affect. Such description must -be placed in a text file included with all distributions of the Covered -Software under this License. Except to the extent prohibited by statute -or regulation, such description must be sufficiently detailed for a -recipient of ordinary skill to be able to understand it. - -5. Termination --------------- - -5.1. The rights granted under this License will terminate automatically -if You fail to comply with any of its terms. However, if You become -compliant, then the rights granted under this License from a particular -Contributor are reinstated (a) provisionally, unless and until such -Contributor explicitly and finally terminates Your grants, and (b) on an -ongoing basis, if such Contributor fails to notify You of the -non-compliance by some reasonable means prior to 60 days after You have -come back into compliance. Moreover, Your grants from a particular -Contributor are reinstated on an ongoing basis if such Contributor -notifies You of the non-compliance by some reasonable means, this is the -first time You have received notice of non-compliance with this License -from such Contributor, and You become compliant prior to 30 days after -Your receipt of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent -infringement claim (excluding declaratory judgment actions, -counter-claims, and cross-claims) alleging that a Contributor Version -directly or indirectly infringes any patent, then the rights granted to -You by any and all Contributors for the Covered Software under Section -2.1 of this License shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all -end user license agreements (excluding distributors and resellers) which -have been validly granted by You or Your distributors under this License -prior to termination shall survive termination. - -************************************************************************ -* * -* 6. Disclaimer of Warranty * -* ------------------------- * -* * -* Covered Software is provided under this License on an "as is" * -* basis, without warranty of any kind, either expressed, implied, or * -* statutory, including, without limitation, warranties that the * -* Covered Software is free of defects, merchantable, fit for a * -* particular purpose or non-infringing. The entire risk as to the * -* quality and performance of the Covered Software is with You. * -* Should any Covered Software prove defective in any respect, You * -* (not any Contributor) assume the cost of any necessary servicing, * -* repair, or correction. This disclaimer of warranty constitutes an * -* essential part of this License. No use of any Covered Software is * -* authorized under this License except under this disclaimer. * -* * -************************************************************************ - -************************************************************************ -* * -* 7. Limitation of Liability * -* -------------------------- * -* * -* Under no circumstances and under no legal theory, whether tort * -* (including negligence), contract, or otherwise, shall any * -* Contributor, or anyone who distributes Covered Software as * -* permitted above, be liable to You for any direct, indirect, * -* special, incidental, or consequential damages of any character * -* including, without limitation, damages for lost profits, loss of * -* goodwill, work stoppage, computer failure or malfunction, or any * -* and all other commercial damages or losses, even if such party * -* shall have been informed of the possibility of such damages. This * -* limitation of liability shall not apply to liability for death or * -* personal injury resulting from such party's negligence to the * -* extent applicable law prohibits such limitation. Some * -* jurisdictions do not allow the exclusion or limitation of * -* incidental or consequential damages, so this exclusion and * -* limitation may not apply to You. * -* * -************************************************************************ - -8. Litigation -------------- - -Any litigation relating to this License may be brought only in the -courts of a jurisdiction where the defendant maintains its principal -place of business and such litigation shall be governed by laws of that -jurisdiction, without reference to its conflict-of-law provisions. -Nothing in this Section shall prevent a party's ability to bring -cross-claims or counter-claims. - -9. Miscellaneous ----------------- - -This License represents the complete agreement concerning the subject -matter hereof. If any provision of this License is held to be -unenforceable, such provision shall be reformed only to the extent -necessary to make it enforceable. Any law or regulation which provides -that the language of a contract shall be construed against the drafter -shall not be used to construe this License against a Contributor. - -10. Versions of the License ---------------------------- - -10.1. New Versions - -Mozilla Foundation is the license steward. Except as provided in Section -10.3, no one other than the license steward has the right to modify or -publish new versions of this License. Each version will be given a -distinguishing version number. - -10.2. Effect of New Versions - -You may distribute the Covered Software under the terms of the version -of the License under which You originally received the Covered Software, -or under the terms of any subsequent version published by the license -steward. - -10.3. Modified Versions - -If you create software not governed by this License, and you want to -create a new license for such software, you may create and use a -modified version of this License if you rename the license and remove -any references to the name of the license steward (except to note that -such modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary -Licenses - -If You choose to distribute Source Code Form that is Incompatible With -Secondary Licenses under the terms of this version of the License, the -notice described in Exhibit B of this License must be attached. - -Exhibit A - Source Code Form License Notice -------------------------------------------- - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular -file, then You may include the notice in a location (such as a LICENSE -file in a relevant directory) where a recipient would be likely to look -for such a notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - "Incompatible With Secondary Licenses" Notice ---------------------------------------------------------- - - This Source Code Form is "Incompatible With Secondary Licenses", as - defined by the Mozilla Public License, v. 2.0. +MIT License + +Copyright (c) 2023 Cardano Foundation + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE.