Result: Your project can implement and register custom credential providers using the SPI documented below. SPI interfaces are included in trustweave-core.
Core Interfaces
CredentialService
Implementations perform issuance, verification, and presentation operations.
Master toggle so providers can return null when disabled. Defaults to true.
priority
Int?
Optional load-order hint when multiple providers are registered.
endpoint
String?
Base URL or connection identifier for remote services.
apiKey
String?
Secret token or credential used during initialization.
additionalProperties
Map<String, Any?>
Provider specific data injected via property("name", value).
Providers may throw IllegalArgumentException when required fields (endpoint, apiKey) are missing. Use typed builder setters to catch issues at compile time.
Providers can still interoperate with code that expects maps through toLegacyMap():
1
vallegacy=options.toLegacyMap()// Useful when delegating to an adapter that still consumes Map<String, Any?>
Provider Implementation Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
classHttpIssuerProvider:CredentialServiceProvider{overridevalname:String="httpIssuer"overridefuncreate(options:CredentialServiceCreationOptions):CredentialService?{if(!options.enabled)returnnullvalendpoint=options.endpoint?:returnnullvalapiKey=options.apiKey?:error("apiKey is required for $name")valbatchSize=options.additionalProperties["batchSize"]as?Int?:50returnHttpCredentialIssuer(httpClient=buildClient(endpoint,apiKey,batchSize))}}
Consumption from TrustWeave
When the provider is on the classpath, CredentialServiceRegistry and the TrustWeave facade automatically hand it the typed options:
additionalOptions on the issuance/verification options remain a map because they carry per-call data, whereas the provider-level configuration is now strongly typed.
Related samples
QuickStartSample demonstrates issuance, verification, and anchoring using the default in-memory provider chain.