DidDocumentStorage
interface DidDocumentStorage
Interface for DID document storage backends.
Provides abstraction for document persistence, allowing different storage implementations (in-memory, database, Redis, S3, IPFS, blockchain, etc.).
Storage Backend Types:
In-Memory: Fast, ephemeral (for testing)
Database: Persistent, queryable (PostgreSQL, MySQL)
Redis: Fast, cache-like (for high-performance scenarios)
S3/Cloud Storage: Scalable, versioned (for large-scale deployments)
IPFS: Decentralized, content-addressed (for decentralized storage)
Blockchain: Immutable, tamper-proof (for anchoring)
Example Usage:
val storage: DidDocumentStorage = DatabaseDocumentStorage(dataSource)
// Store a document
storage.store(
did = Did("did:web:example.com"),
document = didDocument,
metadata = DidDocumentMetadata(created = Clock.System.now())
)
// Retrieve a document
val (document, metadata) = storage.get(Did("did:web:example.com"))
?: throw Exception("DID not found")Content copied to clipboard