Allow test key suitability check to be dependent on the connected agent
Marco Ricci

Marco Ricci commited on 2025-01-25 00:10:44
Zeige 1 geänderte Dateien mit 17 Einfügungen und 3 Löschungen.

... ...
@@ -78,9 +78,23 @@ class SSHTestKey(NamedTuple):
78 78
     derived_passphrase: bytes | str | None = None
79 79
     """"""
80 80
 
81
-    def is_suitable(self) -> bool:
82
-        """Return if this key is suitable for use with vault."""
83
-        return vault.Vault.is_suitable_ssh_key(self.public_key_data)
81
+    def is_suitable(
82
+        self,
83
+        *,
84
+        client: ssh_agent.SSHAgentClient | None = None,
85
+    ) -> bool:
86
+        """Return if this key is suitable for use with vault.
87
+
88
+        Args:
89
+            client:
90
+                An optional SSH agent client to check for additional
91
+                deterministic key types. If not given, assume no such
92
+                types.
93
+
94
+        """
95
+        return vault.Vault.is_suitable_ssh_key(
96
+            self.public_key_data, client=client
97
+        )
84 98
 
85 99
 
86 100
 class ValidationSettings(NamedTuple):
87 101