fix bug encryption qortalrequest

This commit is contained in:
PhilReact 2024-10-16 20:20:22 +03:00
parent f1e2192096
commit d7a226e47c
2 changed files with 13 additions and 0 deletions

View File

@ -835,6 +835,7 @@ if (!window.hasAddedQortalListener) {
event.ports[0] event.ports[0]
); );
} else if (event?.data?.action === 'PUBLISH_MULTIPLE_QDN_RESOURCES' || event?.data?.action === 'PUBLISH_QDN_RESOURCE' || event?.data?.action === 'ENCRYPT_DATA' || event?.data?.action === 'SAVE_FILE') { } else if (event?.data?.action === 'PUBLISH_MULTIPLE_QDN_RESOURCES' || event?.data?.action === 'PUBLISH_QDN_RESOURCE' || event?.data?.action === 'ENCRYPT_DATA' || event?.data?.action === 'SAVE_FILE') {
console.log('event?.data?', event?.data)
let data; let data;
try { try {
data = await storeFilesInIndexedDB(event.data); data = await storeFilesInIndexedDB(event.data);

View File

@ -594,9 +594,15 @@ export const publishQDNResource = async (data: any, sender) => {
} }
if (data.encrypt) { if (data.encrypt) {
try { try {
const resKeyPair = await getKeyPair()
const parsedData = JSON.parse(resKeyPair)
const privateKey = parsedData.privateKey
const userPublicKey = parsedData.publicKey
const encryptDataResponse = encryptDataGroup({ const encryptDataResponse = encryptDataGroup({
data64, data64,
publicKeys: data.publicKeys, publicKeys: data.publicKeys,
privateKey,
userPublicKey
}); });
if (encryptDataResponse) { if (encryptDataResponse) {
data64 = encryptDataResponse; data64 = encryptDataResponse;
@ -810,9 +816,15 @@ export const publishMultipleQDNResources = async (data: any, sender) => {
} }
if (data.encrypt) { if (data.encrypt) {
try { try {
const resKeyPair = await getKeyPair()
const parsedData = JSON.parse(resKeyPair)
const privateKey = parsedData.privateKey
const userPublicKey = parsedData.publicKey
const encryptDataResponse = encryptDataGroup({ const encryptDataResponse = encryptDataGroup({
data64, data64,
publicKeys: data.publicKeys, publicKeys: data.publicKeys,
privateKey,
userPublicKey
}); });
if (encryptDataResponse) { if (encryptDataResponse) {
data64 = encryptDataResponse; data64 = encryptDataResponse;