class StreamUtils {

  public static InterledgerFulfillment generatedFulfillableFulfillment(
      final SharedSecret sharedSecret, final byte[] data
  ) {
    Objects.requireNonNull(sharedSecret);
    Objects.requireNonNull(data);

    // hmac_key = hmac_sha256(shared_secret, "ilp_stream_fulfillment");
    final SecretKey secretKey = new SecretKeySpec(sharedSecret.key(), HMAC_SHA256_ALG_NAME);
    final byte[] hmacKey = Hashing.hmacSha256(secretKey).hashBytes(ILP_STREAM_FULFILLMENT).asBytes();

    // fulfillment = hmac_sha256(hmac_key, data);
    final SecretKey hmacSecretKey = new SecretKeySpec(hmacKey, HMAC_SHA256_ALG_NAME);
    final byte[] fulfillmentBytes = Hashing.hmacSha256(hmacSecretKey).hashBytes(data).asBytes();

    return InterledgerFulfillment.of(fulfillmentBytes);
  }

}