aboutsummaryrefslogtreecommitdiffstats
path: root/test/lib/mock-encryptor.js
blob: ef229a82f4282e79d1f8f5b8551e4be5e9e15de2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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!'
  },

  getRandomValues () {
    return 'SOO RANDO!!!1'
  }

}