Hive2Hive is an open-source library, written in Java, for secure, distributed, P2P-based file synchronization and sharing. It is built on top of TomP2P, an advanced, high-performance DHT for multi-key-value pairs. The Hive2Hive project is licensed under the MIT License and any contribution is welcome.
Problems of common sync and sharing services
Although many well-known synchronization and sharing services exist, most of them exhibit the following drawbacks:
Hive2Hive is the solution!
The Hive2Hive library addresses these issues by providing a free and open-sourced, distributed and scalable solution that focuses on maximum security and privacy of both users and data. Aside of this, it supports the whole feature set known from similar centralized approaches, such as Dropbox, OneDrive or Google Drive, and adds functionality for file versioning and conflict management. All packed in a clean, simple API.
There are many simple ways to improve this experience even more. Start to contribute now!
Check our GitHub Wiki to learn more about How To Use and How It Works.
Are you looking for a demo application?
.jar
console application.API Demonstration
Features & Advantages
Installation
Documentation
Contribution
Contact
The Hive2Hive library provides a simple API that is straightforward to use. (View Source) A short demonstration of the API and its basic usage are given here.
Configuring and setting up a new P2P network is very easy. Just specify the configurations and setup an initial node.
NetworkConfiguration
and FileConfiguration
factory classes may help to specify your configurations.INetworkConfiguration netConfig = NetworkConfiguration.create("first");
IFileConfiguration fileConfig = FileConfiguration.createDefault();
IH2HNode peerNode = H2HNode.createNode(netConfig, fileConfig);
peerNode.connect();
You may want to add other peer nodes to the created network. Any node can join by bootstrapping to another node that is already part of the network.
INetworkConfiguration netConfig2 = NetworkConfiguration.create("second", InetAddress.getByName("192.168.1.100"));
IH2HNode peerNode2 = H2HNode.createNode(netConfig2, fileConfig);
peerNode2.connect();
Once a peer node is connected to a network, users can interact with it. For this, each node provides a user management interface.
IUserManager userManager = peerNode.getUserManager();
UserCredentials credentials = new UserCredentials("userId", "password", "pin");
Path rootDirectory = Paths.get("sample/path/to/rootDirectory");
if (!userManager.isRegistered(credentials.getUserId())) {
userManager.register(credentials).await();
}
userManager.login(credentials, rootDirectory).await();
As soon as a user is logged in to the network, her files are automatically synchronized with the current node. Many further file operations are available. For this, each node provides a file management interface.
IFileManager fileManager = peerNode.getFileManager();
File folder = new File("folderpath");
File file = new File(folder, "filepath");
fileManager.add(file);
fileManager.update(file);
fileManager.share(folder, "other-userId", PermissionType.WRITE);
IVersionSelector versionSelector = new IVersionSelector() {
@Override
public IFileVersion selectVersion(List<IFileVersion> availableVersions) {
return availableVersions.get(0);
}
};
fileManager.recover(file, versionSelector);
fileManager.move(folder, new File("other-folder"));
fileManager.delete(file);
In order to keep track of changes in the local file system, a file observer is needed. This observer notifies its attached listeners about all file system events. Either use the provided H2HFileObserver
and H2HFileObserverListener
or implement your own observer adhering to the IFileObserver
and IFileObserverListener
interfaces.
The H2HFileObserverListener
automatically synchronizes the Hive2Hive root folder with the network.
IFileObserverListener listener = new H2HFileObserverListener(fileManager);
IFileObserver observer = new H2HFileObserver(rootDirectory.toFile());
observer.addFileObserverListener(listener);
observer.start();
Hive2Hive offers the same basic functionality known from popular synchronization services (e.g., Dropbox).
On top of that, Hive2Hive provides additional features such as security and versioning.
Using the Hive2Hive library is very simple and has several advantages:
* Try our console-based org.hive2hive.client
by just executing the library .jar
.
And there is even more to come:
There are three easy ways to get and include the Hive2Hive library into your project.
If you just want to use the library, either refer to option 1 or 2.
If you want to contribute to the project, please refer to option 3.
pom.xml
and make sure to select the most recent version.
<dependency>
<groupId>org.hive2hive</groupId>
<artifactId>org.hive2hive.core</artifactId>
<version>1.X.X</version>
</dependency>
.jar
-files are packed and delivered to you as a .zip
.The library is intended to be improved and extended so that we all profit from its capabilities. Unlike many other “secure” services, Hive2Hive discloses its implementation and is open for any sort of contribution and constructive criticism.
We believe that everyone can contribute to make Hive2Hive even better!
There are several things - from simple to complex - you can do to help:
hive2hive
)Also, if you are a professional cryptographer with interest in this project, any feedback on the project is very welcome!