CLASS
Contents
- Properties
knownDocTypes
docTypes
mdocModels
documentIds
hasData
hasWellKnownData
docCount
mdlModel
pidModel
otherModels
uiError
- Methods
init(storageService:)
loadDocuments()
getDocumentModel(index:)
getDocumentModel(docType:)
deleteDocument(docType:)
deleteDocument(index:)
deleteDocuments()
public class StorageManager: ObservableObject
Storage manager. Provides services and view models
public static let knownDocTypes = [EuPidModel.euPidDocType, IsoMdlModel.isoDocType]
public var docTypes: [String?] = []
Array of doc.types of documents loaded in the wallet
@Published public var mdocModels: [MdocDecodable?] = []
Array of document models loaded in the wallet
public var documentIds: [String?] = []
Array of document identifiers loaded in the wallet
@Published public var hasData: Bool = false
Whether wallet currently has loaded data
@Published public var hasWellKnownData: Bool = false
Whether wallet currently has loaded a document with doc.type included in the knownDocTypes
array
@Published public var docCount: Int = 0
Count of documents loaded in the wallet
@Published public var mdlModel: IsoMdlModel?
The driver license model loaded in the wallet
@Published public var pidModel: EuPidModel?
The PID model loaded in the wallet
@Published public var otherModels: [GenericMdocModel] = []
Other document models loaded in the wallet
@Published public var uiError: WalletError?
Error object with localized message
public init(storageService: any DataStorageService)
@discardableResult public func loadDocuments() async throws -> [WalletStorage.Document]?
Load documents from storage
Internally sets the docTypes
, mdocModels
, documentIds
, mdocModels
, mdlModel
, pidModel
variables
- Returns: An array of
WalletStorage.Document
objects
public func getDocumentModel(index: Int) -> MdocDecodable?
Get document model by index
- Parameter index: Index in array of loaded models
- Returns: The
MdocDecodable
model
Name | Description |
---|---|
index | Index in array of loaded models |
public func getDocumentModel(docType: String) -> MdocDecodable?
Get document model by docType
- Parameter docType: The docType of the document model to return
- Returns: The
MdocDecodable
model
Name | Description |
---|---|
docType | The docType of the document model to return |
public func deleteDocument(docType: String) async throws
Delete document by docType
- Parameter docType: Document type
Name | Description |
---|---|
docType | Document type |
public func deleteDocument(index: Int) async throws
Delete document by Index
- Parameter index: Index in array of loaded models
Name | Description |
---|---|
index | Index in array of loaded models |
public func deleteDocuments() async throws
Delete documenmts