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

39 lines
617 B
JavaScript
Raw Normal View History

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