Skip to content

Commit 4a55647

Browse files
committed
Rename components IssuanceMetadata to avoid confusion-conflicts with CredentialMetadata
1 parent ef10492 commit 4a55647

11 files changed

Lines changed: 105 additions & 130 deletions

File tree

wallet-core/src/main/java/eu/europa/ec/eudi/wallet/EudiWallet.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import eu.europa.ec.eudi.wallet.dcapi.DCAPIRegistration
2828
import eu.europa.ec.eudi.wallet.dcapi.DCAPIRequestProcessor
2929
import eu.europa.ec.eudi.wallet.dcapi.DocumentManagerWithDCAPI
3030
import eu.europa.ec.eudi.wallet.dcapi.getDefaultPrivilegedUserAgents
31-
import eu.europa.ec.eudi.wallet.issue.openid4vci.reissue.DocumentManagerWithReissuance
31+
import eu.europa.ec.eudi.wallet.issue.openid4vci.reissue.DocumentManagerWithMetadataCleanup
3232
import eu.europa.ec.eudi.wallet.document.DocumentId
3333
import eu.europa.ec.eudi.wallet.document.DocumentManager
3434
import eu.europa.ec.eudi.wallet.document.IssuedDocument
@@ -361,24 +361,24 @@ interface EudiWallet : SampleDocumentManager, PresentationManager, DocumentStatu
361361
ensureStrongBoxIsSupported(loggerToUse)
362362
ensureUserAuthIsSupported(loggerToUse)
363363

364-
// Create shared reissuance storage (used by both the wrapper and OpenId4VciManager)
365-
val reissuanceStorage = config.openId4VciConfig?.reissuanceMetadataStorage ?: run {
364+
// Create shared issuance metadata storage (used by both the wrapper and OpenId4VciManager)
365+
val issuanceMetadataStorage = config.openId4VciConfig?.issuanceMetadataStorage ?: run {
366366
val storagePath = File(
367367
context.noBackupFilesDir,
368-
"reissuance_metadata.db"
368+
"issuance_metadata.db"
369369
).absolutePath
370370
AndroidStorage(storagePath)
371371
}
372372

373373
val documentManagerToUse =
374374
(documentManager ?: getDefaultDocumentManager(storage, secureAreas))
375375
.let { manager ->
376-
// Always wrap with reissuance metadata cleanup.
376+
// Always wrap with metadata cleanup.
377377
// OpenId4VciManager may be created later via createOpenId4VciManager(),
378378
// so we cannot gate this on config.openId4VciConfig being set at build time.
379-
DocumentManagerWithReissuance(
379+
DocumentManagerWithMetadataCleanup(
380380
delegate = manager,
381-
reissuanceStorage = reissuanceStorage,
381+
issuanceMetadataStorage = issuanceMetadataStorage,
382382
logger = loggerToUse
383383
)
384384
}
@@ -417,7 +417,7 @@ interface EudiWallet : SampleDocumentManager, PresentationManager, DocumentStatu
417417
documentStatusResolver = documentStatusResolverToUse,
418418
transactionLogger = transactionLogger,
419419
ktorHttpClientFactory = ktorHttpClientFactory,
420-
reissuanceStorage = reissuanceStorage
420+
issuanceMetadataStorage = issuanceMetadataStorage
421421
)
422422
}
423423

wallet-core/src/main/java/eu/europa/ec/eudi/wallet/EudiWalletImpl.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class EudiWalletImpl internal constructor(
5959
override val walletKeyManager: WalletKeyManager,
6060
val transactionLogger: TransactionLogger?,
6161
val ktorHttpClientFactory: (() -> HttpClient)?,
62-
val reissuanceStorage: Storage?,
62+
val issuanceMetadataStorage: Storage?,
6363
) : EudiWallet, DocumentManager, PresentationManager by presentationManager,
6464
SampleDocumentManager by SampleDocumentManagerImpl(documentManager),
6565
DocumentStatusResolver by documentStatusResolver {
@@ -99,9 +99,9 @@ class EudiWalletImpl internal constructor(
9999
"OpenId4Vci configuration is missing. Please provide a config parameter or configure it in EudiWalletConfig."
100100
)
101101

102-
// Inject the shared reissuance storage into the config if not already set
103-
val configWithStorage = if (reissuanceStorage != null && resolvedConfig.reissuanceMetadataStorage == null) {
104-
resolvedConfig.copy(reissuanceMetadataStorage = reissuanceStorage)
102+
// Inject the shared issuance metadata storage into the config if not already set
103+
val configWithStorage = if (issuanceMetadataStorage != null && resolvedConfig.issuanceMetadataStorage == null) {
104+
resolvedConfig.copy(issuanceMetadataStorage = issuanceMetadataStorage)
105105
} else resolvedConfig
106106

107107
val httpClientFactory = ktorHttpClientFactory ?: this.ktorHttpClientFactory

wallet-core/src/main/java/eu/europa/ec/eudi/wallet/issue/openid4vci/DefaultOpenId4VciManager.kt

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import eu.europa.ec.eudi.wallet.internal.wrappedWithLogging
4141
import eu.europa.ec.eudi.wallet.issue.openid4vci.IssueEvent.Companion.failure
4242
import eu.europa.ec.eudi.wallet.issue.openid4vci.OpenId4VciManager.Companion.TAG
4343
import eu.europa.ec.eudi.wallet.issue.openid4vci.dpop.DPopConfig
44-
import eu.europa.ec.eudi.wallet.issue.openid4vci.reissue.ReissuanceConfig
44+
import eu.europa.ec.eudi.wallet.issue.openid4vci.reissue.IssuanceMetadata
4545
import eu.europa.ec.eudi.wallet.issue.openid4vci.reissue.ReissuanceIssuer
4646
import eu.europa.ec.eudi.wallet.logging.Logger
4747
import eu.europa.ec.eudi.wallet.provider.WalletAttestationsProvider
@@ -96,14 +96,14 @@ internal class DefaultOpenId4VciManager(
9696
}
9797

9898
/**
99-
* Storage for re-issuance metadata.
99+
* Storage for issuance metadata.
100100
* If not configured in [config], uses a default AndroidStorage with a separate database file.
101101
*/
102-
private val reissuanceStorage: Storage by lazy {
103-
config.reissuanceMetadataStorage ?: run {
102+
private val issuanceMetadataStorage: Storage by lazy {
103+
config.issuanceMetadataStorage ?: run {
104104
val storagePath = File(
105105
context.noBackupFilesDir,
106-
"reissuance_metadata.db"
106+
"issuance_metadata.db"
107107
).absolutePath
108108
AndroidStorage(storagePath)
109109
}
@@ -273,7 +273,7 @@ internal class DefaultOpenId4VciManager(
273273
)
274274
} ?: deferredContext,
275275
logger = logger,
276-
reissuanceStorage = reissuanceStorage,
276+
issuanceMetadataStorage = issuanceMetadataStorage,
277277
).process(deferredDocument, deferredContext.keyAliases, outcome)
278278
}
279279
}
@@ -315,22 +315,22 @@ internal class DefaultOpenId4VciManager(
315315
) {
316316
launch(executor, onIssueEvent) { coroutineScope, listener ->
317317
try {
318-
// Load re-issuance config from storage
319-
val reissuanceConfig = loadReissuanceConfig(documentId)
320-
?: throw IllegalStateException("No re-issuance metadata found for document $documentId")
318+
// Load issuance metadata from storage
319+
val issuanceMetadata = loadIssuanceMetadata(documentId)
320+
?: throw IllegalStateException("No issuance metadata found for document $documentId")
321321

322-
logger?.d(TAG, "Loaded reissuanceConfig: credentialIssuerId=${reissuanceConfig.credentialIssuerId}")
322+
logger?.d(TAG, "Loaded issuanceMetadata: credentialIssuerId=${issuanceMetadata.credentialIssuerId}")
323323

324-
// Reconstruct AuthorizedRequest from stored config
325-
var authorizedRequest = ReissuanceIssuer.reconstructAuthorizedRequest(reissuanceConfig)
324+
// Reconstruct AuthorizedRequest from stored metadata
325+
var authorizedRequest = ReissuanceIssuer().reconstructAuthorizedRequest(issuanceMetadata)
326326

327327
// Create Issuer using IssuerCreator (resolves issuer metadata)
328328
// Pass existing DPoP key alias so the same key is reused
329329
// (access token is bound to original key's thumbprint)
330330
val issuer = issuerCreator.createIssuer(
331-
reissuanceConfig.credentialIssuerId,
332-
listOf(CredentialConfigurationIdentifier(reissuanceConfig.credentialConfigurationIdentifier)),
333-
existingDpopKeyAlias = reissuanceConfig.dPoPKeyAlias
331+
issuanceMetadata.credentialIssuerId,
332+
listOf(CredentialConfigurationIdentifier(issuanceMetadata.credentialConfigurationIdentifier)),
333+
existingDpopKeyAlias = issuanceMetadata.dPoPKeyAlias
334334
)
335335
val offer = Offer(issuer.credentialOffer)
336336

@@ -380,7 +380,7 @@ internal class DefaultOpenId4VciManager(
380380
issuer = issuer,
381381
documentToConfigurationMap = requestMap,
382382
dpopKeyAlias = issuerCreator.dpopKeyAlias,
383-
reissuanceStorage = reissuanceStorage,
383+
issuanceMetadataStorage = issuanceMetadataStorage,
384384
clientAuthentication = issuerCreator.clientAuthentication,
385385
replacesDocumentId = documentId,
386386
).process(response)
@@ -431,15 +431,15 @@ internal class DefaultOpenId4VciManager(
431431
}
432432

433433
/**
434-
* Loads re-issuance configuration from storage.
434+
* Loads issuance metadata from storage.
435435
*
436436
* @param documentId The document ID
437-
* @return The re-issuance config, or null if not found
437+
* @return The issuance metadata, or null if not found
438438
*/
439-
private suspend fun loadReissuanceConfig(documentId: DocumentId): ReissuanceConfig? {
440-
val table = reissuanceStorage.getTable(ReissuanceConfig.STORAGE_TABLE_SPEC)
439+
private suspend fun loadIssuanceMetadata(documentId: DocumentId): IssuanceMetadata? {
440+
val table = issuanceMetadataStorage.getTable(IssuanceMetadata.STORAGE_TABLE_SPEC)
441441
val bytes = table.get(documentId) ?: return null
442-
return ReissuanceConfig.fromByteArray(bytes.toByteArray())
442+
return IssuanceMetadata.fromByteArray(bytes.toByteArray())
443443
}
444444

445445
/**
@@ -478,7 +478,7 @@ internal class DefaultOpenId4VciManager(
478478
issuer = issuer,
479479
documentToConfigurationMap = requestMap,
480480
dpopKeyAlias = issuerCreator.dpopKeyAlias,
481-
reissuanceStorage = reissuanceStorage,
481+
issuanceMetadataStorage = issuanceMetadataStorage,
482482
clientAuthentication = issuerCreator.clientAuthentication,
483483
).process(response)
484484
listener(IssueEvent.Finished(issuedDocumentIds + deferredDocumentIds))

wallet-core/src/main/java/eu/europa/ec/eudi/wallet/issue/openid4vci/OpenId4VciManager.kt

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ interface OpenId4VciManager {
429429
val authorizationHandler: AuthorizationHandler? = null,
430430
val dpopConfig: DPopConfig = DPopConfig.Default,
431431
@ParUsage val parUsage: Int = IF_SUPPORTED,
432-
val reissuanceMetadataStorage: Storage? = null,
432+
val issuanceMetadataStorage: Storage? = null,
433433
) {
434434
/**
435435
* PAR usage for the OpenId4Vci issuer
@@ -542,7 +542,7 @@ interface OpenId4VciManager {
542542
@ParUsage
543543
var parUsage: Int = IF_SUPPORTED
544544

545-
var reissuanceMetadataStorage: Storage? = null
545+
var issuanceMetadataStorage: Storage? = null
546546

547547
/**
548548
* Set the issuer url
@@ -671,7 +671,7 @@ interface OpenId4VciManager {
671671
}
672672

673673
/**
674-
* Sets the storage for credential re-issuance metadata.
674+
* Sets the storage for issuance metadata.
675675
*
676676
* When configured, the library will automatically store metadata after successful
677677
* credential issuance, enabling credentials to be re-issued later without requiring
@@ -684,18 +684,16 @@ interface OpenId4VciManager {
684684
* - DPoP key alias (if DPoP was used)
685685
* - Client attestation information (if attestation-based auth was used)
686686
*
687-
* **Storage Key Format**: `"reissuance_<documentId>"`
688-
*
689687
* If not set, a default [org.multipaz.storage.android.AndroidStorage] will be used
690-
* with a separate database file for re-issuance metadata.
688+
* with a separate database file for issuance metadata.
691689
*
692-
* @param storage The [Storage] implementation for re-issuance metadata, or null to use default
690+
* @param storage The [Storage] implementation for issuance metadata, or null to use default
693691
* @return This builder instance for method chaining
694692
* @see Storage
695-
* @see eu.europa.ec.eudi.wallet.issue.openid4vci.reissue.ReissuanceConfig
693+
* @see eu.europa.ec.eudi.wallet.issue.openid4vci.reissue.IssuanceMetadata
696694
*/
697-
fun withReissuanceMetadataStorage(storage: Storage?) = apply {
698-
this.reissuanceMetadataStorage = storage
695+
fun withIssuanceMetadataStorage(storage: Storage?) = apply {
696+
this.issuanceMetadataStorage = storage
699697
}
700698

701699
/**
@@ -715,7 +713,7 @@ interface OpenId4VciManager {
715713
authFlowRedirectionURI = authFlowRedirectionURI,
716714
dpopConfig = dpopConfig,
717715
parUsage = parUsage,
718-
reissuanceMetadataStorage = reissuanceMetadataStorage
716+
issuanceMetadataStorage = issuanceMetadataStorage
719717
)
720718
}
721719
}

wallet-core/src/main/java/eu/europa/ec/eudi/wallet/issue/openid4vci/ProcessDeferredOutcome.kt

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import eu.europa.ec.eudi.wallet.document.DeferredDocument
2323
import eu.europa.ec.eudi.wallet.document.DocumentManager
2424
import eu.europa.ec.eudi.wallet.internal.d
2525
import eu.europa.ec.eudi.wallet.issue.openid4vci.OpenId4VciManager.Companion.TAG
26-
import eu.europa.ec.eudi.wallet.issue.openid4vci.reissue.ReissuanceConfig
26+
import eu.europa.ec.eudi.wallet.issue.openid4vci.reissue.IssuanceMetadata
2727
import eu.europa.ec.eudi.wallet.logging.Logger
2828
import kotlinx.coroutines.CoroutineScope
2929
import kotlinx.coroutines.Dispatchers
@@ -36,7 +36,7 @@ internal class ProcessDeferredOutcome(
3636
val callback: OpenId4VciManager.OnResult<DeferredIssueResult>,
3737
val deferredContext: DeferredContext?,
3838
val logger: Logger? = null,
39-
val reissuanceStorage: Storage? = null,
39+
val issuanceMetadataStorage: Storage? = null,
4040
) {
4141

4242
fun process(
@@ -87,10 +87,10 @@ internal class ProcessDeferredOutcome(
8787
logger?.d(TAG, "Deleted old document $oldDocId after deferred re-issuance")
8888
}
8989

90-
// Store re-issuance metadata so the new document can be re-issued later
91-
if (reissuanceStorage != null && deferredContext != null) {
90+
// Store issuance metadata so the new document can be re-issued later
91+
if (issuanceMetadataStorage != null && deferredContext != null) {
9292
CoroutineScope(Dispatchers.IO).launch {
93-
storeReissuanceMetadata(document.id, deferredContext, keyAliases)
93+
storeIssuanceMetadata(document.id, deferredContext, keyAliases)
9494
}
9595
}
9696

@@ -111,12 +111,12 @@ internal class ProcessDeferredOutcome(
111111
}
112112
}
113113

114-
private suspend fun storeReissuanceMetadata(
114+
private suspend fun storeIssuanceMetadata(
115115
documentId: String,
116116
deferredContext: DeferredContext,
117117
keyAliases: List<String>,
118118
) {
119-
val storage = reissuanceStorage ?: return
119+
val storage = issuanceMetadataStorage ?: return
120120
val credentialConfigId = deferredContext.credentialConfigurationIdentifier ?: return
121121
val credentialEndpoint = deferredContext.credentialEndpoint ?: return
122122

@@ -131,7 +131,7 @@ internal class ProcessDeferredOutcome(
131131
else -> auth.id to null
132132
}
133133

134-
val reissuanceConfig = ReissuanceConfig(
134+
val issuanceMetadata = IssuanceMetadata(
135135
credentialIssuerId = cfg.credentialIssuerId.toString(),
136136
credentialConfigurationIdentifier = credentialConfigId,
137137
credentialEndpoint = credentialEndpoint,
@@ -157,17 +157,17 @@ internal class ProcessDeferredOutcome(
157157
},
158158
)
159159

160-
val table = storage.getTable(ReissuanceConfig.STORAGE_TABLE_SPEC)
161-
table.insert(key = documentId, data = ByteString(reissuanceConfig.toByteArray()))
160+
val table = storage.getTable(IssuanceMetadata.STORAGE_TABLE_SPEC)
161+
table.insert(key = documentId, data = ByteString(issuanceMetadata.toByteArray()))
162162

163-
logger?.d(TAG, "Stored re-issuance metadata for deferred document $documentId")
163+
logger?.d(TAG, "Stored issuance metadata for deferred document $documentId")
164164
}.onFailure { error ->
165165
logger?.log(
166166
Logger.Record(
167167
level = Logger.Companion.LEVEL_ERROR,
168-
message = "Failed to store re-issuance metadata for deferred document $documentId: ${error.message}",
168+
message = "Failed to store issuance metadata for deferred document $documentId: ${error.message}",
169169
sourceClassName = "ProcessDeferredOutcome",
170-
sourceMethod = "storeReissuanceMetadata",
170+
sourceMethod = "storeIssuanceMetadata",
171171
thrown = error
172172
)
173173
)

0 commit comments

Comments
 (0)