public static String generateSignature(String accessKey, String secretKey)
throws NoSuchAlgorithmException, InvalidKeyException {
// Get the current timestamp
long currentTime = Instant.now().getEpochSecond();
long timestamp = currentTime - (currentTime % 60);
// Build a string to be signed
String stringToSign = accessKey + ":" + timestamp;
// Sign with HMAC-SHA256
Mac sha256HMAC = Mac.getInstance("HmacSHA256");
SecretKeySpec secretKeySpec = new SecretKeySpec(secretKey.getBytes(StandardCharsets.UTF_8), "HmacSHA256");
sha256HMAC.init(secretKeySpec);
byte[] hash = sha256HMAC.doFinal(stringToSign.getBytes(StandardCharsets.UTF_8));
// Convert byte array to base64 string
return Base64.getEncoder().encodeToString(hash);
}