📄 DocumentStore
Before you can create or manage real-world identity documents, you need to set up repositories and storage for document types and documents. This should be done after initializing your secure storage components.
DocumentTypeRepository
A DocumentTypeRepository manages the metadata for different document types your app understands and uses.
- Standard Document Types: Multipaz provides a set of standard document types through the
multipaz-knowntypespackage, such as:DrivingLicenseEUCertificateOfResidencePhotoIDVaccinationDocumentVehicleRegistration
- Custom Document Types: You can define your own document types using the
DocumentType.Builderfactory method.
DocumentStore
A DocumentStore is responsible for securely holding and managing real-world identity documents, such as Mobile Driving Licenses (mDL), in accordance with the ISO/IEC 18013-5:2021 specification.
- Initialization: Create a
DocumentStoreinstance using either thebuildDocumentStorefunction or theDocumentStore.Builderclass. - Dependencies: Pass the previously-initialized
storageandsecureAreaRepositoryto theDocumentStore.
Implementation
class App {
// ...
lateinit var documentTypeRepository: DocumentTypeRepository
lateinit var documentStore: DocumentStore
suspend fun init() {
// ...
documentTypeRepository = DocumentTypeRepository().apply {
addDocumentType(DrivingLicense.getDocumentType())
}
documentStore = buildDocumentStore(
storage = storage,
secureAreaRepository = secureAreaRepository
) {}
}
}
By clearly structuring the setup of DocumentTypeRepository and DocumentStore, you ensure your app is ready to manage identity documents securely and efficiently. Always perform this setup early in your app lifecycle, after initializing storage and secure areas.
Refer to this DocumentStore code for the complete example.