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

37 lines
605 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!'
},
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
}