1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-25 20:02:58 +01:00
metamask-extension/test/lib/mock-encryptor.js
Erik Marks 76a2a9bb8b
@metamask/eslint config@5.0.0 (#10358)
* @metamask/eslint-config@5.0.0
* Update eslintrc and prettierrc
* yarn lint:fix
2021-02-04 10:15:23 -08:00

37 lines
621 B
JavaScript

const mockHex = '0xabcdef0123456789';
const mockKey = Buffer.alloc(32);
let cacheVal;
const mockEncryptor = {
encrypt(_, dataObj) {
cacheVal = dataObj;
return Promise.resolve(mockHex);
},
decrypt() {
return Promise.resolve(cacheVal || {});
},
encryptWithKey(key, dataObj) {
return this.encrypt(key, dataObj);
},
decryptWithKey(key, text) {
return this.decrypt(key, text);
},
keyFromPassword() {
return Promise.resolve(mockKey);
},
generateSalt() {
return 'WHADDASALT!';
},
getRandomValues() {
return 'SOO RANDO!!!1';
},
};
export default mockEncryptor;