refactor(ui): improve AES-GCM decryption result handling
This commit is contained in:
parent
a4f2346a57
commit
1793eb5396
@ -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…
Reference in New Issue
Block a user