1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00
metamask-extension/test/lib/mock-encryptor.js

37 lines
578 B
JavaScript
Raw Normal View History

var mockHex = '0xabcdef0123456789'
2018-10-09 14:02:48 +02:00
var mockKey = Buffer.alloc(32)
let cacheVal
module.exports = {
encrypt (_, dataObj) {
cacheVal = dataObj
return Promise.resolve(mockHex)
},
decrypt () {
return Promise.resolve(cacheVal || {})
},
2017-05-04 23:35:10 +02:00
encryptWithKey (key, dataObj) {
return this.encrypt(key, dataObj)
},
2017-05-04 23:35:10 +02:00
decryptWithKey (key, text) {
return this.decrypt(key, text)
},
keyFromPassword () {
return Promise.resolve(mockKey)
},
2017-05-04 23:35:10 +02:00
generateSalt () {
return 'WHADDASALT!'
},
2017-09-25 23:45:28 +02:00
getRandomValues () {
return 'SOO RANDO!!!1'
2018-07-03 00:49:33 +02:00
},
2017-09-25 23:45:28 +02:00
}