Step 2. Set up the Client
Regardless of the language you choose, with the SDK incorporated as a library in your application's IDE, you first need to set up a TokenClient that saves your users' private keys to a directory called keys. If you need to securely store keys elsewhere, you can implement an IKeyStore using the SDK's unsecured file system key store class as a guide. See Step 7 for more on key storage and management.
Here's how to create the client:
Path keys = Files.createDirectories
(Paths.get
("./keys"
));
TokenClient tokenClient = TokenClient.builder
()
.withKeyStore
(new
UnsecuredFileSystemKeyStore(keys.toFile()))
.connectTo
(SANDBOX)
.build
();
Here are the relevant technical references:
- TokenClient.create – creates a new client
- TokenCluster enum – defines SANDBOX, PRODUCTION, and other environments
- withKeystore: stores keys in a directory