[fix] handle buffers so we dont get ambiguous errors when we dont strictly read the file as utf8

This commit is contained in:
Jarrett Cruger 2016-02-02 16:38:48 -08:00
parent 54cab2059a
commit 4431c33162

View file

@ -38,8 +38,8 @@ var File = exports.File = function (options) {
|| 2; || 2;
if (this.secure) { if (this.secure) {
this.secure = typeof this.secure === 'string' this.secure = Buffer.isBuffer(this.secure) || typeof this.secure === 'string'
? { secret: this.secure } ? { secret: this.secure.toString() }
: this.secure; : this.secure;
this.secure.alg = this.secure.alg || 'aes-256-ctr'; this.secure.alg = this.secure.alg || 'aes-256-ctr';