Key Management Service clients for the purpose of signing Solana transactions.
final var jsonConfig = ""; // See examples below.
final var factoryClassName = "software.sava.kms.google.GoogleKMSClientFactory";
final var serviceFactory = ServiceLoader.load(SigningServiceFactory.class).stream()
.filter(service -> service.type().name().equals(factoryClassName))
.findFirst().orElseThrow().get();
final var signingService = serviceFactory.createService(executor, JsonIterator.parse(json));
final var base58PublicKey = signingService.publicKey().join();
final byte[] sig = signingService.sign("Hello World".getBytes(StandardCharsets.UTF_8)).join();
{
"project": "google-project-name",
"location": "global",
"keyRing": "dev-keyring",
"cryptoKey": "dev_key",
"cryptoKeyVersion": "1",
"capacity": {
"minCapacityDuration": "PT8S",
"maxCapacity": 300,
"resetDuration": "PT6S"
}
}
Supported private key encodings.
{
"pubKey": "<PUB_KEY>",
"encoding": "base64KeyPair",
"secret": "<BASE64_ENCODED_PUBLIC_PRIVATE_KEY_PAIR>"
}
Should point to a file with the secret contents as shown above.
MemorySignerFromFilePointerFactory
{
"filePath": "/path/to/secret.json"
}
- X-ENCODING:
- base58
- base64
- Response Headers:
- X-ENCODING: Defaults to base58.
- Request Headers:
- X-ENCODING: base64
{
"endpoint": "https://api.signing.service/",
"capacity": {
"minCapacityDuration": "PT8S",
"maxCapacity": 300,
"resetDuration": "PT6S"
}
}