• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

input-output-hk / atala-prism-building-blocks / 6657200245

26 Oct 2023 04:43PM UTC coverage: 30.996% (+0.06%) from 30.937%
6657200245

Pull #769

antonbaliasnikov
chore: remove unused iris module

Signed-off-by: Anton Baliasnikov <anton.baliasnikov@iohk.io>
Pull Request #769: chore: remove unused iris module

3943 of 12721 relevant lines covered (31.0%)

0.31 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

17.07
/prism-agent/service/server/src/main/scala/io/iohk/atala/issue/controller/IssueServerEndpoints.scala
1
package io.iohk.atala.issue.controller
2

3
import io.iohk.atala.agent.walletapi.model.BaseEntity
4
import io.iohk.atala.api.http.RequestContext
5
import io.iohk.atala.api.http.model.PaginationInput
6
import io.iohk.atala.iam.authentication.Authenticator
7
import io.iohk.atala.iam.authentication.Authorizer
8
import io.iohk.atala.iam.authentication.DefaultAuthenticator
9
import io.iohk.atala.iam.authentication.SecurityLogic
10
import io.iohk.atala.issue.controller.IssueEndpoints.*
11
import io.iohk.atala.issue.controller.http.{AcceptCredentialOfferRequest, CreateIssueCredentialRecordRequest}
12
import io.iohk.atala.shared.models.WalletAccessContext
13
import sttp.tapir.ztapir.*
14
import zio.*
15

16
class IssueServerEndpoints(
17
    issueController: IssueController,
18
    authenticator: Authenticator[BaseEntity] & Authorizer[BaseEntity]
19
) {
20

21
  val createCredentialOfferEndpoint: ZServerEndpoint[Any, Any] =
×
22
    createCredentialOffer
×
23
      .zServerSecurityLogic(SecurityLogic.authorizeWith(_)(authenticator))
1✔
24
      .serverLogic { wac =>
×
25
        { case (ctx: RequestContext, request: CreateIssueCredentialRecordRequest) =>
×
26
          issueController
×
27
            .createCredentialOffer(request)(ctx)
×
28
            .provideSomeLayer(ZLayer.succeed(wac))
29
        }
30
      }
31

32
  val getCredentialRecordsEndpoint: ZServerEndpoint[Any, Any] =
×
33
    getCredentialRecords
×
34
      .zServerSecurityLogic(SecurityLogic.authorizeWith(_)(authenticator))
1✔
35
      .serverLogic { wac =>
×
36
        { case (ctx: RequestContext, paginationInput: PaginationInput, thid: Option[String]) =>
×
37
          issueController
×
38
            .getCredentialRecords(paginationInput, thid)(ctx)
×
39
            .provideSomeLayer(ZLayer.succeed(wac))
40
        }
41
      }
42

43
  val getCredentialRecordEndpoint: ZServerEndpoint[Any, Any] =
×
44
    getCredentialRecord
×
45
      .zServerSecurityLogic(SecurityLogic.authorizeWith(_)(authenticator))
1✔
46
      .serverLogic { wac =>
×
47
        { case (ctx: RequestContext, recordId: String) =>
×
48
          issueController
×
49
            .getCredentialRecord(recordId)(ctx)
×
50
            .provideSomeLayer(ZLayer.succeed(wac))
51
        }
52
      }
53

54
  val acceptCredentialOfferEndpoint: ZServerEndpoint[Any, Any] =
×
55
    acceptCredentialOffer
×
56
      .zServerSecurityLogic(SecurityLogic.authorizeWith(_)(authenticator))
1✔
57
      .serverLogic { wac =>
1✔
58
        { case (ctx: RequestContext, recordId: String, request: AcceptCredentialOfferRequest) =>
1✔
59
          issueController
×
60
            .acceptCredentialOffer(recordId, request)(ctx)
×
61
            .provideSomeLayer(ZLayer.succeed(wac))
62
        }
63
      }
64

65
  val issueCredentialEndpoint: ZServerEndpoint[Any, Any] =
×
66
    issueCredential
×
67
      .zServerSecurityLogic(SecurityLogic.authorizeWith(_)(authenticator))
1✔
68
      .serverLogic { wac =>
×
69
        { case (ctx: RequestContext, recordId: String) =>
×
70
          issueController
×
71
            .issueCredential(recordId)(ctx)
×
72
            .provideSomeLayer(ZLayer.succeed(wac))
73
        }
74
      }
75

×
76
  val all: List[ZServerEndpoint[Any, Any]] = List(
77
    createCredentialOfferEndpoint,
78
    getCredentialRecordsEndpoint,
79
    getCredentialRecordEndpoint,
80
    acceptCredentialOfferEndpoint,
81
    issueCredentialEndpoint
82
  )
83

84
}
85

86
object IssueServerEndpoints {
×
87
  def all: URIO[IssueController & DefaultAuthenticator, List[ZServerEndpoint[Any, Any]]] = {
×
88
    for {
×
89
      authenticator <- ZIO.service[DefaultAuthenticator]
×
90
      issueController <- ZIO.service[IssueController]
×
91
      issueEndpoints = new IssueServerEndpoints(issueController, authenticator)
92
    } yield issueEndpoints.all
93
  }
94
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc