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

hyperledger / identus-cloud-agent / 11056733508

26 Sep 2024 04:52PM UTC coverage: 48.532% (-0.03%) from 48.558%
11056733508

Pull #1366

CryptoKnightIOG
ATL-7775: Fix integration test

Signed-off-by: Bassam Riman <bassam.riman@iohk.io>
Pull Request #1366: feat: Default Backend API to Array Of Credential Schema

41 of 54 new or added lines in 8 files covered. (75.93%)

187 existing lines in 61 files now uncovered.

7622 of 15705 relevant lines covered (48.53%)

0.49 hits per line

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

83.33
/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/model/PresentationRecord.scala
1
package org.hyperledger.identus.pollux.core.model
2

3
import org.hyperledger.identus.mercury.protocol.invitation.v2.Invitation
4
import org.hyperledger.identus.mercury.protocol.presentproof.{Presentation, ProposePresentation, RequestPresentation}
5
import org.hyperledger.identus.shared.models.{Failure, WalletAccessContext, WalletId}
6
import zio.{URIO, ZIO}
7

8
import java.time.temporal.ChronoUnit
9
import java.time.Instant
10

11
type AnoncredCredentialProofs = zio.json.ast.Json
12
type SdJwtCredentialToDisclose = zio.json.ast.Json.Obj
13

14
final case class PresentationRecord(
15
    id: DidCommID,
16
    createdAt: Instant,
17
    updatedAt: Option[Instant],
18
    thid: DidCommID,
19
    schemaId: Option[String],
20
    connectionId: Option[String],
21
    role: PresentationRecord.Role,
22
    protocolState: PresentationRecord.ProtocolState,
23
    credentialFormat: CredentialFormat,
24
    invitation: Option[Invitation],
25
    requestPresentationData: Option[RequestPresentation],
26
    proposePresentationData: Option[ProposePresentation],
27
    presentationData: Option[Presentation],
28
    credentialsToUse: Option[List[String]],
29
    anoncredCredentialsToUseJsonSchemaId: Option[String],
30
    anoncredCredentialsToUse: Option[AnoncredCredentialProofs],
31
    sdJwtClaimsToUseJsonSchemaId: Option[String],
32
    sdJwtClaimsToDisclose: Option[SdJwtCredentialToDisclose],
33
    metaRetries: Int,
34
    metaNextRetry: Option[Instant],
35
    metaLastFailure: Option[Failure],
36
    walletId: WalletId,
37
) {
38
  def withTruncatedTimestamp(unit: ChronoUnit = ChronoUnit.MICROS): PresentationRecord =
1✔
39
    copy(
40
      createdAt = createdAt.truncatedTo(unit),
1✔
UNCOV
41
      updatedAt = updatedAt.map(_.truncatedTo(unit)),
×
42
      metaNextRetry = metaNextRetry.map(_.truncatedTo(unit)),
1✔
43
    )
44
}
45

46
object PresentationRecord {
47

48
  def make(
1✔
49
      id: DidCommID,
50
      createdAt: Instant,
51
      updatedAt: Option[Instant],
52
      thid: DidCommID,
53
      schemaId: Option[String],
54
      connectionId: Option[String],
55
      role: Role,
56
      protocolState: ProtocolState,
57
      credentialFormat: CredentialFormat,
58
      invitation: Option[Invitation],
59
      requestPresentationData: Option[RequestPresentation],
60
      proposePresentationData: Option[ProposePresentation],
61
      presentationData: Option[Presentation],
62
      credentialsToUse: Option[List[String]],
63
      anoncredCredentialsToUseJsonSchemaId: Option[String],
64
      anoncredCredentialsToUse: Option[AnoncredCredentialProofs],
65
      sdJwtClaimsToUseJsonSchemaId: Option[String],
66
      sdJwtClaimsToDisclose: Option[SdJwtCredentialToDisclose],
67
      metaRetries: Int,
68
      metaNextRetry: Option[Instant],
69
      metaLastFailure: Option[Failure]
70
  ): URIO[WalletAccessContext, PresentationRecord] =
71
    ZIO.serviceWith[WalletAccessContext] { walletAccessContext =>
1✔
72
      PresentationRecord(
73
        id,
74
        createdAt,
75
        updatedAt,
76
        thid,
77
        schemaId,
78
        connectionId,
79
        role,
80
        protocolState,
81
        credentialFormat,
82
        invitation,
83
        requestPresentationData,
84
        proposePresentationData,
85
        presentationData,
86
        credentialsToUse,
87
        anoncredCredentialsToUseJsonSchemaId,
88
        anoncredCredentialsToUse,
89
        sdJwtClaimsToUseJsonSchemaId,
90
        sdJwtClaimsToDisclose,
91
        metaRetries,
92
        metaNextRetry,
93
        metaLastFailure,
94
        walletAccessContext.walletId,
95
      )
96
    }
97

98
  enum Role:
99
    case Verifier extends Role
100
    case Prover extends Role
101

102
  enum ProtocolState:
103
    // Prover has created a Proposal in a database, but it has not been sent yet (in Prover DB)
104
    case ProposalPending extends ProtocolState
105
    // Prover has sent an proposal to a Verifier (in Prover DB)
106
    case ProposalSent extends ProtocolState
107
    // Verifier has received a proposal (In Verifier DB)
108
    case ProposalReceived extends ProtocolState
109
    // Verifier has received a proposal and has rejected (In Verifier DB)
110
    case ProposalRejected extends ProtocolState // TODO start propose presentation
111

112
    // Verifier has created a Presentation request  (in Verfier DB)
113
    case RequestPending extends ProtocolState
114
    // Verifier has sent a request to a an Prover (in Verfier DB)
115
    case RequestSent extends ProtocolState
116
    // Prover has received a request from the Verifier (In Verifier DB)
117
    case RequestReceived extends ProtocolState
118
    // Prover has rejected a presentation request from the Verifier (In prover DB)
119
    case RequestRejected extends ProtocolState // TODO start propose presentation
120

121
    // Prover/Verifier declined the Presentation request/ Proposed Presenation  by Verifier/Prover (DB)
122
    case ProblemReportPending extends ProtocolState
123
    // Prover/Verifier has sent problem report to Verifier/Prover (Verifier/Prover DB)
124
    case ProblemReportSent extends ProtocolState
125
    // Prover/Verifier has received problem resport from Verifier/Prover (DB)
126
    case ProblemReportReceived extends ProtocolState
127

128
    // Prover has "accepted" a Presentation request received from a Verifier (Prover DB)
129
    case PresentationPending extends ProtocolState
130
    // Prover has generated (signed) the VC  and is now ready to send it to the Verifier (Prover DB)
131
    case PresentationGenerated extends ProtocolState
132
    // Prover has sent the Presentation (Prover DB)
133
    case PresentationSent extends ProtocolState
134
    // Verifier has received the presentation (Verifier DB)
135
    case PresentationReceived extends ProtocolState
136
    // Verifier has verified the presentation (proof) (Verifier DB)
137
    case PresentationVerified extends ProtocolState
138
    // Verifier has updated Verification failed in the presentation (proof) (Verifier DB)
139
    case PresentationVerificationFailed extends ProtocolState
140
    // Verifier has accepted the verified presentation (proof) (Verifier DB)
141
    case PresentationAccepted extends ProtocolState
142
    // Verifier has rejected the presentation (proof) (Verifier DB)
143
    case PresentationRejected extends ProtocolState // TODO send problem report
144

145
    // Verifier has created a OOB Presentation request  (in Verifier DB)
146
    case InvitationGenerated extends ProtocolState
147
    // Verifier receives a presentation from an expired OOB Presentation request (update Verifier DB) //TODO send problem report
148
    case InvitationExpired extends ProtocolState
149

150
}
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