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

43 lines
724 B
JavaScript
Raw Normal View History

const mockHex = '0xabcdef0123456789';
const mockKey = Buffer.alloc(32);
let cacheVal;
const mockEncryptor = {
async encrypt(_, dataObj) {
cacheVal = dataObj;
return mockHex;
},
async decrypt() {
return cacheVal || {};
},
encryptWithDetail(_, dataObj) {
cacheVal = dataObj;
return Promise.resolve({ vault: mockHex, exportedKeyString: '' });
},
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);
},
async keyFromPassword() {
return 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;