feat: Add initial frontend components and their corresponding build assets, along with generated API types and configuration.
Some checks failed
Build and Release / build-and-release (push) Failing after 7m50s
Some checks failed
Build and Release / build-and-release (push) Failing after 7m50s
This commit is contained in:
@@ -528,7 +528,7 @@ app.whenReady().then(async () => {
|
||||
const tagBuffer = Buffer.from(tag, 'hex');
|
||||
const decipher = crypto.createDecipheriv('aes-256-gcm', keyBuffer, ivBuffer);
|
||||
decipher.setAuthTag(tagBuffer);
|
||||
|
||||
|
||||
const outputEncoding = options.encoding || 'utf8';
|
||||
// If encoding is 'buffer', don't pass an encoding to update/final
|
||||
const updateEncoding = outputEncoding === 'buffer' ? undefined : outputEncoding;
|
||||
@@ -545,4 +545,34 @@ app.whenReady().then(async () => {
|
||||
}
|
||||
return decrypted;
|
||||
});
|
||||
|
||||
// Batch decrypt: accepts array of { ciphertext, key, iv, tag }, returns array of { success, data }
|
||||
ipcMain.handle('decrypt-batch', (event, items) => {
|
||||
return items.map(({ ciphertext, key, iv, tag }) => {
|
||||
try {
|
||||
const keyBuffer = typeof key === 'string' ? Buffer.from(key, 'hex') : key;
|
||||
const ivBuffer = Buffer.from(iv, 'hex');
|
||||
const tagBuffer = Buffer.from(tag, 'hex');
|
||||
const decipher = crypto.createDecipheriv('aes-256-gcm', keyBuffer, ivBuffer);
|
||||
decipher.setAuthTag(tagBuffer);
|
||||
let decrypted = decipher.update(ciphertext, 'hex', 'utf8');
|
||||
decrypted += decipher.final('utf8');
|
||||
return { success: true, data: decrypted };
|
||||
} catch (err) {
|
||||
return { success: false, data: null };
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Batch verify: accepts array of { publicKey, message, signature }, returns array of { success, verified }
|
||||
ipcMain.handle('verify-batch', (event, items) => {
|
||||
return items.map(({ publicKey, message, signature }) => {
|
||||
try {
|
||||
const verified = crypto.verify(null, Buffer.from(message), publicKey, Buffer.from(signature, 'hex'));
|
||||
return { success: true, verified };
|
||||
} catch (err) {
|
||||
return { success: false, verified: false };
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user