frostfs-sdk-java/client/src/main/java/info/frostfs/sdk/jdo/ClientEnvironment.java
Bruk Ori 1be65c63ae [#1] Add additional security
Signed-off-by: Ori Bruk <o.bruk@yadro.com>
2024-07-24 15:49:12 +03:00

58 lines
1.5 KiB
Java

package info.frostfs.sdk.jdo;
import info.frostfs.sdk.dto.OwnerId;
import info.frostfs.sdk.dto.Version;
import info.frostfs.sdk.FrostFSClient;
import io.grpc.Channel;
import org.apache.commons.lang3.StringUtils;
import static java.util.Objects.isNull;
public class ClientEnvironment {
private final OwnerId ownerId;
private final Version version;
private final ECDsa key;
private final Channel channel;
private final FrostFSClient frostFSClient;
private NetworkSettings networkSettings;
public ClientEnvironment(String wif, Channel channel, Version version, FrostFSClient frostFSClient) {
if (StringUtils.isEmpty(wif) || isNull(channel) || isNull(version) || isNull(frostFSClient)) {
throw new IllegalArgumentException("One of the input attributes is missing");
}
this.key = new ECDsa(wif);
this.ownerId = new OwnerId(key.getPublicKeyByte());
this.version = version;
this.channel = channel;
this.frostFSClient = frostFSClient;
}
public Channel getChannel() {
return channel;
}
public NetworkSettings getNetworkSettings() {
return networkSettings;
}
public void setNetworkSettings(NetworkSettings networkSettings) {
this.networkSettings = networkSettings;
}
public FrostFSClient getFrostFSClient() {
return frostFSClient;
}
public OwnerId getOwnerId() {
return ownerId;
}
public Version getVersion() {
return version;
}
public ECDsa getKey() {
return key;
}
}