Class BaseLocalResponse

    • Field Detail

      • file

        protected final byte[] file
    • Constructor Detail

      • BaseLocalResponse

        public BaseLocalResponse​(InputStream input)
        Load from an InputStream.
        Parameters:
        input - will be decoded as UTF-8.
      • BaseLocalResponse

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

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

        public BaseLocalResponse​(Path input)
                          throws IOException
        Load from a Path.
        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()