added to multiple

This commit is contained in:
Phillip 2023-05-13 03:33:18 +03:00
parent cb9d5e44a9
commit adc8ba42a0

View File

@ -1007,9 +1007,9 @@ class WebBrowser extends LitElement {
response = JSON.stringify(data); response = JSON.stringify(data);
break break
} }
if (data.encrypt && !data.recipientPublicKey) { if (data.encrypt && (!data.publicKeys || (Array.isArray(data.publicKeys) && data.publicKeys.length === 0))) {
let data = {}; let data = {};
data['error'] = "Encrypting data requires the recipient's public key"; data['error'] = "Encrypting data requires public keys";
response = JSON.stringify(data); response = JSON.stringify(data);
break break
} }
@ -1068,13 +1068,14 @@ class WebBrowser extends LitElement {
throw new Error("Only encrypted data can go into private services") throw new Error("Only encrypted data can go into private services")
} }
if (data.encrypt) { if (data.encrypt) {
try { try {
const encryptDataResponse = encryptData({ const encryptDataResponse = encryptDataGroup({
data64, recipientPublicKey: data.recipientPublicKey data64, publicKeys: data.publicKeys
}) })
if (encryptDataResponse.encryptedData) { if (encryptDataResponse) {
data64 = encryptDataResponse.encryptedData data64 = encryptDataResponse
} }
} catch (error) { } catch (error) {