mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-06-15 10:44:47 -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') {
|
if (mode === 'GCM') {
|
||||||
decryptOutput.value = 'Decrypting...';
|
decryptOutput.value = 'Decrypting...';
|
||||||
try {
|
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) {
|
catch (e: any) {
|
||||||
decryptOutput.value = '';
|
decryptOutput.value = '';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue