NewCredentialSSHKeyFromMemory creates new ssh credentials using the publicKey and privateKey arguments as the values for the public and private keys.
(username string, publicKey string, privateKey string, passphrase string)
| 192 | // NewCredentialSSHKeyFromMemory creates new ssh credentials using the publicKey and privateKey |
| 193 | // arguments as the values for the public and private keys. |
| 194 | func NewCredentialSSHKeyFromMemory(username string, publicKey string, privateKey string, passphrase string) (*Credential, error) { |
| 195 | runtime.LockOSThread() |
| 196 | defer runtime.UnlockOSThread() |
| 197 | |
| 198 | cred := newCredential() |
| 199 | cusername := C.CString(username) |
| 200 | defer C.free(unsafe.Pointer(cusername)) |
| 201 | cpublickey := C.CString(publicKey) |
| 202 | defer C.free(unsafe.Pointer(cpublickey)) |
| 203 | cprivatekey := C.CString(privateKey) |
| 204 | defer C.free(unsafe.Pointer(cprivatekey)) |
| 205 | cpassphrase := C.CString(passphrase) |
| 206 | defer C.free(unsafe.Pointer(cpassphrase)) |
| 207 | ret := C.git_credential_ssh_key_memory_new(&cred.ptr, cusername, cpublickey, cprivatekey, cpassphrase) |
| 208 | if ret != 0 { |
| 209 | cred.Free() |
| 210 | return nil, MakeGitError(ret) |
| 211 | } |
| 212 | return cred, nil |
| 213 | } |
| 214 | |
| 215 | func NewCredentialSSHKeyFromAgent(username string) (*Credential, error) { |
| 216 | runtime.LockOSThread() |
no test coverage detected
searching dependent graphs…