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

33 lines
549 B
JavaScript
Raw Normal View History

var mockHex = '0xabcdef0123456789'
var mockKey = new Buffer(32)
let cacheVal
module.exports = {
2017-05-04 23:35:10 +02:00
encrypt (password, dataObj) {
cacheVal = dataObj
return Promise.resolve(mockHex)
},
2017-05-04 23:35:10 +02:00
decrypt (password, text) {
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)
},
2017-05-04 23:35:10 +02:00
keyFromPassword (password) {
return Promise.resolve(mockKey)
},
2017-05-04 23:35:10 +02:00
generateSalt () {
return 'WHADDASALT!'
},
}