diff --git a/src/main/kotlin/id/walt/credentials/w3c/builder/W3CCredentialBuilder.kt b/src/main/kotlin/id/walt/credentials/w3c/builder/W3CCredentialBuilder.kt index e61acb71..301bce50 100644 --- a/src/main/kotlin/id/walt/credentials/w3c/builder/W3CCredentialBuilder.kt +++ b/src/main/kotlin/id/walt/credentials/w3c/builder/W3CCredentialBuilder.kt @@ -1,6 +1,5 @@ package id.walt.credentials.w3c.builder -import id.walt.common.asMap import id.walt.common.createBaseToken import id.walt.credentials.w3c.* import id.walt.model.credential.status.CredentialStatus @@ -46,7 +45,7 @@ class W3CCredentialBuilderWithCredentialStatus simpleStatus.create(parameter) - is StatusListEntryFactoryParameter -> statusList2021.create(parameter) + fun create(parameter: CredentialStatusFactoryParameter): Map = when (parameter) { + is SimpleStatusFactoryParameter -> simpleStatus.create(parameter).asMap() + is StatusListEntryFactoryParameter -> statusList2021.create(parameter).asMap() else -> throw IllegalArgumentException("Status type not supported: ${parameter.javaClass.simpleName}") } } diff --git a/src/main/kotlin/id/walt/signatory/revocation/statuslist2021/StatusList2021EntryClientService.kt b/src/main/kotlin/id/walt/signatory/revocation/statuslist2021/StatusList2021EntryClientService.kt index 5f1785de..71462df5 100644 --- a/src/main/kotlin/id/walt/signatory/revocation/statuslist2021/StatusList2021EntryClientService.kt +++ b/src/main/kotlin/id/walt/signatory/revocation/statuslist2021/StatusList2021EntryClientService.kt @@ -38,10 +38,20 @@ class StatusList2021EntryClientService: CredentialStatusClientService { } override fun revoke(parameter: RevocationConfig): Unit = (parameter as StatusListRevocationConfig).run { - storageService.fetch(this.credentialStatus.statusListCredential)?.let { - extractStatusListCredentialSubject(it) - }?.let { - updateBitString(it.encodedList, this.credentialStatus.statusListIndex, 1) + storageService.fetch(this.credentialStatus.statusListCredential)?.let { credential -> + extractStatusListCredentialSubject(credential)?.encodedList?.let { bitString -> + credential.issuer?.let { issuer -> + issue( + credential.id ?: parameter.credentialStatus.id, + parameter.credentialStatus.statusPurpose, + parameter.credentialStatus.statusListCredential, + issuer.id, + updateBitString(bitString, parameter.credentialStatus.statusListIndex, 1) + ) + } + }?.run { + storageService.store(this, parameter.credentialStatus.statusListCredential) + } } }