MCPcopy Create free account
hub / github.com/libgit2/pygit2 / Keypair

Class Keypair

pygit2/credentials.py:85–133  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

83
84
85class 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
136class KeypairFromAgent(Keypair):

Callers 3

test_ssh_keyFunction · 0.90
test_ssh_key_aspathFunction · 0.90
credentialsMethod · 0.90

Calls

no outgoing calls

Tested by 3

test_ssh_keyFunction · 0.72
test_ssh_key_aspathFunction · 0.72
credentialsMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…