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

37 lines
580 B
JavaScript
Raw Normal View History

const mockHex = '0xabcdef0123456789'
const mockKey = Buffer.alloc(32)
let cacheVal
export default {
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
}