Class LocalResponse


  • public class LocalResponse
    extends Object
    A Mindee response saved locally.
    • Constructor Detail

      • LocalResponse

        public LocalResponse​(String input)
        Load from a String.
        Parameters:
        input - will be decoded as UTF-8.
      • LocalResponse

        public LocalResponse​(File input)
                      throws IOException
        Load from a File.
        Parameters:
        input - will be decoded as UTF-8.
        Throws:
        IOException
    • Method Detail

      • getHmacSignature

        public String getHmacSignature​(String secretKey)
        Get the HMAC signature of the payload.
        Parameters:
        secretKey - Your secret key from the Mindee platform.
        Returns:
        The generated HMAC signature.
      • isValidHmacSignature

        public boolean isValidHmacSignature​(String secretKey,
                                            String signature)
        Verify that the payload's signature matches the one received from the server.
        Parameters:
        secretKey - Your secret key from the Mindee platform.
        signature - The signature from the "X-Mindee-Hmac-Signature" HTTP header.
        Returns:
        true if the signatures match.
      • getFile

        public byte[] getFile()