mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-06-14 10:14:51 -04:00
refactor(ui): improve AES-GCM decryption result handling
This commit is contained in:
parent
a4f2346a57
commit
1793eb5396
1 changed files with 7 additions and 1 deletions
|
@ -206,7 +206,13 @@ watch([decryptInput, decryptSecret, decryptAlgo, decryptAesMode], async () => {
|
|||
if (mode === 'GCM') {
|
||||
decryptOutput.value = 'Decrypting...';
|
||||
try {
|
||||
decryptOutput.value = await algo.decrypt(mode, decryptInput.value, decryptSecret.value)._async();
|
||||
const decryptionResult = algo.decrypt(mode, decryptInput.value, decryptSecret.value);
|
||||
if (decryptionResult && typeof decryptionResult._async === 'function') {
|
||||
decryptOutput.value = await decryptionResult._async();
|
||||
}
|
||||
else {
|
||||
throw new Error('Invalid decryption result or unsupported mode.');
|
||||
}
|
||||
}
|
||||
catch (e: any) {
|
||||
decryptOutput.value = '';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue