getCryptoSDK
public static ICrypto getCryptoSDK(java.lang.String apiKey,
java.lang.String clientName,
java.lang.String peacemakrBaseURL,
Persister persister,
org.apache.log4j.Logger logger)
throws PeacemakrException
This factory constructs a Peacemakr SDK Client. All Peacemakr SDK clients
implement the ICrypto interface.
All clients are stateful. Internally, this state includes a private asymmetric
key, local cache of symmetric keys downloaded from Peacemakr so far, ability to
communicate with the peacemakr service org. All state is persisted through
your provided Persister. This mechanism allows for a single client to re-use
a previously registered api client (and not incur additional overhead due to
re-registering the same client over and over again).
Auth is handled through the provided apiKey. If you do not have one, please register
at https://admin.peacemakr.io as a new organization. If you have a peacemakr organization
already, but are not sure what your apiKey should be, please login
(https://admin.peacemakr.io) and navigate to "API Keys" tab, and select one of your apiKey's.
The same API Key may be re-used across different clients.
Persisting local data is important features of Peacemakr Clients. To help make this
as easy and seamless as possible, this client will only ever read or write through
this simple provided interface. There are two implementations of this interface which
are already provided: FilePersister and InMemoryPersister. They do exactly as their
names describe. If your specific application requires a different or special type of
persistence layer, you are welcomed to implement this interface in whichever fashion
best suites your needs, and even open a PR against our SDK to ensure that we continue
supporting your particular persistenc layer it as we update and improve the clients.
- Parameters:
apiKey - Required. Auth mechanism which permits this client to connect to your Peacemakr Organization.clientName - Required. Any string which may be used to identify this particular client. Please do not use
any customer Personally Identifiable Information (PII) in this field.peacemakrBaseURL - Optional. The base url for Peacemakr's Cloud Services. If null, the default value
(https://api.peacemakr.io) is used.persister - Required. This persister help the cleint persist data.logger - Optional. If null, we use a standard log4j logger, else, you are welcomed to provide your own
logger solution for local visibility and debugging.
- Returns:
- An ICrypto which is ready to be used.
- Throws:
PeacemakrException - Is thrown on any non-recoverable error.