11package 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+ }
0 commit comments