DidEventBus

interface DidEventBus

DID Event Bus.

Provides event-driven architecture for DID lifecycle events, enabling decoupled communication between components.

Event Types:

  • DID Created

  • DID Updated

  • DID Deactivated

  • Verification Method Added/Removed

  • Service Added/Removed

Use Cases:

  • Webhook notifications

  • Cache invalidation

  • Audit logging

  • Integration with external systems

  • Real-time updates

Example Usage:

val eventBus = DefaultDidEventBus()

// Subscribe to events
eventBus.events.collect { event ->
when (event) {
is DidEvent.Created -> println("DID created: ${event.did}")
is DidEvent.Updated -> println("DID updated: ${event.did}")
}
}

// Publish event
eventBus.publish(DidEvent.Created(did = Did("did:web:example.com")))

Inheritors

Properties

Link copied to clipboard
abstract val events: Flow<DidEvent>

Flow of DID events.

Functions

Link copied to clipboard
abstract suspend fun publish(event: DidEvent)

Publish an event.

Link copied to clipboard
abstract fun <T : DidEvent> subscribe(eventType: Class<T>): Flow<T>

Subscribe to events of a specific type.

Link copied to clipboard
inline fun <T : DidEvent> DidEventBus.subscribe(): Flow<T>

Extension function for type-safe event subscription.