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

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

17 Apr 2024 09:15AM UTC coverage: 31.196% (-0.3%) from 31.477%
8719402531

Pull #966

patlo-iog
feat: key management for Ed25519 and X25519

fix: support jwk okp for ECCompressKeyData in DID doc

feat: store random key via jdbc

build: move json from shared to castor

fix: store actual jwk with RLS added

chore: remove redendant implicits

wip: get key metadata

wip: read key from jdbc secret storage

chore: remove in-memory impl

chore: use external lib for jwk

feat: get keypair of any type

fix: non secret sql

feat: support update-operation with new key type

chore: cleanup

fix: managed did curve usage validation

feat: store did secret vault impl

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

171 of 471 new or added lines in 23 files covered. (36.31%)

670 existing lines in 115 files now uncovered.

4490 of 14393 relevant lines covered (31.2%)

0.31 hits per line

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

70.59
/prism-agent/service/wallet-api/src/main/scala/io/iohk/atala/agent/walletapi/model/Entity.scala
1
package io.iohk.atala.agent.walletapi.model
2

3
import io.iohk.atala.shared.models.{WalletAccessContext, WalletId}
4
import zio.*
5

6
import java.time.Instant
7
import java.time.temporal.ChronoUnit
8
import java.util.UUID
9

10
enum EntityRole {
11
  case Admin extends EntityRole
12
  case Tenant extends EntityRole
13
}
14

15
trait BaseEntity {
16
  def id: UUID
17
  def role: Either[String, EntityRole]
18
}
19

20
case class Entity(id: UUID, name: String, walletId: UUID, createdAt: Instant, updatedAt: Instant) extends BaseEntity {
×
21
  def withUpdatedAt(updatedAt: Instant = Instant.now()): Entity = copy(updatedAt = updatedAt)
1✔
22
  def withTruncatedTimestamp(unit: ChronoUnit = ChronoUnit.MICROS): Entity =
1✔
23
    copy(createdAt = createdAt.truncatedTo(unit), updatedAt.truncatedTo(unit))
24

1✔
25
  def role: Either[String, EntityRole] =
×
UNCOV
26
    if (this == Entity.Admin) Right(EntityRole.Admin)
×
27
    else Right(EntityRole.Tenant)
28
}
29

30
object Entity {
31

1✔
32
  val ZeroWalletId: UUID = WalletId.default.toUUID
33

×
34
  def apply(id: UUID, name: String, walletId: UUID): Entity =
×
35
    Entity(id, name, walletId, Instant.now(), Instant.now()).withTruncatedTimestamp()
36

1✔
37
  def apply(name: String, walletId: UUID): Entity =
1✔
38
    apply(UUID.randomUUID(), name, walletId, Instant.now(), Instant.now()).withTruncatedTimestamp()
39

1✔
40
  def apply(name: String): Entity =
1✔
41
    Entity(UUID.randomUUID(), name, ZeroWalletId, Instant.now(), Instant.now()).withTruncatedTimestamp()
42

43
  val Default =
44
    Entity(
1✔
45
      UUID.fromString("00000000-0000-0000-0000-000000000000"),
46
      "default",
47
      ZeroWalletId,
48
      Instant.EPOCH,
49
      Instant.EPOCH
50
    )
51
  val Admin =
1✔
52
    Entity(UUID.fromString("00000000-0000-0000-0000-000000000001"), "admin", ZeroWalletId, Instant.EPOCH, Instant.EPOCH)
53

54
  extension (entity: Entity) {
1✔
55
    def walletAccessContext: WalletAccessContext = WalletAccessContext(WalletId.fromUUID(entity.walletId))
1✔
56
    def wacLayer: ULayer[WalletAccessContext] = ZLayer.succeed(walletAccessContext)
57
  }
58
}
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