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

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

24 Apr 2024 02:03PM UTC coverage: 32.039% (+0.1%) from 31.912%
8817900591

Pull #973

mineme0110
rename NODE_VERSION to PRISM_NODE_VERSION

Signed-off-by: mineme0110 <shailesh.patil@iohk.io>
Pull Request #973: feat: Align the repo with new name identus-cloud-agent

0 of 6 new or added lines in 4 files covered. (0.0%)

388 existing lines in 91 files now uncovered.

4619 of 14417 relevant lines covered (32.04%)

0.32 hits per line

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

23.81
/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.LogUtils.*
4
import io.iohk.atala.agent.walletapi.model.BaseEntity
5
import io.iohk.atala.api.http.RequestContext
6
import io.iohk.atala.api.http.model.PaginationInput
7
import io.iohk.atala.iam.authentication.Authenticator
8
import io.iohk.atala.iam.authentication.Authorizer
9
import io.iohk.atala.iam.authentication.DefaultAuthenticator
1✔
10
import io.iohk.atala.iam.authentication.SecurityLogic
11
import io.iohk.atala.issue.controller.IssueEndpoints.*
12
import io.iohk.atala.issue.controller.http.{AcceptCredentialOfferRequest, CreateIssueCredentialRecordRequest}
13
import io.iohk.atala.shared.models.WalletAccessContext
14
import sttp.tapir.ztapir.*
15
import zio.*
16

17
class IssueServerEndpoints(
18
    issueController: IssueController,
19
    authenticator: Authenticator[BaseEntity],
20
    authorizer: Authorizer[BaseEntity]
21
) {
22

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

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

47
  val getCredentialRecordEndpoint: ZServerEndpoint[Any, Any] =
×
48
    getCredentialRecord
×
49
      .zServerSecurityLogic(SecurityLogic.authorizeWalletAccessWith(_)(authenticator, authorizer))
1✔
50
      .serverLogic { wac =>
×
51
        { case (ctx: RequestContext, recordId: String) =>
×
52
          issueController
×
53
            .getCredentialRecord(recordId)(ctx)
×
54
            .provideSomeLayer(ZLayer.succeed(wac))
55
            .logTrace(ctx)
56
        }
57
      }
58

59
  val acceptCredentialOfferEndpoint: ZServerEndpoint[Any, Any] =
×
60
    acceptCredentialOffer
×
61
      .zServerSecurityLogic(SecurityLogic.authorizeWalletAccessWith(_)(authenticator, authorizer))
1✔
62
      .serverLogic { wac =>
1✔
UNCOV
63
        { case (ctx: RequestContext, recordId: String, request: AcceptCredentialOfferRequest) =>
×
64
          issueController
×
65
            .acceptCredentialOffer(recordId, request)(ctx)
×
66
            .provideSomeLayer(ZLayer.succeed(wac))
67
            .logTrace(ctx)
68
        }
69
      }
70

71
  val issueCredentialEndpoint: ZServerEndpoint[Any, Any] =
×
72
    issueCredential
×
73
      .zServerSecurityLogic(SecurityLogic.authorizeWalletAccessWith(_)(authenticator, authorizer))
1✔
74
      .serverLogic { wac =>
×
75
        { case (ctx: RequestContext, recordId: String) =>
×
76
          issueController
×
77
            .issueCredential(recordId)(ctx)
×
78
            .provideSomeLayer(ZLayer.succeed(wac))
79
            .logTrace(ctx)
80
        }
81
      }
82

1✔
83
  val all: List[ZServerEndpoint[Any, Any]] = List(
84
    createCredentialOfferEndpoint,
85
    getCredentialRecordsEndpoint,
86
    getCredentialRecordEndpoint,
87
    acceptCredentialOfferEndpoint,
88
    issueCredentialEndpoint
89
  )
90

91
}
92

93
object IssueServerEndpoints {
×
94
  def all: URIO[IssueController & DefaultAuthenticator, List[ZServerEndpoint[Any, Any]]] = {
×
95
    for {
×
96
      authenticator <- ZIO.service[DefaultAuthenticator]
×
97
      issueController <- ZIO.service[IssueController]
×
98
      issueEndpoints = new IssueServerEndpoints(issueController, authenticator, authenticator)
99
    } yield issueEndpoints.all
100
  }
101
}
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