fmgp.did.method.prism

Members list

Type members

Classlikes

final case class BlockfrostConfig(token: String, ryo: Option[BlockfrostRyoConfig])

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class BlockfrostRyoConfig(url: String, protocolMagic: Long)

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
case class DIDPrism(specificId: String) extends DID

DID Prism (only short form)

DID Prism (only short form)

Attributes

See also
Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait DID
class Object
trait Matchable
class Any
Show all
object DIDPrism

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
DIDPrism.type
class DIDPrismResolver(baseUrl: String, httpUtils: HttpUtils) extends Resolver

Attributes

Companion
object
Supertypes
trait Resolver
class Object
trait Matchable
class Any

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
class DIDResolverProxy(baseUrl: String, httpUtils: HttpUtils) extends Resolver

Attributes

Companion
object
Supertypes
trait Resolver
class Object
trait Matchable
class Any

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
object EventHash

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
EventHash.type
case class EventRef(b: Int, o: Int, eventHash: EventHash)

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object EventRef

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
EventRef.type

Attributes

Supertypes
trait Equiv[EventRef]
trait Serializable
trait Comparator[EventRef]
class Object
trait Matchable
class Any
Show all
Self type
object HttpUtils

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
HttpUtils.type
case class HttpUtils(client: Client, scope: Scope)

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class IndexerConfig(mBlockfrostConfig: Option[BlockfrostConfig], workdir: String)

Value parameters

mBlockfrostConfig

will contain the blockfrost API key

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Inspiration from Git

Inspiration from Git

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object PrismState

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
PrismState.type
trait PrismState extends PrismStateRead

Writable PRISM state interface extending PrismStateRead with event storage capabilities.

Writable PRISM state interface extending PrismStateRead with event storage capabilities.

Adds methods to persist blockchain events to the state backend. Events are added without validation, allowing implementations to handle ordering and chain integrity according to their storage strategy.

Attributes

Example
val state: PrismState = ???
val event: MySignedPrismEvent[CreateDidOP] = ???
for {
 _ <- state.addEvent(event)
 ssi <- state.getSSI(event.event.didPrism)
} yield ssi
Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
Self type
case class PrismStateFS() extends PrismStateRead

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class PrismStateHTTP(httpUtils: HttpUtils, pathEventsByDID: String) extends PrismStateRead

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
case class PrismStateInMemory(ref: Ref[PrismStateInMemoryData]) extends PrismState

Thread-safe in-memory implementation of PrismState using ZIO Ref.

Thread-safe in-memory implementation of PrismState using ZIO Ref.

Stores all events and indices in memory using immutable maps. Suitable for testing, development, and small datasets where persistence is not required. Not recommended for production use with large datasets.

==Event Chain Tracking==

This implementation tracks event chains by recursively following previousEventHash references:

  • Create operations establish the root of a chain
  • Update/Deactivate operations reference previous events
  • Helper methods ssiFromPreviousEventHash and vdrFromPreviousEventHash traverse chains to find roots

==Thread Safety==

All state updates use ZIO Ref for lock-free, thread-safe mutations. Multiple concurrent operations are safely handled without explicit locking.

Value parameters

ref

ZIO Ref containing mutable PrismStateInMemoryData

Attributes

Constructor

Creates in-memory state with ZIO Ref

Example
for {
 state <- PrismStateInMemory.empty
 _ <- state.addEvent(createEvent)
 _ <- state.addEvent(updateEvent)
 ssi <- state.getSSI(didSubject)
 docs <- state.didDocuments
} yield (ssi, docs)
Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait PrismState
class Object
trait Matchable
class Any
Show all

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
case class PrismStateInMemoryData(opHash2op: Map[String, MySignedPrismEvent[OP]], tx2eventRef: Map[String, Seq[EventRef]], ssi2eventRef: Map[DIDSubject, Seq[EventRef]], vdr2eventRef: Map[RefVDR, Seq[EventRef]])

Data container for in-memory PRISM state storage.

Data container for in-memory PRISM state storage.

Value parameters

opHash2op

Map of event hash (hex string) to signed events

ssi2eventRef

Map of DID subjects to their event references

tx2eventRef

Map of transaction ID to event references

vdr2eventRef

Map of VDR references to their event references

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
case class PrismStateMongoDB(reactiveMongoApi: ReactiveMongoApi) extends PrismState

MongoDB-backed implementation of PrismState for production use.

MongoDB-backed implementation of PrismState for production use.

This implementation uses a sophisticated two-collection strategy to Debug out-of-order blockchain events:

==Collections==

'''Main Collection (events):''' Stores events with known parent relationships. Each event is stored with a rootRef field that tracks the root event (Create operation) of its chain. This enables efficient querying of all events for a DID or VDR by querying on the rootRef field.

'''Lost Collection (events_lost):''' Stores orphaned events whose parent (referenced via previousEventHash) has not yet been seen. This handles the case where Update or Deactivate operations arrive before their corresponding Create operation.

==Event Chain Tracking==

Events form chains through previousEventHash references:

  • Create operations (CreateDidOP, CreateStorageEntryOP) start chains and have no previous hash
  • Update/Deactivate operations reference the previous event's hash
  • All events in a chain share the same rootRef (the hash of the Create event)

When adding an event:

  1. If it has no previousEventHash, it's inserted with rootRef = eventHash
  2. If it has a previousEventHash, we search for the parent event
  3. If parent exists, event is inserted with parent's rootRef
  4. If parent is missing, event goes to lost collection for potential later recovery

Value parameters

reactiveMongoApi

MongoDB connection wrapper using ReactiveMongo driver

Attributes

Constructor

Creates a MongoDB-backed PRISM state

Example
val mongoApi: ReactiveMongoApi = ???
val state = PrismStateMongoDB(mongoApi)
for {
 _ <- state.addEvent(createEvent)
 _ <- state.addEvent(updateEvent)
 ssi <- state.getSSI(didSubject)
} yield ssi
Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait PrismState
class Object
trait Matchable
class Any
Show all

Read-only interface for querying PRISM blockchain state.

Read-only interface for querying PRISM blockchain state.

This trait provides methods to query the state of PRISM DIDs (Decentralized Identifiers) and VDRs (Verifiable Data Registries) from an event-sourced storage backend. Events represent blockchain operations (create, update, deactivate) that form immutable chains tracked through hash references.

==Key Concepts==

'''SSI (Self-Sovereign Identity):''' A PRISM DID (e.g., did:prism:xxx) managed through CreateDidOP, UpdateDidOP, and DeactivateDidOP events. SSIs represent identity with keys and services.

'''VDR (Verifiable Data Registry):''' Storage entries owned by a DID, managed through CreateStorageEntryOP, UpdateStorageEntryOP, and DeactivateStorageEntryOP events. Used for storing arbitrary data on-chain.

'''Event Chains:''' Operations form chains via previousEventHash references. Create operations start chains; update/deactivate operations reference previous events. All events in a chain share the same root hash.

Attributes

Example
val state: PrismStateRead = ???
for {
 events <- state.getEventsForSSI(didSubject)
 ssi <- state.getSSI(didSubject)
 history <- state.getSSIHistory(didSubject)
} yield (events, ssi, history)
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object RefVDR

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
RefVDR.type
final case class SSI(did: DIDSubject, latestHash: Option[String], keys: Seq[UncompressedECKey | CompressedECKey], services: Seq[MyService], context: Seq[String], disabled: Boolean, cursor: EventCursor)

This is the SSI representing a DID PRISM

This is the SSI representing a DID PRISM

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Self type
SSI
object SSI

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
SSI.type
case class SSIHistory(did: DIDSubject, versions: Seq[SSI])

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object SSIHistory

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
SSIHistory.type
final case class VDR(id: RefVDR, did: Option[DIDPrism], latestVDRHash: Option[EventHash], cursor: EventCursor, nonce: Option[Array[Byte]], data: DataType, unsupportedValidationField: Boolean)

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Self type
VDR
object VDR

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
VDR.type

Types

opaque type EventHash
opaque type RefVDR