aboutsummaryrefslogblamecommitdiffstats
path: root/test/lib/mock-encryptor.js
blob: 09bbf7ad5ed0e35cf0b5221af4aedb532167b44f (plain) (tree)































                                          
var mockHex = '0xabcdef0123456789'
var mockKey = new Buffer(32)
let cacheVal

module.exports = {

  encrypt(password, dataObj) {
    cacheVal = dataObj
    return Promise.resolve(mockHex)
  },

  decrypt(password, text) {
    return Promise.resolve(cacheVal || {})
  },

  encryptWithKey(key, dataObj) {
    return this.encrypt(key, dataObj)
  },

  decryptWithKey(key, text) {
    return this.decrypt(key, text)
  },

  keyFromPassword(password) {
    return Promise.resolve(mockKey)
  },

  generateSalt() {
    return 'WHADDASALT!'
  },

}