Skip to content

Commit

Permalink
Move NetworkId to network.identity module
Browse files Browse the repository at this point in the history
  • Loading branch information
alvasw committed Oct 26, 2023
1 parent 553d428 commit 599b496
Show file tree
Hide file tree
Showing 79 changed files with 121 additions and 84 deletions.
1 change: 1 addition & 0 deletions bonded_roles/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ dependencies {
implementation project(':identity')

implementation 'network:common'
implementation 'network:network-identity'
implementation 'network:network'

implementation libs.google.gson
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import bisq.network.p2p.services.data.storage.DistributedData;
import bisq.network.p2p.services.data.storage.MetaData;
import bisq.network.p2p.services.data.storage.auth.authorized.AuthorizedDistributedData;
import bisq.network.p2p.vo.NetworkId;
import bisq.network.identity.NetworkId;
import com.google.protobuf.InvalidProtocolBufferException;
import lombok.EqualsAndHashCode;
import lombok.Getter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import bisq.network.p2p.services.data.storage.DistributedData;
import bisq.network.p2p.services.data.storage.MetaData;
import bisq.network.p2p.services.data.storage.auth.authorized.AuthorizedDistributedData;
import bisq.network.p2p.vo.NetworkId;
import bisq.network.identity.NetworkId;
import com.google.protobuf.InvalidProtocolBufferException;
import lombok.EqualsAndHashCode;
import lombok.Getter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import bisq.network.p2p.message.EnvelopePayloadMessage;
import bisq.network.p2p.services.data.storage.MetaData;
import bisq.network.p2p.services.data.storage.mailbox.MailboxMessage;
import bisq.network.p2p.vo.NetworkId;
import bisq.network.identity.NetworkId;
import bisq.network.protobuf.ExternalNetworkMessage;
import com.google.protobuf.Any;
import com.google.protobuf.InvalidProtocolBufferException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import bisq.common.observable.collection.ObservableSet;
import bisq.network.NetworkService;
import bisq.network.common.AddressByTransportTypeMap;
import bisq.network.p2p.vo.NetworkId;
import bisq.network.identity.NetworkId;
import bisq.network.p2p.vo.NetworkIdWithKeyPair;
import bisq.security.DigestUtil;
import lombok.extern.slf4j.Slf4j;
Expand Down
8 changes: 4 additions & 4 deletions bonded_roles/src/main/proto/bonded_roles.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package bonded_roles;
option java_package = "bisq.bonded_roles.protobuf";
option java_multiple_files = true;
import "common.proto";
import "network.proto";
import "network_common.proto";
import "network_identity.proto";

enum BondedRoleType {
BONDEDROLETYPE_UNSPECIFIED = 0;
Expand All @@ -19,7 +19,7 @@ enum BondedRoleType {
BONDEDROLETYPE_MARKET_PRICE_NODE = 13;
}
message AuthorizedOracleNode {
network.NetworkId networkId = 1;
network.identity.NetworkId networkId = 1;
string bondUserName = 2;
string signatureBase64 = 3;
string publicKeyHash = 4;
Expand All @@ -33,7 +33,7 @@ message BondedRoleRegistrationRequest {
string bondUserName = 4;
string signatureBase64 = 5;
.network.common.AddressByTransportTypeMap addressByTransportTypeMap = 6;
network.NetworkId networkId = 7;
network.identity.NetworkId networkId = 7;
bool isCancellationRequest = 8;
}

Expand All @@ -44,7 +44,7 @@ message AuthorizedBondedRole {
string bondUserName = 4;
string signatureBase64 = 5;
.network.common.AddressByTransportTypeMap addressByTransportTypeMap = 6;
network.NetworkId networkId = 7;
network.identity.NetworkId networkId = 7;
optional AuthorizedOracleNode authorizedOracleNode = 8;
bool staticPublicKeysProvided = 9;
}
Expand Down
1 change: 1 addition & 0 deletions chat/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ dependencies {
implementation project(':presentation')

implementation 'network:network'
implementation 'network:network-identity'

implementation libs.chimp.jsocks
implementation libs.google.gson
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import bisq.chat.priv.PrivateChatMessage;
import bisq.common.util.StringUtils;
import bisq.network.p2p.services.data.storage.MetaData;
import bisq.network.p2p.vo.NetworkId;
import bisq.network.identity.NetworkId;
import bisq.network.protobuf.ExternalNetworkMessage;
import bisq.offer.bisq_easy.BisqEasyOffer;
import bisq.user.profile.UserProfile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import bisq.common.util.StringUtils;
import bisq.i18n.Res;
import bisq.network.NetworkService;
import bisq.network.identity.NetworkId;
import bisq.network.p2p.services.confidential.MessageListener;
import bisq.network.p2p.vo.NetworkId;
import bisq.network.p2p.vo.NetworkIdWithKeyPair;
import bisq.persistence.PersistableStore;
import bisq.security.pow.ProofOfWorkService;
Expand Down
2 changes: 1 addition & 1 deletion chat/src/main/java/bisq/chat/priv/PrivateChatMessage.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import bisq.common.validation.NetworkDataValidation;
import bisq.network.p2p.services.confidential.ack.AckRequestingMessage;
import bisq.network.p2p.services.data.storage.mailbox.MailboxMessage;
import bisq.network.p2p.vo.NetworkId;
import bisq.network.identity.NetworkId;
import bisq.user.profile.UserProfile;
import lombok.EqualsAndHashCode;
import lombok.Getter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import bisq.chat.Citation;
import bisq.chat.priv.PrivateChatMessage;
import bisq.network.p2p.services.data.storage.MetaData;
import bisq.network.p2p.vo.NetworkId;
import bisq.network.identity.NetworkId;
import bisq.network.protobuf.ExternalNetworkMessage;
import bisq.user.profile.UserProfile;
import com.google.protobuf.Any;
Expand Down
6 changes: 3 additions & 3 deletions chat/src/main/proto/chat.proto
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ package chat;
option java_package = "bisq.chat.protobuf";
option java_multiple_files = true;
import "common.proto";
import "network.proto";
import "network_identity.proto";
import "security.proto";
import "offer.proto";
import "user.proto";
Expand Down Expand Up @@ -91,7 +91,7 @@ message ChatChannel {
message TwoPartyPrivateChatMessage {
string receiverUserProfileId = 1;
user.UserProfile sender = 2;
network.NetworkId receiverNetworkId = 3;
network.identity.NetworkId receiverNetworkId = 3;
}
message TwoPartyPrivateChatChannel {
user.UserIdentity myUserIdentity = 1;
Expand Down Expand Up @@ -119,7 +119,7 @@ message CommonPublicChatChannelStore {
message BisqEasyOpenTradeMessage {
string tradeId = 1;
string receiverUserProfileId = 2;
network.NetworkId receiverNetworkId = 3;
network.identity.NetworkId receiverNetworkId = 3;
user.UserProfile sender = 4;
optional user.UserProfile mediator = 5;
optional offer.Offer bisqEasyOffer = 6;
Expand Down
2 changes: 2 additions & 0 deletions contract/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@ dependencies {
implementation project(':offer')

implementation 'network:network'
implementation 'network:network-identity'

implementation libs.google.guava
}
2 changes: 1 addition & 1 deletion contract/src/main/java/bisq/contract/Party.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package bisq.contract;

import bisq.common.proto.Proto;
import bisq.network.p2p.vo.NetworkId;
import bisq.network.identity.NetworkId;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import bisq.contract.Party;
import bisq.contract.Role;
import bisq.contract.TwoPartyContract;
import bisq.network.p2p.vo.NetworkId;
import bisq.network.identity.NetworkId;
import bisq.offer.bisq_easy.BisqEasyOffer;
import bisq.offer.payment_method.BitcoinPaymentMethodSpec;
import bisq.offer.payment_method.FiatPaymentMethodSpec;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import bisq.contract.Party;
import bisq.contract.Role;
import bisq.contract.TwoPartyContract;
import bisq.network.p2p.vo.NetworkId;
import bisq.network.identity.NetworkId;
import bisq.offer.multisig.MultisigOffer;
import lombok.EqualsAndHashCode;
import lombok.Getter;
Expand Down
2 changes: 1 addition & 1 deletion contract/src/main/java/bisq/contract/poc/PocContract.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import bisq.account.protocol_type.TradeProtocolType;
import bisq.common.monetary.Monetary;
import bisq.common.proto.Proto;
import bisq.network.p2p.vo.NetworkId;
import bisq.network.identity.NetworkId;
import bisq.offer.poc.PocOffer;
import com.google.protobuf.Message;
import lombok.EqualsAndHashCode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import bisq.contract.Party;
import bisq.contract.Role;
import bisq.contract.TwoPartyContract;
import bisq.network.p2p.vo.NetworkId;
import bisq.network.identity.NetworkId;
import bisq.offer.submarine.SubmarineOffer;
import lombok.EqualsAndHashCode;
import lombok.Getter;
Expand Down
4 changes: 2 additions & 2 deletions contract/src/main/proto/contract.proto
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ package contract;
option java_package = "bisq.contract.protobuf";
option java_multiple_files = true;

import "network.proto";
import "network_identity.proto";
import "account.proto";
import "offer.proto";
import "user.proto";
Expand All @@ -35,7 +35,7 @@ enum Role {

message Party {
Role role = 1;
network.NetworkId networkId = 2;
network.identity.NetworkId networkId = 2;
}
message Contract {
offer.Offer offer = 1;
Expand Down
2 changes: 2 additions & 0 deletions desktop/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ dependencies {

implementation("network:common")
implementation("network:network")
implementation("network:network-identity")

implementation("wallets:electrum")
implementation("wallets:bitcoind")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import bisq.chat.bisqeasy.open_trades.BisqEasyOpenTradeChannel;
import bisq.desktop.ServiceProvider;
import bisq.network.p2p.vo.NetworkId;
import bisq.network.identity.NetworkId;
import bisq.offer.bisq_easy.BisqEasyOffer;
import bisq.trade.Trade;
import bisq.trade.bisq_easy.BisqEasyTrade;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import bisq.desktop.common.view.Controller;
import bisq.desktop.common.view.NavigationTarget;
import bisq.i18n.Res;
import bisq.network.p2p.vo.NetworkId;
import bisq.network.identity.NetworkId;
import bisq.offer.Direction;
import bisq.offer.amount.OfferAmountFormatter;
import bisq.offer.amount.OfferAmountUtil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
import bisq.i18n.Res;
import bisq.network.NetworkService;
import bisq.network.p2p.services.confidential.ack.MessageDeliveryStatus;
import bisq.network.p2p.vo.NetworkId;
import bisq.network.identity.NetworkId;
import bisq.offer.bisq_easy.BisqEasyOffer;
import bisq.presentation.formatters.DateFormatter;
import bisq.settings.SettingsService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import bisq.network.p2p.node.Node;
import bisq.network.p2p.node.NodesById;
import bisq.network.common.TransportType;
import bisq.network.p2p.vo.NetworkId;
import bisq.network.identity.NetworkId;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.collections.FXCollections;
Expand Down
2 changes: 2 additions & 0 deletions identity/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ dependencies {
implementation project(':security')

implementation 'network:network'
implementation 'network:network-identity'

implementation libs.google.guava
implementation libs.typesafe.config
}
2 changes: 1 addition & 1 deletion identity/src/main/java/bisq/identity/Identity.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package bisq.identity;

import bisq.common.proto.Proto;
import bisq.network.p2p.vo.NetworkId;
import bisq.network.identity.NetworkId;
import bisq.network.p2p.vo.NetworkIdWithKeyPair;
import bisq.security.KeyPairProtoUtil;
import bisq.security.PubKey;
Expand Down
4 changes: 2 additions & 2 deletions identity/src/main/proto/identity.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ syntax = "proto3";
package identity;
option java_package = "bisq.identity.protobuf";
option java_multiple_files = true;
import "network.proto";
import "network_identity.proto";
import "security.proto";

message Identity {
string domainId = 1;
network.NetworkId networkId = 2;
network.identity.NetworkId networkId = 2;
security.KeyPair keyPair = 3;
}

Expand Down
11 changes: 11 additions & 0 deletions network/network-identity/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
plugins {
id 'bisq.java-library'
id 'bisq.protobuf'
}

dependencies {
implementation project(":common")
implementation 'bisq:security'

implementation libs.google.guava
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/

package bisq.network.p2p.vo;
package bisq.network.identity;

import bisq.common.proto.Proto;
import bisq.common.validation.NetworkDataValidation;
Expand Down Expand Up @@ -45,15 +45,15 @@ public NetworkId(AddressByTransportTypeMap addressByTransportTypeMap, PubKey pub
NetworkDataValidation.validateId(nodeId);
}

public bisq.network.protobuf.NetworkId toProto() {
return bisq.network.protobuf.NetworkId.newBuilder()
public bisq.network.identity.protobuf.NetworkId toProto() {
return bisq.network.identity.protobuf.NetworkId.newBuilder()
.setAddressByNetworkTypeMap(addressByTransportTypeMap.toProto())
.setPubKey(pubKey.toProto())
.setNodeId(nodeId)
.build();
}

public static NetworkId fromProto(bisq.network.protobuf.NetworkId proto) {
public static NetworkId fromProto(bisq.network.identity.protobuf.NetworkId proto) {
return new NetworkId(AddressByTransportTypeMap.fromProto(proto.getAddressByNetworkTypeMap()),
PubKey.fromProto(proto.getPubKey()),
proto.getNodeId());
Expand All @@ -72,3 +72,4 @@ public String toString() {
")";
}
}

12 changes: 12 additions & 0 deletions network/network-identity/src/main/proto/network_identity.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
syntax = "proto3";
package network.identity;
option java_package = "bisq.network.identity.protobuf";
option java_multiple_files = true;
import "network_common.proto";
import "security.proto";

message NetworkId {
.network.common.AddressByTransportTypeMap addressByNetworkTypeMap = 1;
security.PubKey pubKey = 2;
string nodeId = 3;
}
1 change: 1 addition & 0 deletions network/network/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ dependencies {
implementation 'bisq:persistence'

implementation project(':common')
implementation project(':network-identity')
implementation project(':i2p')
implementation 'tor:tor'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import bisq.common.util.CompletableFutureUtils;
import bisq.network.http.BaseHttpClient;
import bisq.network.http.HttpClientRepository;
import bisq.network.identity.NetworkId;
import bisq.network.p2p.ServiceNode;
import bisq.network.p2p.ServiceNodesByTransport;
import bisq.network.p2p.message.EnvelopePayloadMessage;
Expand All @@ -48,7 +49,6 @@
import bisq.network.p2p.services.monitor.MonitorService;
import bisq.network.common.Address;
import bisq.network.common.AddressByTransportTypeMap;
import bisq.network.p2p.vo.NetworkId;
import bisq.network.p2p.vo.NetworkIdWithKeyPair;
import bisq.persistence.Persistence;
import bisq.persistence.PersistenceClient;
Expand Down
Loading

0 comments on commit 599b496

Please sign in to comment.