mirror of
https://github.com/mosip/inji-wallet.git
synced 2026-01-10 22:18:03 -05:00
* refactor(INJI-449): replace crypo-js with node-forge crypto-js has vulneraribitiles prior to version 4.2.0 for encryption / decryption & 4.x.x version is not compatible with our react native project For this reason we had to move to different library for encryption / decryption Co-authored-by: Sreenadh S <32409698+sree96@users.noreply.github.com> Signed-off-by: Kiruthika Jeyashankar <81218987+KiruthikaJeyashankar@users.noreply.github.com> * fix(INJI-449): secure-keystore warning popup shown on reload of app settings key which was stored in storage was not loaded into settings machine context correctly, which caused the bug - on reload settings related flows was falling back to initial setting. Co-authored-by: Sreenadh S <32409698+sree96@users.noreply.github.com> Signed-off-by: Kiruthika Jeyashankar <81218987+KiruthikaJeyashankar@users.noreply.github.com> * refactor(INJI-449): gitignore automation test results Signed-off-by: Kiruthika Jeyashankar <81218987+KiruthikaJeyashankar@users.noreply.github.com> * refactor(INJI-449): simplify usage of methods in node-forge Signed-off-by: Kiruthika Jeyashankar <81218987+KiruthikaJeyashankar@users.noreply.github.com> --------- Signed-off-by: Kiruthika Jeyashankar <81218987+KiruthikaJeyashankar@users.noreply.github.com> Co-authored-by: Sreenadh S <32409698+sree96@users.noreply.github.com>
33 lines
767 B
TypeScript
33 lines
767 B
TypeScript
export class EncryptedOutput {
|
|
encryptedData: string;
|
|
iv: string;
|
|
salt: string;
|
|
|
|
static ENCRYPTION_DELIMITER = '_';
|
|
|
|
constructor(encryptedData: string, iv: string, salt: string) {
|
|
this.encryptedData = encryptedData;
|
|
this.iv = iv;
|
|
this.salt = salt;
|
|
}
|
|
|
|
static fromString(encryptedOutput: string): EncryptedOutput {
|
|
const split = encryptedOutput.split(EncryptedOutput.ENCRYPTION_DELIMITER);
|
|
const iv = split[0];
|
|
const salt = split[1];
|
|
const encryptedData = split[2];
|
|
|
|
return new EncryptedOutput(encryptedData, iv, salt);
|
|
}
|
|
|
|
toString(): string {
|
|
return (
|
|
this.iv +
|
|
EncryptedOutput.ENCRYPTION_DELIMITER +
|
|
this.salt +
|
|
EncryptedOutput.ENCRYPTION_DELIMITER +
|
|
this.encryptedData
|
|
);
|
|
}
|
|
}
|