class KrakenFuturesDigest extends BaseParamsDigest {

  /**
   * Constructor
   *
   * @param secretKeyBase64
   * @throws IllegalArgumentException if key is invalid (cannot be base-64-decoded or the decoded
   *     key is invalid).
   */
  private KrakenFuturesDigest(byte[] secretKeyBase64) {

    super(secretKeyBase64, HMAC_SHA_512);
  }

  public static KrakenFuturesDigest createInstance(String secretKeyBase64) {

    if (secretKeyBase64 != null) {
      return new KrakenFuturesDigest(Base64.getDecoder().decode(secretKeyBase64.getBytes()));
    } else {
      return null;
    }
  }

  public String signMessage(String message) {<FILL_FUNCTION_BODY>}

  @Override
  public String digestParams(RestInvocation restInvocation) {

    try {
      String message =
          URLDecoder.decode(
                  restInvocation.getParamsMap().get(QueryParam.class).asQueryString(),
                  StandardCharsets.UTF_8.name())
              + restInvocation.getParamValue(HeaderParam.class, "Nonce").toString()
              + restInvocation.getPath();

      return signMessage(message);
    } catch (UnsupportedEncodingException e) {
      throw new RuntimeException(
          "Bad encoding found on request query while hashing (SHA256) the POST data.", e);
    }
  }
}

    MessageDigest sha256;
    try {
      sha256 = MessageDigest.getInstance("SHA-256");
    } catch (NoSuchAlgorithmException e) {
      throw new RuntimeException(
          "Illegal algorithm (SHA-256) for post body digest. Check the implementation.");
    }

    sha256.update(message.getBytes());
    Mac mac512 = getMac();
    mac512.update(sha256.digest());
    return Base64.getEncoder().encodeToString(mac512.doFinal()).trim();
  
<methods>public javax.crypto.Mac getMac() <variables>public static final java.lang.String HMAC_MD5,public static final java.lang.String HMAC_SHA_1,public static final java.lang.String HMAC_SHA_256,public static final java.lang.String HMAC_SHA_384,public static final java.lang.String HMAC_SHA_512,private final non-sealed javax.crypto.Mac mac