[api] Allow for secure to be simply a secret string.

This commit is contained in:
indexzero 2015-09-18 20:44:29 -07:00
parent 2de2bc0b66
commit 442d2b4233

View file

@ -36,6 +36,10 @@ var File = exports.File = function (options) {
|| 2;
if (this.secure) {
this.secure = typeof this.secure === 'string'
? { secret: this.secure }
: this.secure;
this.secure.alg = this.secure.alg || 'aes-256-ctr';
if (this.secure.secretPath) {
this.secret = fs.readFileSync(this.secure.secretPath, 'utf8');