Adds backup functionality
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
/* eslint-disable */
|
||||
import sha256 from 'crypto-js/sha256';
|
||||
import aes from 'crypto-js/aes';
|
||||
import Base64 from 'crypto-js/enc-base64';
|
||||
import Hex from 'crypto-js/enc-hex';
|
||||
import Utf8 from 'crypto-js/enc-utf8';
|
||||
import axios from 'axios';
|
||||
|
||||
const ENDPOINT = 'https://dashy-sync-service.as93.net/';
|
||||
|
||||
/* Stringify, encrypt and encode data for transmission */
|
||||
const encryptData = (data, password) => {
|
||||
@@ -22,11 +23,16 @@ const makeSubHash = (pass) => sha256(pass).toString().slice(0, 14);
|
||||
|
||||
/* Makes the backup */
|
||||
export const backup = (data, password) => {
|
||||
// const subHash = makeSubHash(password);
|
||||
const encryptedData = encryptData(data, password);
|
||||
console.log(encryptedData);
|
||||
console.log(decryptData(encryptedData, password));
|
||||
return axios.post(ENDPOINT, {
|
||||
userData: encryptData(data, password),
|
||||
subHash: makeSubHash(password),
|
||||
});
|
||||
};
|
||||
|
||||
/* Restores the backup */
|
||||
export const restore = (backupId, password) => { };
|
||||
export const restore = (backupId, password) => {
|
||||
// return axios.get(ENDPOINT, {
|
||||
// backupId,
|
||||
// subHash: makeSubHash(password),
|
||||
// });
|
||||
};
|
||||
|
||||
@@ -47,6 +47,8 @@ module.exports = {
|
||||
CONF_SECTIONS: 'confSections',
|
||||
PAGE_INFO: 'pageInfo',
|
||||
APP_CONFIG: 'appConfig',
|
||||
BACKUP_ID: 'backupId',
|
||||
BACKUP_HASH: 'backupHash',
|
||||
},
|
||||
topLevelConfKeys: {
|
||||
PAGE_INFO: 'pageInfo',
|
||||
@@ -55,7 +57,7 @@ module.exports = {
|
||||
},
|
||||
toastedOptions: {
|
||||
position: 'bottom-center',
|
||||
duration: 2000,
|
||||
duration: 2500,
|
||||
keepOnHover: true,
|
||||
className: 'toast-message',
|
||||
iconPack: 'fontawesome',
|
||||
|
||||
Reference in New Issue
Block a user