SSH key pair credentials. This is an object suitable for passing to a remote's credentials callback and for returning from said callback. Parameters: username : str The username being used to authenticate with the remote server. pubkey : str The path to t
| 83 | |
| 84 | |
| 85 | class Keypair: |
| 86 | """ |
| 87 | SSH key pair credentials. |
| 88 | |
| 89 | This is an object suitable for passing to a remote's credentials |
| 90 | callback and for returning from said callback. |
| 91 | |
| 92 | Parameters: |
| 93 | |
| 94 | username : str |
| 95 | The username being used to authenticate with the remote server. |
| 96 | |
| 97 | pubkey : str |
| 98 | The path to the user's public key file. |
| 99 | |
| 100 | privkey : str |
| 101 | The path to the user's private key file. |
| 102 | |
| 103 | passphrase : str |
| 104 | The password used to decrypt the private key file, or empty string if |
| 105 | no passphrase is required. |
| 106 | """ |
| 107 | |
| 108 | def __init__( |
| 109 | self, |
| 110 | username: str, |
| 111 | pubkey: str | Path | None, |
| 112 | privkey: str | Path | None, |
| 113 | passphrase: str | None, |
| 114 | ): |
| 115 | self._username = username |
| 116 | self._pubkey = pubkey |
| 117 | self._privkey = privkey |
| 118 | self._passphrase = passphrase |
| 119 | |
| 120 | @property |
| 121 | def credential_type(self) -> CredentialType: |
| 122 | return CredentialType.SSH_KEY |
| 123 | |
| 124 | @property |
| 125 | def credential_tuple( |
| 126 | self, |
| 127 | ) -> tuple[str, str | Path | None, str | Path | None, str | None]: |
| 128 | return (self._username, self._pubkey, self._privkey, self._passphrase) |
| 129 | |
| 130 | def __call__( |
| 131 | self, _url: str, _username: str | None, _allowed: CredentialType |
| 132 | ) -> Keypair: |
| 133 | return self |
| 134 | |
| 135 | |
| 136 | class KeypairFromAgent(Keypair): |
no outgoing calls
searching dependent graphs…