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

hyperledger / identus-cloud-agent / 10793991050

10 Sep 2024 01:56PM CUT coverage: 48.504% (-4.5%) from 52.962%
10793991050

push

web-flow
build: sbt and plugins dependency update (#1337)

Signed-off-by: Hyperledger Bot <hyperledger-bot@hyperledger.org>
Signed-off-by: Yurii Shynbuiev <yurii.shynbuiev@iohk.io>
Co-authored-by: Hyperledger Bot <hyperledger-bot@hyperledger.org>
Co-authored-by: Yurii Shynbuiev <yurii.shynbuiev@iohk.io>

7406 of 15269 relevant lines covered (48.5%)

0.49 hits per line

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

0.0
/mercury/models/src/main/scala/org/hyperledger/identus/mercury/DidOps.scala
1
package org.hyperledger.identus.mercury
2

3
import org.hyperledger.identus.mercury.model.*
4
import zio.*
5

6
import java.util.Base64
7
import scala.util.{Failure, Success, Try}
8

9
/** Represents all possible DIDComm operations */
10
trait DidOps {
11
  def packSigned(msg: Message): URIO[DidAgent, SignedMesage]
12
  def packEncrypted(msg: Message, to: DidId): URIO[DidAgent, EncryptedMessage]
13
  // TODO theoretically DidAgent is not needed for packEncryptedAnon
14
  def packEncryptedAnon(msg: Message, to: DidId): URIO[DidAgent, EncryptedMessage]
15
  def unpack(str: String): URIO[DidAgent, UnpackMessage]
16
  def unpackBase64(dataBase64: String): RIO[DidAgent, UnpackMessage] = {
×
17
    val mDecoder = Option(Base64.getUrlDecoder) // can be null
×
18
    Try(mDecoder.map(_.decode(dataBase64))) match
×
19
      case Failure(ex: IllegalArgumentException) => ZIO.fail(ex)
×
20
      case Failure(ex)                           => ZIO.fail(ex)
×
21
      case Success(None)                         => ZIO.fail(new NullPointerException())
×
22
      case Success(Some(data))                   => unpack(new String(data))
×
23
  }
24
}
25

26
object DidOps {
27

28
  def packSigned(msg: Message): URIO[DidOps & DidAgent, SignedMesage] =
×
29
    ZIO.service[DidOps].flatMap(_.packSigned(msg))
×
30
  // ZIO.serviceWithZIO(_.packSigned(msg))
31

32
  def packEncrypted(msg: Message, to: DidId): URIO[DidOps & DidAgent, EncryptedMessage] =
×
33
    ZIO.service[DidOps].flatMap(_.packEncrypted(msg, to))
×
34
  // ZIO.serviceWithZIO(_.packEncrypted(msg, to))
35

36
  def packEncryptedAnon(msg: Message, to: DidId): URIO[DidOps & DidAgent, EncryptedMessage] =
×
37
    ZIO.service[DidOps].flatMap(_.packEncryptedAnon(msg, to))
×
38
  // ZIO.serviceWithZIO(_.packEncryptedAnon(msg, to))
39

40
  def unpack(str: String): URIO[DidOps & DidAgent, UnpackMessage] =
×
41
    ZIO.service[DidOps].flatMap(_.unpack(str))
×
42
  // ZIO.serviceWithZIO(_.unpack(str))
43

44
  def unpackBase64(base64str: String): RIO[DidOps & DidAgent, UnpackMessage] =
×
45
    ZIO.service[DidOps].flatMap(_.unpackBase64(base64str))
×
46
  // ZIO.serviceWithZIO(_.unpackBase64(base64str))
47

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