I have been attempting to generate an encoded string from the byte array provided by the Yodlee getMFAResponse method (which has a format similar to [-1,0,2,-1]
). The intention is to utilize this encoded string as the source for an image tag in HTML to display a CAPTCHA. However, I have encountered challenges when trying to retrieve image information for financial institutions as well.
To achieve this, my approach involves extracting the byte array from the response object, passing it through the btoa()
function, and then appending it to a string that starts with data:image/???;base64,
, where '???' represents the file type. Despite experimenting with several file formats such as bitmap, jpeg, png, gif, and others, none of them seem to work. Even employing the 'magic string' technique to determine the format did not yield any recognizable results. It seems like my primary issue could be related to my unfamiliarity with the file format or possibly incorrect decoding methods.
The resulting output resembles the following:
data:image/jpeg;base64,NjYsNzcsNTgsMTE2LDAsMCwwLDAsMCwwLDAsMCwwLDQwLDAsMCwwLC0...
I solely use JavaScript both on the server side and client side, and I possess no knowledge of Java (which appears to be the focus of most Yodlee-related discussions). I am uncertain whether the problem lies in how I decode the byte array or if it stems from my lack of expertise regarding image formats.