File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 11var assert = require ( "assert" ) ;
22var path = require ( "path" ) ;
3+ var fs = require ( "fs" ) ;
34var local = path . join . bind ( path , __dirname ) ;
45
56describe ( "Cred" , function ( ) {
@@ -23,6 +24,23 @@ describe("Cred", function() {
2324 assert . ok ( cred instanceof NodeGit . Cred ) ;
2425 } ) ;
2526
27+ it ( "can create ssh credentials using passed keys in memory" , function ( ) {
28+ var publicKeyContents = fs . readFileSync ( sshPublicKey , {
29+ encoding : "ascii"
30+ } ) ;
31+ var privateKeyContents = fs . readFileSync ( sshPrivateKey , {
32+ encoding : "ascii"
33+ } ) ;
34+
35+ return NodeGit . Cred . sshKeyMemoryNew (
36+ "username" ,
37+ publicKeyContents ,
38+ privateKeyContents ,
39+ "" ) . then ( function ( cred ) {
40+ assert . ok ( cred instanceof NodeGit . Cred ) ;
41+ } ) ;
42+ } ) ;
43+
2644 it ( "can create credentials using plaintext" , function ( ) {
2745 var plaintextCreds = NodeGit . Cred . userpassPlaintextNew
2846 ( "username" , "password" ) ;
Original file line number Diff line number Diff line change 1616 "defines" : [
1717 "GIT_THREADS" ,
1818 "GIT_SSH" ,
19+ "GIT_SSH_MEMORY_CREDENTIALS" ,
1920 # Node's util.h may be accidentally included so use this to guard
2021 # against compilation error.
2122 "SRC_UTIL_H_" ,
You can’t perform that action at this time.
0 commit comments