From c67b4b61135898d6701ef50a3179a58a6f53ed73 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Sat, 26 Jul 2014 10:21:33 +0200 Subject: [PATCH] support for encodings in sign --- lib/ssh_agent_client.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/ssh_agent_client.js b/lib/ssh_agent_client.js index 3f470c1..d8bfc38 100644 --- a/lib/ssh_agent_client.js +++ b/lib/ssh_agent_client.js @@ -206,7 +206,9 @@ SSHAgentClient.prototype.requestIdentities = function(callback) { * @param {Function} callback of the form f(err, signature). * @throws {TypeError} on invalid arguments. */ -SSHAgentClient.prototype.sign = function(key, data, callback) { +SSHAgentClient.prototype.sign = function(key, data, encoding, callback) { + if (typeof encoding === 'function') + return this.sign(key, data, null, encoding) if (!key || typeof(key) !== 'object') throw new TypeError('key (object) required'); if (!data || typeof(data) !== 'object') @@ -233,7 +235,7 @@ SSHAgentClient.prototype.sign = function(key, data, callback) { return callback(null, { type: type, - signature: signature.toString('base64'), + signature: encoding ? signature.toString(encoding) : signature, _raw: signature }); }