Skip to content

Commit 3c85b2e

Browse files
authored
Merge pull request #301 from iExecBlockchainComputing/feature/credentials
User credentialsService from common
2 parents 3dd1bdf + 59dbbc2 commit 3c85b2e

File tree

3 files changed

+10
-76
lines changed

3 files changed

+10
-76
lines changed
Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,17 @@
11
package com.iexec.worker.chain;
22

3-
import lombok.extern.slf4j.Slf4j;
4-
import org.springframework.stereotype.Service;
5-
import org.web3j.crypto.CipherException;
6-
import org.web3j.crypto.Credentials;
7-
import org.web3j.crypto.WalletUtils;
3+
import com.iexec.common.chain.CredentialsAbstractService;
84

9-
import java.io.IOException;
5+
import org.springframework.beans.factory.annotation.Value;
6+
import org.springframework.stereotype.Service;
107

11-
@Slf4j
128
@Service
13-
public class CredentialsService {
14-
15-
private Credentials credentials;
16-
17-
public CredentialsService(WalletDetails walletDetails) throws IOException, CipherException {
18-
try {
19-
credentials = WalletUtils.loadCredentials(walletDetails.getPassword(), walletDetails.getPath());
20-
log.info("Load wallet credentials [address:{}] ", credentials.getAddress());
21-
} catch (IOException | CipherException e) {
22-
log.error("Credentials cannot be loaded [exception:{}] ", e);
23-
throw e;
24-
}
25-
}
9+
public class CredentialsService extends CredentialsAbstractService {
2610

27-
public Credentials getCredentials() {
28-
return credentials;
11+
public CredentialsService(
12+
@Value("${wallet.password}") String walletPassword,
13+
@Value("${wallet.encryptedFilePath}") String walletPath
14+
) throws Exception {
15+
super(walletPassword, walletPath);
2916
}
30-
}
17+
}

src/main/java/com/iexec/worker/chain/WalletDetails.java

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/test/java/com/iexec/worker/chain/CredentialsServiceTests.java

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)