diff options
Diffstat (limited to 'lib/app.js')
-rw-r--r-- | lib/app.js | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -27,7 +27,7 @@ var Base64URL = require('base64-url') var ssbKeys = require('ssb-keys') var Url = require('url') -var zeros = new Buffer(24); zeros.fill(0) +var zeros = Buffer.alloc(24); zeros.fill(0) module.exports = App @@ -52,8 +52,8 @@ function App(sbot, config) { this.portRegexp = new RegExp(':' + this.ssbPort + '$') this.caps = config.caps || {} this.peerInviteCap = this.caps.peerInvite - || new Buffer('HT0wIYuk3OWc2FtaCfHNnakV68jSGRrjRMP9Kos7IQc=', 'base64') // sha256('peer-invites') - this.devPeerInviteCap = new Buffer('pmr+IzM+4VAZgi5H5bOopXkwnzqrNussS7DtAJsfbf0=', 'base64') // sha256('peer-invites:DEVELOPMENT') + || Buffer.from('HT0wIYuk3OWc2FtaCfHNnakV68jSGRrjRMP9Kos7IQc=', 'base64') // sha256('peer-invites') + this.devPeerInviteCap = Buffer.from('pmr+IzM+4VAZgi5H5bOopXkwnzqrNussS7DtAJsfbf0=', 'base64') // sha256('peer-invites:DEVELOPMENT') this.voteBranches = !!config.voteBranches this.copyableIds = config.copyableIds == null ? true : config.copyableIds @@ -241,8 +241,8 @@ App.prototype.unboxContentWithKey = function (content, key, cb) { if (!key) return this.unboxContent(content, cb) var data try { - var contentBuf = new Buffer(content.replace(/\.box.*$/, ''), 'base64') - var keyBuf = new Buffer(key, 'base64') + var contentBuf = Buffer.from(content.replace(/\.box.*$/, ''), 'base64') + var keyBuf = Buffer.from(key, 'base64') data = PrivateBox.multibox_open_body(contentBuf, keyBuf) if (!data) return cb(new Error('failed to decrypt')) data = JSON.parse(data.toString('utf8')) @@ -476,7 +476,7 @@ App.prototype.getBlob = function (id, key) { } } if (!key) return this.sbot.blobs.get(id) - if (typeof key === 'string') key = new Buffer(key, 'base64') + if (typeof key === 'string') key = Buffer.from(key, 'base64') return pull( this.sbot.blobs.get(id), BoxStream.createUnboxStream(key, zeros) |