I'm attempting to perform encryption and decryption of a basic text in Ionic. Below is the code snippet I am using:
encryptedData : any;
encryptData(data){
this.aes
.encrypt(this.secureKey, this.secureIV, data)
.then(res => {
console.log("Encrypted Data: " + res);
this.encryptedData = res;
})
.catch(err => {
console.log("Error encrypting data: " + err);
});
}
The input data consists of plain text which seems to be successfully encrypted based on the logged output:
https://i.sstatic.net/Y7oIu.png
However, the variable encryptedData remains null even after assigning it the (res) data. What could possibly be causing this issue?