1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-29 07:16:36 +01:00
metamask-extension/test/lib/mock-encryptor.js

37 lines
621 B
JavaScript
Raw Normal View History

const mockHex = '0xabcdef0123456789';
const mockKey = Buffer.alloc(32);
let cacheVal;
const mockEncryptor = {
2020-11-03 00:41:28 +01:00
encrypt(_, dataObj) {
cacheVal = dataObj;
return Promise.resolve(mockHex);
},
2020-11-03 00:41:28 +01:00
decrypt() {
return Promise.resolve(cacheVal || {});
},
2020-11-03 00:41:28 +01:00
encryptWithKey(key, dataObj) {
return this.encrypt(key, dataObj);
},
2020-11-03 00:41:28 +01:00
decryptWithKey(key, text) {
return this.decrypt(key, text);
},
2020-11-03 00:41:28 +01:00
keyFromPassword() {
return Promise.resolve(mockKey);
},
2020-11-03 00:41:28 +01:00
generateSalt() {
return 'WHADDASALT!';
},
2020-11-03 00:41:28 +01:00
getRandomValues() {
return 'SOO RANDO!!!1';
2018-07-03 00:49:33 +02:00
},
};
export default mockEncryptor;