SPI Interfaces
The SPI (Service Provider Interface) interfaces are shared service and plugin abstractions that
other TrustWeave modules implement or consume. These interfaces are included in trustweave-common.
Note: SPI interfaces are included in trustweave-common. You don’t need a separate dependency for SPI functionality. The interfaces are automatically available when you include trustweave-common or other TrustWeave modules.
Result: SPI interfaces are available through trustweave-common so you can register custom DID methods, KMS providers, or blockchain clients without pulling in the higher-level modules.
Responsibilities
- DID methods:
DidMethodProviderimplementations can be discovered withServiceLoaderand registered onDidMethodRegistry(seedid-core). - Shared plugin helpers in
trustweave-common: metadata, configuration loading, provider chaining (org.trustweave.core.plugin). - Factories wired through
TrustWeave.build { factories(...) }(for exampleWalletFactoryinorg.trustweave.wallet.services).
Typical Usage
1
2
3
4
5
6
7
8
import kotlinx.coroutines.runBlocking
import org.trustweave.did.registry.DidMethodRegistry
import org.trustweave.testkit.kms.InMemoryKeyManagementService
// Register every DidMethodProvider on the classpath (META-INF/services)
val registry = runBlocking {
DidMethodRegistry.autoRegister(kms = InMemoryKeyManagementService()).registry
}
What this does: Uses ServiceLoader internally, calls each provider’s create for its supportedMethods, and registers the resulting DidMethod instances (skipping providers whose required environment variables are missing).
Outcome: DID method JARs with SPI metadata are picked up automatically; in apps you normally still obtain a registry through TrustWeave.build { } rather than constructing this by hand.
Dependencies
SPI interfaces are included in trustweave-common. All other modules that interact
with service abstractions depend on trustweave-common (which includes the SPI interfaces).
Next Steps
- Explore
TrustWeave-trustfor trust runtime built on top of the SPI layer. - Review
TrustWeave-commonto see how credential features consume the SPI interfaces.