1 /* 2 * Copyright (C) the libgit2 contributors. All rights reserved. 3 * 4 * This file is part of libgit2, distributed under the GNU GPL v2 with 5 * a Linking Exception. For full terms see the included COPYING file. 6 */ 7 /** 8 * License: GPL-2.0(Linking Exception) 9 */ 10 module libgit2.sys.credential; 11 12 13 private static import libgit2.credential; 14 15 /* 16 * @file git2/sys/cred.h 17 * @brief Git credentials low-level implementation 18 * @defgroup git_credential Git credentials low-level implementation 19 * @ingroup Git 20 * @{ 21 */ 22 extern (C): 23 nothrow @nogc: 24 25 /** 26 * The base structure for all credential types 27 */ 28 struct git_credential 29 { 30 /** 31 * A type of credential 32 */ 33 libgit2.credential.git_credential_t credtype = cast(libgit2.credential.git_credential_t)(0); 34 35 /** 36 * The deallocator for this type of credentials 37 */ 38 void function(.git_credential* cred) free; 39 } 40 41 /** 42 * A plaintext username and password 43 */ 44 struct git_credential_userpass_plaintext 45 { 46 /** 47 * The parent credential 48 */ 49 .git_credential parent; 50 51 /** 52 * The username to authenticate as 53 */ 54 char* username; 55 56 /** 57 * The password to use 58 */ 59 char* password; 60 } 61 62 /** 63 * Username-only credential information 64 */ 65 struct git_credential_username 66 { 67 /** 68 * The parent credential 69 */ 70 .git_credential parent; 71 72 /** 73 * The username to authenticate as. 74 * 75 * This member is treated as an array. 76 */ 77 char username; 78 } 79 80 /** 81 * A ssh key from disk 82 */ 83 struct git_credential_ssh_key 84 { 85 /** 86 * The parent credential 87 */ 88 .git_credential parent; 89 90 /** 91 * The username to authenticate as 92 */ 93 char* username; 94 95 /** 96 * The path to a public key 97 */ 98 char* publickey; 99 100 /** 101 * The path to a private key 102 */ 103 char* privatekey; 104 105 /** 106 * Passphrase to decrypt the private key 107 */ 108 char* passphrase; 109 } 110 111 /** 112 * Keyboard-interactive based ssh authentication 113 */ 114 struct git_credential_ssh_interactive 115 { 116 /** 117 * The parent credential 118 */ 119 .git_credential parent; 120 121 /** 122 * The username to authenticate as 123 */ 124 char* username; 125 126 /** 127 * Callback used for authentication. 128 */ 129 libgit2.credential.git_credential_ssh_interactive_cb prompt_callback; 130 131 /** 132 * Payload passed to prompt_callback 133 */ 134 void* payload; 135 } 136 137 /** 138 * A key with a custom signature function 139 */ 140 struct git_credential_ssh_custom 141 { 142 /** 143 * The parent credential 144 */ 145 .git_credential parent; 146 147 /** 148 * The username to authenticate as 149 */ 150 char* username; 151 152 /** 153 * The public key data 154 */ 155 char* publickey; 156 157 /** 158 * Length of the public key 159 */ 160 size_t publickey_len; 161 162 /** 163 * Callback used to sign the data. 164 */ 165 libgit2.credential.git_credential_sign_cb sign_callback; 166 167 /** 168 * Payload passed to prompt_callback 169 */ 170 void* payload; 171 }