2019-12-03 15:52:01 +01:00
|
|
|
const mockHex = '0xabcdef0123456789'
|
|
|
|
const mockKey = Buffer.alloc(32)
|
2016-10-21 21:11:54 +02:00
|
|
|
let cacheVal
|
|
|
|
|
2020-05-19 01:48:11 +02:00
|
|
|
const mockEncryptor = {
|
2020-11-03 00:41:28 +01:00
|
|
|
encrypt(_, dataObj) {
|
2016-10-21 21:11:54 +02:00
|
|
|
cacheVal = dataObj
|
|
|
|
return Promise.resolve(mockHex)
|
|
|
|
},
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
decrypt() {
|
2016-10-21 21:11:54 +02:00
|
|
|
return Promise.resolve(cacheVal || {})
|
|
|
|
},
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
encryptWithKey(key, dataObj) {
|
2016-10-21 21:11:54 +02:00
|
|
|
return this.encrypt(key, dataObj)
|
|
|
|
},
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
decryptWithKey(key, text) {
|
2016-10-21 21:11:54 +02:00
|
|
|
return this.decrypt(key, text)
|
|
|
|
},
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
keyFromPassword() {
|
2016-10-21 21:11:54 +02:00
|
|
|
return Promise.resolve(mockKey)
|
|
|
|
},
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
generateSalt() {
|
2016-10-21 21:11:54 +02:00
|
|
|
return 'WHADDASALT!'
|
|
|
|
},
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
getRandomValues() {
|
2017-09-25 23:45:28 +02:00
|
|
|
return 'SOO RANDO!!!1'
|
2018-07-03 00:49:33 +02:00
|
|
|
},
|
2016-10-21 21:11:54 +02:00
|
|
|
}
|
2020-05-19 01:48:11 +02:00
|
|
|
|
|
|
|
export default mockEncryptor
|