2021-02-04 19:15:23 +01:00
|
|
|
const mockHex = '0xabcdef0123456789';
|
|
|
|
const mockKey = Buffer.alloc(32);
|
|
|
|
let cacheVal;
|
2016-10-21 21:11:54 +02:00
|
|
|
|
2020-05-19 01:48:11 +02:00
|
|
|
const mockEncryptor = {
|
2023-01-20 21:20:18 +01:00
|
|
|
async encrypt(_, dataObj) {
|
2021-02-04 19:15:23 +01:00
|
|
|
cacheVal = dataObj;
|
2023-01-20 21:20:18 +01:00
|
|
|
return mockHex;
|
2016-10-21 21:11:54 +02:00
|
|
|
},
|
|
|
|
|
2023-01-20 21:20:18 +01:00
|
|
|
async decrypt() {
|
|
|
|
return cacheVal || {};
|
2016-10-21 21:11:54 +02:00
|
|
|
},
|
|
|
|
|
2022-11-24 01:49:24 +01:00
|
|
|
encryptWithDetail(_, dataObj) {
|
|
|
|
cacheVal = dataObj;
|
|
|
|
|
|
|
|
return Promise.resolve({ vault: mockHex, exportedKeyString: '' });
|
|
|
|
},
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
encryptWithKey(key, dataObj) {
|
2021-02-04 19:15:23 +01:00
|
|
|
return this.encrypt(key, dataObj);
|
2016-10-21 21:11:54 +02:00
|
|
|
},
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
decryptWithKey(key, text) {
|
2021-02-04 19:15:23 +01:00
|
|
|
return this.decrypt(key, text);
|
2016-10-21 21:11:54 +02:00
|
|
|
},
|
|
|
|
|
2023-01-20 21:20:18 +01:00
|
|
|
async keyFromPassword() {
|
|
|
|
return mockKey;
|
2016-10-21 21:11:54 +02:00
|
|
|
},
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
generateSalt() {
|
2021-02-04 19:15:23 +01:00
|
|
|
return 'WHADDASALT!';
|
2016-10-21 21:11:54 +02:00
|
|
|
},
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
getRandomValues() {
|
2021-02-04 19:15:23 +01:00
|
|
|
return 'SOO RANDO!!!1';
|
2018-07-03 00:49:33 +02:00
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2020-05-19 01:48:11 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
export default mockEncryptor;
|