GetSSHKey returns the SSH-specific key information from the Cred object.
()
| 122 | |
| 123 | // GetSSHKey returns the SSH-specific key information from the Cred object. |
| 124 | func (o *Credential) GetSSHKey() (username, publickey, privatekey, passphrase string, err error) { |
| 125 | if o.Type() != CredentialTypeSSHKey && o.Type() != CredentialTypeSSHMemory { |
| 126 | err = fmt.Errorf("credential is not an SSH key: %v", o.Type()) |
| 127 | return |
| 128 | } |
| 129 | |
| 130 | sshKeyCredPtr := (*C.git_cred_ssh_key)(unsafe.Pointer(o.ptr)) |
| 131 | username = C.GoString(sshKeyCredPtr.username) |
| 132 | publickey = C.GoString(sshKeyCredPtr.publickey) |
| 133 | privatekey = C.GoString(sshKeyCredPtr.privatekey) |
| 134 | passphrase = C.GoString(sshKeyCredPtr.passphrase) |
| 135 | return |
| 136 | } |
| 137 | |
| 138 | func NewCredentialUsername(username string) (*Credential, error) { |
| 139 | runtime.LockOSThread() |
no test coverage detected