diff options
| author | Carlos Martín Nieto <cmn@dwim.me> | 2013-10-23 12:08:54 +0200 |
|---|---|---|
| committer | Carlos Martín Nieto <cmn@dwim.me> | 2013-10-23 12:08:54 +0200 |
| commit | 70a8c78f3618d70cf6de0961e4e3884a003a1ff0 (patch) | |
| tree | 10125dc971a3e97eef2d793cad5567e9e9f046f4 /include/git2/transport.h | |
| parent | 1c74686e05c41c30944173bacec3a8312f08cbb5 (diff) | |
| download | libgit2-70a8c78f3618d70cf6de0961e4e3884a003a1ff0.tar.gz | |
Rename the ssh credentials
The names from libssh2 are somewhat obtuse for us. We can simplify the
usual key/passphrase credential's name, as well as make clearer what the
custom signature function is.
Diffstat (limited to 'include/git2/transport.h')
| -rw-r--r-- | include/git2/transport.h | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/include/git2/transport.h b/include/git2/transport.h index 065b31820..2cbae2f70 100644 --- a/include/git2/transport.h +++ b/include/git2/transport.h @@ -33,11 +33,11 @@ typedef enum { /* git_cred_userpass_plaintext */ GIT_CREDTYPE_USERPASS_PLAINTEXT = (1u << 0), - /* git_cred_ssh_keyfile_passphrase */ - GIT_CREDTYPE_SSH_KEYFILE_PASSPHRASE = (1u << 1), + /* git_cred_ssh_key */ + GIT_CREDTYPE_SSH_KEY = (1u << 1), - /* git_cred_ssh_publickey */ - GIT_CREDTYPE_SSH_PUBLICKEY = (1u << 2), + /* git_cred_ssh_custom */ + GIT_CREDTYPE_SSH_CUSTOM = (1u << 2), } git_credtype_t; /* The base structure for all credential types */ @@ -61,24 +61,28 @@ typedef LIBSSH2_USERAUTH_PUBLICKEY_SIGN_FUNC((*git_cred_sign_callback)); typedef int (*git_cred_sign_callback)(void *, ...); #endif -/* An ssh key file and passphrase */ -typedef struct git_cred_ssh_keyfile_passphrase { +/** + * A ssh key from disk + */ +typedef struct git_cred_ssh_key { git_cred parent; char *username; char *publickey; char *privatekey; char *passphrase; -} git_cred_ssh_keyfile_passphrase; +} git_cred_ssh_key; -/* An ssh public key and authentication callback */ -typedef struct git_cred_ssh_publickey { +/** + * A key with a custom signature function + */ +typedef struct git_cred_ssh_custom { git_cred parent; char *username; char *publickey; size_t publickey_len; void *sign_callback; void *sign_data; -} git_cred_ssh_publickey; +} git_cred_ssh_custom; /** * Check whether a credential object contains username information. @@ -89,7 +93,7 @@ typedef struct git_cred_ssh_publickey { GIT_EXTERN(int) git_cred_has_username(git_cred *cred); /** - * Creates a new plain-text username and password credential object. + * Create a new plain-text username and password credential object. * The supplied credential parameter will be internally duplicated. * * @param out The newly created credential object. @@ -103,7 +107,7 @@ GIT_EXTERN(int) git_cred_userpass_plaintext_new( const char *password); /** - * Creates a new ssh key file and passphrase credential object. + * Create a new passphrase-protected ssh key credential object. * The supplied credential parameter will be internally duplicated. * * @param out The newly created credential object. @@ -113,15 +117,21 @@ GIT_EXTERN(int) git_cred_userpass_plaintext_new( * @param passphrase The passphrase of the credential. * @return 0 for success or an error code for failure */ -GIT_EXTERN(int) git_cred_ssh_keyfile_passphrase_new( +GIT_EXTERN(int) git_cred_ssh_key_new( git_cred **out, const char *username, const char *publickey, const char *privatekey, - const char *passphrase); + const char *passphrase); /** - * Creates a new ssh public key credential object. + * Create an ssh key credential with a custom signing function. + * + * This lets you use your own function to sign the challenge. + * + * This function and its credential type is provided for completeness + * and wraps `libssh2_userauth_publickey()`, which is undocumented. + * * The supplied credential parameter will be internally duplicated. * * @param out The newly created credential object. @@ -132,7 +142,7 @@ GIT_EXTERN(int) git_cred_ssh_keyfile_passphrase_new( * @param sign_data The data to pass to the sign function. * @return 0 for success or an error code for failure */ -GIT_EXTERN(int) git_cred_ssh_publickey_new( +GIT_EXTERN(int) git_cred_ssh_custom_new( git_cred **out, const char *username, const char *publickey, |
