Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions test/tests/cred.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var assert = require("assert");
var path = require("path");
var fs = require("fs");
var local = path.join.bind(path, __dirname);

describe("Cred", function() {
Expand All @@ -23,6 +24,23 @@ describe("Cred", function() {
assert.ok(cred instanceof NodeGit.Cred);
});

it("can create ssh credentials using passed keys in memory", function() {
var publicKeyContents = fs.readFileSync(sshPublicKey, {
encoding: "ascii"
});
var privateKeyContents = fs.readFileSync(sshPrivateKey, {
encoding: "ascii"
});

return NodeGit.Cred.sshKeyMemoryNew(
"username",
publicKeyContents,
privateKeyContents,
"").then(function(cred) {
assert.ok(cred instanceof NodeGit.Cred);
});
});

it("can create credentials using plaintext", function() {
var plaintextCreds = NodeGit.Cred.userpassPlaintextNew
("username", "password");
Expand Down
1 change: 1 addition & 0 deletions vendor/libgit2.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"defines": [
"GIT_THREADS",
"GIT_SSH",
"GIT_SSH_MEMORY_CREDENTIALS",
# Node's util.h may be accidentally included so use this to guard
# against compilation error.
"SRC_UTIL_H_",
Expand Down