mirror of
https://github.com/Qortal/qortal-ui.git
synced 2025-02-11 17:55:51 +00:00
added file option to encript
This commit is contained in:
parent
430413c572
commit
4ee9833314
@ -157,7 +157,7 @@ export const encryptDataGroup = ({ data64, publicKeys }) => {
|
||||
encryptedKeys.push(encryptedKey);
|
||||
});
|
||||
|
||||
const str = "qortalEncryptedData";
|
||||
const str = "qortalGroupEncryptedData";
|
||||
const strEncoder = new TextEncoder();
|
||||
const strUint8Array = strEncoder.encode(str);
|
||||
|
||||
@ -247,7 +247,7 @@ export function decryptDeprecatedSingle(uint8Array, publicKey) {
|
||||
|
||||
export function decryptGroupData(data64EncryptedData) {
|
||||
const allCombined = base64ToUint8Array(data64EncryptedData);
|
||||
const str = "qortalEncryptedData";
|
||||
const str = "qortalGroupEncryptedData";
|
||||
const strEncoder = new TextEncoder();
|
||||
const strUint8Array = strEncoder.encode(str);
|
||||
|
||||
|
@ -566,7 +566,6 @@ class WebBrowser extends LitElement {
|
||||
|
||||
const { encryptedData, publicKey } = data
|
||||
|
||||
|
||||
try {
|
||||
let data = {};
|
||||
if (!encryptedData) {
|
||||
@ -579,7 +578,6 @@ class WebBrowser extends LitElement {
|
||||
}
|
||||
const uint8Array = base64ToUint8Array(encryptedData)
|
||||
const startsWithQortalEncryptedData = uint8ArrayStartsWith(uint8Array, "qortalEncryptedData");
|
||||
|
||||
if (startsWithQortalEncryptedData) {
|
||||
|
||||
if (!publicKey) {
|
||||
@ -598,7 +596,6 @@ class WebBrowser extends LitElement {
|
||||
|
||||
}
|
||||
const startsWithQortalGroupEncryptedData = uint8ArrayStartsWith(uint8Array, "qortalGroupEncryptedData");
|
||||
|
||||
if (startsWithQortalGroupEncryptedData) {
|
||||
|
||||
const decryptedData = decryptGroupData(encryptedData)
|
||||
@ -893,6 +890,9 @@ class WebBrowser extends LitElement {
|
||||
response = JSON.stringify(data);
|
||||
break
|
||||
}
|
||||
if (data.file) {
|
||||
data64 = await fileToBase64(data.file)
|
||||
}
|
||||
|
||||
if (data.encrypt) {
|
||||
try {
|
||||
@ -1067,10 +1067,14 @@ class WebBrowser extends LitElement {
|
||||
if (!data.encrypt && service.endsWith("_PRIVATE")) {
|
||||
throw new Error("Only encrypted data can go into private services")
|
||||
}
|
||||
if (data.file) {
|
||||
data64 = await fileToBase64(data.file)
|
||||
}
|
||||
|
||||
|
||||
if (data.encrypt) {
|
||||
try {
|
||||
|
||||
const encryptDataResponse = encryptDataGroup({
|
||||
data64, publicKeys: data.publicKeys
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user