Skip to content

Commit

Permalink
Do not return an object value from a constructor. Fixes nodemailer#807
Browse files Browse the repository at this point in the history
  • Loading branch information
andris9 committed Oct 11, 2017
1 parent 78e99a9 commit b889615
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/xoauth2/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ class XOAuth2 extends Stream {

if (options && options.serviceClient) {
if (!options.privateKey || !options.user) {
return setImmediate(() => this.emit('error', new Error('Options "privateKey" and "user" are required for service account!')));
setImmediate(() => this.emit('error', new Error('Options "privateKey" and "user" are required for service account!')));
return;
}

let serviceRequestTimeout = Math.min(Math.max(Number(this.options.serviceRequestTimeout) || 0, 0), 3600);
Expand Down Expand Up @@ -300,7 +301,10 @@ class XOAuth2 extends Stream {
*/
jwtSignRS256(payload) {
payload = ['{"alg":"RS256","typ":"JWT"}', JSON.stringify(payload)].map(val => this.toBase64URL(val)).join('.');
let signature = crypto.createSign('RSA-SHA256').update(payload).sign(this.options.privateKey);
let signature = crypto
.createSign('RSA-SHA256')
.update(payload)
.sign(this.options.privateKey);
return payload + '.' + this.toBase64URL(signature);
}
}
Expand Down

0 comments on commit b889615

Please sign in to comment.