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

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

24 Apr 2024 10:47AM UTC coverage: 31.599% (-0.3%) from 31.912%
8815523478

Pull #966

patlo-iog
chore: resolve conflict

Signed-off-by: Pat Losoponkul <pat.losoponkul@iohk.io>
Pull Request #966: feat: key management for Ed25519 and X25519

110 of 386 new or added lines in 22 files covered. (28.5%)

471 existing lines in 130 files now uncovered.

4652 of 14722 relevant lines covered (31.6%)

0.32 hits per line

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

26.19
/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
UNCOV
9
import io.iohk.atala.iam.authentication.DefaultAuthenticator
×
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)
1✔
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)
1✔
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