whiteflag-java 1.1.0 API
Introduction
The Whiteflag Java Library (WFJL) is an implementation of the Whiteflag Protocol in Java to support the development of Whiteflag-enabled applications. The WFJL is to include all Whiteflag protocol features, but with minimal dependencies. Therefore, the library is independent from any specific blockchain, database solution, user interface, etc.
The Whiteflag Protocol specification is an open standard. Version 1 of the WFJL corresponds with version 1 of the protocol, and more specifically with v1-draft.6 of the standard. Please refer to the GitHub repository for planned WFJL functionality and corresponding `1.x` subversions.
Packages
As any Java software, the Whiteflag Java Library (WFJL) is organised in packages. The WFJL software comprises the following Java packages:
org.whiteflagprotocol.java
is the main package providing the external programming interface for software using this library. This packages defines the classes representing Whitelag messages and accounts.org.whiteflagprotocol.java.core
contains all implementation independent core functionality as defined in the Whiteflag specification, such as the Whiteflag message definitions. This seperates the core protocol functionality from implementation-specific design decisions as much as possible.org.whiteflagprotocol.java.crypto
contains all implementation independent cryptographic functionality as defined in the Whiteflag specification, such as encryption, key derivation and negatiation, and authentication. Seperating these critical security functions makes them better inspectable, testable and maintainable.org.whiteflagprotocol.java.util
contains utilities used by the main protocol classes, but that are not part of the external interface and also not part of the protocol core, e.g. data conversions, such as conversion of Whiteflag message to and from JSON.
Example
After adding the WFJL as a dependency to your project, the WFJL classes can be used in your Java code. Your code may look like this:
import org.whiteflagprotocol.java.WfMessage;
import org.whiteflagprotocol.java.WfException;
public class Example {
/* Properties */
private WfMessage message;
/* Methods */
public WfMessage decode(String hexString) throws WfException {
message = WfMessage.decode(hexString);
return message;
}
}