Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
paullatzelsperger committed Feb 7, 2025
1 parent 99e2671 commit 9616484
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 10 deletions.
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

plugins {
`java-library`

}

val edcScmConnection: String by project
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
@Extension(value = NAME)
public class CredentialServiceExtension implements ServiceExtension {
public static final String NAME = "Issuer Service Credential Service Extension";
public static final String BITSTRING_STATUS_LIST_ENTRY = "BitstringStatusListEntry";

@Setting(description = "Alias for the private key that is intended for signing status list credentials", key = "edc.issuer.statuslist.signing.key.alias")
private String privateKeyAlias;
Expand All @@ -47,14 +48,15 @@ public class CredentialServiceExtension implements ServiceExtension {
private TypeManager typeManager;
@Inject
private JwsSignerProvider jwsSignerProvider;

private StatusListInfoFactoryRegistry factory;

@Provider
public CredentialService getStatusListService(ServiceExtensionContext context) {
var fact = getFactory();

// Bitstring StatusList is provided by default. others can be added via extensions
fact.register("BitstringStatusListEntry", new BitstringStatusListFactory(store, typeManager.getMapper()));
fact.register(BITSTRING_STATUS_LIST_ENTRY, new BitstringStatusListFactory(store));

var tokenGenerationService = new JwtGenerationService(jwsSignerProvider);
return new CredentialServiceImpl(store, transactionContext, typeManager.getMapper(JSON_LD), context.getMonitor(), tokenGenerationService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

package org.eclipse.edc.issuerservice.credentials.statuslist.bitstring;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.eclipse.edc.iam.verifiablecredentials.spi.model.CredentialStatus;
import org.eclipse.edc.identityhub.spi.verifiablecredentials.store.CredentialStore;
import org.eclipse.edc.issuerservice.spi.credentials.statuslist.StatusListInfo;
Expand All @@ -28,11 +27,9 @@

public class BitstringStatusListFactory implements StatusListInfoFactory {
private final CredentialStore credentialStore;
private final ObjectMapper objectMapper;

public BitstringStatusListFactory(CredentialStore credentialStore, ObjectMapper objectMapper) {
public BitstringStatusListFactory(CredentialStore credentialStore) {
this.credentialStore = credentialStore;
this.objectMapper = objectMapper;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void setUp() throws JOSEException {
when(tokenGenerationService.generate(any(), any())).thenReturn(Result.success(TokenRepresentation.Builder.newInstance().token("new-token").build()));
monitor = mock();
var reg = new StatusListInfoFactoryRegistryImpl();
reg.register("BitstringStatusListEntry", new BitstringStatusListFactory(credentialStore, objectMapper));
reg.register("BitstringStatusListEntry", new BitstringStatusListFactory(credentialStore));
revocationService = new CredentialServiceImpl(credentialStore, new NoopTransactionContext(), objectMapper,
monitor, tokenGenerationService, () -> "some-private-key", reg);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

package org.eclipse.edc.issuerservice.credentials.statuslist.bitstring;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.eclipse.edc.iam.verifiablecredentials.spi.model.CredentialStatus;
import org.eclipse.edc.identityhub.spi.verifiablecredentials.store.CredentialStore;
import org.eclipse.edc.spi.result.StoreResult;
Expand All @@ -31,8 +30,7 @@
class BitstringStatusListFactoryTest {

private final CredentialStore credentialStore = mock();
private final ObjectMapper objectMapper = new ObjectMapper();
private final BitstringStatusListFactory factory = new BitstringStatusListFactory(credentialStore, objectMapper);
private final BitstringStatusListFactory factory = new BitstringStatusListFactory(credentialStore);


@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ void revoke_whenCredentialNotFound(IssuerServiceEndToEndTestContext context, Cre
var res = createRevocationCredential(EXAMPLE_REVOCATION_CREDENTIAL_WITH_STATUS_BIT_SET, EXAMPLE_REVOCATION_CREDENTIAL_JWT_WITH_STATUS_BIT_SET);

// track the original bitstring
var originalBitstring = res.getVerifiableCredential().credential().getCredentialSubject().get(0).getClaim("", "encodedList");
credentialStore.create(res).orElseThrow(f -> new RuntimeException("Failed to create credential: " + f.getFailureDetail()));

// missing: creation of the holder credential
Expand Down

0 comments on commit 9616484

Please sign in to comment.