Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
codyrigney92 committed Aug 26, 2016
2 parents 44ddfe5 + 7b4fff9 commit df563a9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var server = new SFTPS3Server(s3);
server.addHostKey(fs.readFileSync(path.join(__dirname, 'server_key_rsa')));
//Add users' public keys. These can also be added after the server has already started
server.addPublicKey(fs.readFileSync(path.join(__dirname, 'client_key_rsa.pub')), 'baruser');
server.addPublicKey(fs.readFileSync(path.join(__dirname, 'client_key_rsa.pub')), 'baruser' /* , 'myapp' (optional path prefix) */);
server.listen(2222, '127.0.0.1', function(port) {
console.log('Listening on ' + port);
Expand Down
9 changes: 7 additions & 2 deletions lib/node-sftp-s3.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,15 @@ class SFTPS3Server extends EventEmitter {
*
* @param {string} key
* @param {string} username - username for specified key
* @param {string} [ns] - Additional path prefix
*/
addPublicKey(key, username) {
addPublicKey(key, username, ns) {
var pubKey = utils.genPublicKey(utils.parseKey(key));
this.publicKeys.push({ key: pubKey, username: username, path: _path.normalize(username) });
var path = _path.normalize(username);
if(ns) {
path = _path.join(_path.normalize(ns), path);
}
this.publicKeys.push({ key: pubKey, username: username, path: path });
}

/**
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-sftp-s3",
"version": "0.0.1",
"version": "0.0.2",
"description": "Node JS module for creating an SFTP server with user isolation that uses S3 for file storage.",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit df563a9

Please sign in to comment.