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

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

13 Sep 2023 11:12AM UTC coverage: 29.185% (+0.05%) from 29.14%
6171673536

Pull #712

patlo-iog
fix(prism-agent): add missing response status code for create did endpoint

Signed-off-by: Pat Losoponkul <pat.losoponkul@iohk.io>
Pull Request #712: fix(prism-agent): validate application config during startup

8 of 8 new or added lines in 2 files covered. (100.0%)

3466 of 11876 relevant lines covered (29.18%)

0.29 hits per line

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

19.51
/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.api.http.RequestContext
4
import io.iohk.atala.api.http.model.PaginationInput
5
import io.iohk.atala.iam.authentication.Authenticator
6
import io.iohk.atala.iam.authentication.apikey.ApiKeyEndpointSecurityLogic
7
import io.iohk.atala.issue.controller.IssueEndpoints.*
8
import io.iohk.atala.issue.controller.http.{AcceptCredentialOfferRequest, CreateIssueCredentialRecordRequest}
9
import io.iohk.atala.shared.models.WalletAccessContext
10
import sttp.tapir.ztapir.*
11
import zio.*
12

13
class IssueServerEndpoints(issueController: IssueController, authenticator: Authenticator) {
14

15
  val createCredentialOfferEndpoint: ZServerEndpoint[Any, Any] =
×
16
    createCredentialOffer
×
17
      .zServerSecurityLogic(ApiKeyEndpointSecurityLogic.securityLogic(_)(authenticator))
1✔
18
      .serverLogic { entity =>
×
19
        { case (ctx: RequestContext, request: CreateIssueCredentialRecordRequest) =>
×
20
          issueController
×
21
            .createCredentialOffer(request)(ctx)
×
22
            .provideSomeLayer(ZLayer.succeed(entity.walletAccessContext))
23
        }
24
      }
25

26
  val getCredentialRecordsEndpoint: ZServerEndpoint[Any, Any] =
×
27
    getCredentialRecords
×
28
      .zServerSecurityLogic(ApiKeyEndpointSecurityLogic.securityLogic(_)(authenticator))
1✔
29
      .serverLogic { entity =>
×
30
        { case (ctx: RequestContext, paginationInput: PaginationInput, thid: Option[String]) =>
×
31
          issueController
×
32
            .getCredentialRecords(paginationInput, thid)(ctx)
×
33
            .provideSomeLayer(ZLayer.succeed(entity.walletAccessContext))
34
        }
35
      }
36

37
  val getCredentialRecordEndpoint: ZServerEndpoint[Any, Any] =
×
38
    getCredentialRecord
×
39
      .zServerSecurityLogic(ApiKeyEndpointSecurityLogic.securityLogic(_)(authenticator))
1✔
40
      .serverLogic { entity =>
×
41
        { case (ctx: RequestContext, recordId: String) =>
×
42
          issueController
×
43
            .getCredentialRecord(recordId)(ctx)
×
44
            .provideSomeLayer(ZLayer.succeed(entity.walletAccessContext))
45
        }
46
      }
47

48
  val acceptCredentialOfferEndpoint: ZServerEndpoint[Any, Any] =
×
49
    acceptCredentialOffer
×
50
      .zServerSecurityLogic(ApiKeyEndpointSecurityLogic.securityLogic(_)(authenticator))
1✔
51
      .serverLogic { entity =>
1✔
52
        { case (ctx: RequestContext, recordId: String, request: AcceptCredentialOfferRequest) =>
1✔
53
          issueController
×
54
            .acceptCredentialOffer(recordId, request)(ctx)
×
55
            .provideSomeLayer(ZLayer.succeed(entity.walletAccessContext))
56
        }
57
      }
58

59
  val issueCredentialEndpoint: ZServerEndpoint[Any, Any] =
×
60
    issueCredential
×
61
      .zServerSecurityLogic(ApiKeyEndpointSecurityLogic.securityLogic(_)(authenticator))
1✔
62
      .serverLogic { entity =>
×
63
        { case (ctx: RequestContext, recordId: String) =>
×
64
          issueController
×
65
            .issueCredential(recordId)(ctx)
×
66
            .provideSomeLayer(ZLayer.succeed(entity.walletAccessContext))
67
        }
68
      }
69

1✔
70
  val all: List[ZServerEndpoint[Any, Any]] = List(
71
    createCredentialOfferEndpoint,
72
    getCredentialRecordsEndpoint,
73
    getCredentialRecordEndpoint,
74
    acceptCredentialOfferEndpoint,
75
    issueCredentialEndpoint
76
  )
77

78
}
79

80
object IssueServerEndpoints {
×
81
  def all: URIO[IssueController & Authenticator, List[ZServerEndpoint[Any, Any]]] = {
×
82
    for {
×
83
      authenticator <- ZIO.service[Authenticator]
×
84
      issueController <- ZIO.service[IssueController]
×
85
      issueEndpoints = new IssueServerEndpoints(issueController, authenticator)
86
    } yield issueEndpoints.all
87
  }
88
}
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