git.schokokeks.org
Repositories
Help
Report an Issue
derivepassphrase.git
Code
Commits
Branches
Tags
Suche
Strukturansicht:
50490f6
Branches
Tags
documentation-tree
master
0.1.0
0.1.1
0.1.2
0.1.3
0.2.0
0.3.0
0.3.1
0.3.2
0.3.3
derivepassphrase.git
0.x
reference
derivepassphrase.ssh_agent
index.html
Deployed ffee25004de8 to 0.x with MkDocs 1.6.1 and mike 2.1.3
Marco Ricci
commited
50490f6
at 2024-10-21 15:11:06
index.html
Blame
History
Raw
<!doctype html> <html lang="en" class="no-js"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <meta name="description" content="An almost faithful Python reimplementation of James Coglan's vault."> <meta name="author" content="Marco Ricci"> <link rel="canonical" href="https://the13thletter.info/derivepassphrase/0.x/reference/derivepassphrase.ssh_agent/"> <link rel="prev" href="../derivepassphrase.sequin/"> <link rel="next" href="../derivepassphrase._types/"> <link rel="icon" href="../../assets/images/favicon.png"> <meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.5.39"> <title>Submodule ssh_agent - derivepassphrase</title> <link rel="stylesheet" href="../../assets/stylesheets/main.8c3ca2c6.min.css"> <style>:root{--md-text-font:"Noto Sans";--md-code-font:"Noto Mono"}</style> <link rel="stylesheet" href="../../assets/_mkdocstrings.css"> <link rel="stylesheet" href="../../mkdocstrings_recommended_styles.css"> </head> <body dir="ltr"> <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off"> <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off"> <label class="md-overlay" for="__drawer"></label> <div data-md-component="skip"> <a href="#derivepassphrase.ssh_agent" class="md-skip"> Skip to content </a> </div> <div data-md-component="announce"> </div> <div data-md-color-scheme="default" data-md-component="outdated" hidden> </div> <div class="md-container" data-md-component="container"> <nav class="md-tabs" aria-label="Tabs" data-md-component="tabs"> <div class="md-grid"> <ul class="md-tabs__list"> <li class="md-tabs__item"> <a href="../.." class="md-tabs__link"> Overview </a> </li> <li class="md-tabs__item"> <a href="../../tutorials/basic-setup-passphrase/" class="md-tabs__link"> Tutorials & Examples </a> </li> <li class="md-tabs__item md-tabs__item--active"> <a href="../" class="md-tabs__link"> Reference </a> </li> <li class="md-tabs__item"> <a href="../../changelog/" class="md-tabs__link"> Changelog </a> </li> </ul> </div> </nav> <main class="md-main" data-md-component="main"> <div class="md-main__inner md-grid"> <div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" > <div class="md-sidebar__scrollwrap"> <div class="md-sidebar__inner"> <nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0"> <label class="md-nav__title" for="__drawer"> <a href="../.." title="derivepassphrase" class="md-nav__button md-logo" aria-label="derivepassphrase" data-md-component="logo"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54"/></svg> </a> derivepassphrase </label> <div class="md-nav__source"> <a href="https://github.com/the-13th-letter/derivepassphrase" title="Go to repository" class="md-source" data-md-component="source"> <div class="md-source__icon md-icon"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2024 Fonticons, Inc.--><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81"/></svg> </div> <div class="md-source__repository"> the-13th-letter/derivepassphrase </div> </a> </div> <ul class="md-nav__list" data-md-scrollfix> <li class="md-nav__item"> <a href="../.." class="md-nav__link"> <span class="md-ellipsis"> Overview </span> </a> </li> <li class="md-nav__item md-nav__item--nested"> <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_2" > <label class="md-nav__link" for="__nav_2" id="__nav_2_label" tabindex="0"> <span class="md-ellipsis"> Tutorials & Examples </span> <span class="md-nav__icon md-icon"></span> </label> <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_2_label" aria-expanded="false"> <label class="md-nav__title" for="__nav_2"> <span class="md-nav__icon md-icon"></span> Tutorials & Examples </label> <ul class="md-nav__list" data-md-scrollfix> <li class="md-nav__item"> <a href="../../tutorials/basic-setup-passphrase/" class="md-nav__link"> <span class="md-ellipsis"> Tutorial: setting up derivepassphrase vault for three accounts, with a master passphrase </span> </a> </li> </ul> </nav> </li> <li class="md-nav__item md-nav__item--active md-nav__item--section md-nav__item--nested"> <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_3" checked> <div class="md-nav__link md-nav__container"> <a href="../" class="md-nav__link "> <span class="md-ellipsis"> Reference </span> </a> <label class="md-nav__link " for="__nav_3" id="__nav_3_label" tabindex=""> <span class="md-nav__icon md-icon"></span> </label> </div> <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_3_label" aria-expanded="true"> <label class="md-nav__title" for="__nav_3"> <span class="md-nav__icon md-icon"></span> Reference </label> <ul class="md-nav__list" data-md-scrollfix> <li class="md-nav__item"> <a href="../derivepassphrase.1/" class="md-nav__link"> <span class="md-ellipsis"> Man page: derivepassphrase </span> </a> </li> <li class="md-nav__item"> <a href="../derivepassphrase-vault.1/" class="md-nav__link"> <span class="md-ellipsis"> Man page: derivepassphrase-vault </span> </a> </li> <li class="md-nav__item"> <a href="../derivepassphrase-export.1/" class="md-nav__link"> <span class="md-ellipsis"> Man page: derivepassphrase-export </span> </a> </li> <li class="md-nav__item"> <a href="../derivepassphrase-export-vault.1/" class="md-nav__link"> <span class="md-ellipsis"> Man page: derivepassphrase-export-vault </span> </a> </li> <li class="md-nav__item md-nav__item--active md-nav__item--section md-nav__item--nested"> <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_3_6" checked> <label class="md-nav__link" for="__nav_3_6" id="__nav_3_6_label" tabindex=""> <span class="md-ellipsis"> Module derivepassphrase </span> <span class="md-nav__icon md-icon"></span> </label> <nav class="md-nav" data-md-level="2" aria-labelledby="__nav_3_6_label" aria-expanded="true"> <label class="md-nav__title" for="__nav_3_6"> <span class="md-nav__icon md-icon"></span> Module derivepassphrase </label> <ul class="md-nav__list" data-md-scrollfix> <li class="md-nav__item"> <a href="../derivepassphrase.cli/" class="md-nav__link"> <span class="md-ellipsis"> Submodule cli </span> </a> </li> <li class="md-nav__item"> <a href="../derivepassphrase.exporter/" class="md-nav__link"> <span class="md-ellipsis"> Subpackage exporter </span> </a> </li> <li class="md-nav__item"> <a href="../derivepassphrase.sequin/" class="md-nav__link"> <span class="md-ellipsis"> Submodule sequin </span> </a> </li> <li class="md-nav__item md-nav__item--active"> <input class="md-nav__toggle md-toggle" type="checkbox" id="__toc"> <label class="md-nav__link md-nav__link--active" for="__toc"> <span class="md-ellipsis"> Submodule ssh_agent </span> <span class="md-nav__icon md-icon"></span> </label> <a href="./" class="md-nav__link md-nav__link--active"> <span class="md-ellipsis"> Submodule ssh_agent </span> </a> <nav class="md-nav md-nav--secondary" aria-label="Table of contents"> <label class="md-nav__title" for="__toc"> <span class="md-nav__icon md-icon"></span> Table of contents </label> <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix> <li class="md-nav__item"> <a href="#derivepassphrase.ssh_agent" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-module"></code> ssh_agent </span> </a> <nav class="md-nav" aria-label=" ssh_agent"> <ul class="md-nav__list"> <li class="md-nav__item"> <a href="#derivepassphrase.ssh_agent.TrailingDataError" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-class"></code> TrailingDataError </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.ssh_agent.SSHAgentFailedError" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-class"></code> SSHAgentFailedError </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.ssh_agent.SSHAgentClient" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-class"></code> SSHAgentClient </span> </a> <nav class="md-nav" aria-label=" SSHAgentClient"> <ul class="md-nav__list"> <li class="md-nav__item"> <a href="#derivepassphrase.ssh_agent.SSHAgentClient.__enter__" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-method"></code> __enter__ </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.ssh_agent.SSHAgentClient.__exit__" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-method"></code> __exit__ </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.ssh_agent.SSHAgentClient.uint32" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-method"></code> uint32 </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.ssh_agent.SSHAgentClient.string" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-method"></code> string </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.ssh_agent.SSHAgentClient.unstring" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-method"></code> unstring </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.ssh_agent.SSHAgentClient.unstring_prefix" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-method"></code> unstring_prefix </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.ssh_agent.SSHAgentClient.request" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-method"></code> request </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.ssh_agent.SSHAgentClient.list_keys" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-method"></code> list_keys </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.ssh_agent.SSHAgentClient.sign" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-method"></code> sign </span> </a> </li> </ul> </nav> </li> </ul> </nav> </li> </ul> </nav> </li> <li class="md-nav__item"> <a href="../derivepassphrase._types/" class="md-nav__link"> <span class="md-ellipsis"> Submodule _types </span> </a> </li> <li class="md-nav__item"> <a href="../derivepassphrase.vault/" class="md-nav__link"> <span class="md-ellipsis"> Submodule vault </span> </a> </li> </ul> </nav> </li> </ul> </nav> </li> <li class="md-nav__item"> <a href="../../changelog/" class="md-nav__link"> <span class="md-ellipsis"> Changelog </span> </a> </li> </ul> </nav> </div> </div> </div> <div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" > <div class="md-sidebar__scrollwrap"> <div class="md-sidebar__inner"> <nav class="md-nav md-nav--secondary" aria-label="Table of contents"> <label class="md-nav__title" for="__toc"> <span class="md-nav__icon md-icon"></span> Table of contents </label> <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix> <li class="md-nav__item"> <a href="#derivepassphrase.ssh_agent" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-module"></code> ssh_agent </span> </a> <nav class="md-nav" aria-label=" ssh_agent"> <ul class="md-nav__list"> <li class="md-nav__item"> <a href="#derivepassphrase.ssh_agent.TrailingDataError" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-class"></code> TrailingDataError </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.ssh_agent.SSHAgentFailedError" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-class"></code> SSHAgentFailedError </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.ssh_agent.SSHAgentClient" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-class"></code> SSHAgentClient </span> </a> <nav class="md-nav" aria-label=" SSHAgentClient"> <ul class="md-nav__list"> <li class="md-nav__item"> <a href="#derivepassphrase.ssh_agent.SSHAgentClient.__enter__" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-method"></code> __enter__ </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.ssh_agent.SSHAgentClient.__exit__" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-method"></code> __exit__ </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.ssh_agent.SSHAgentClient.uint32" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-method"></code> uint32 </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.ssh_agent.SSHAgentClient.string" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-method"></code> string </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.ssh_agent.SSHAgentClient.unstring" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-method"></code> unstring </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.ssh_agent.SSHAgentClient.unstring_prefix" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-method"></code> unstring_prefix </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.ssh_agent.SSHAgentClient.request" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-method"></code> request </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.ssh_agent.SSHAgentClient.list_keys" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-method"></code> list_keys </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.ssh_agent.SSHAgentClient.sign" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-method"></code> sign </span> </a> </li> </ul> </nav> </li> </ul> </nav> </li> </ul> </nav> </div> </div> </div> <div class="md-content" data-md-component="content"> <article class="md-content__inner md-typeset"> <a href="https://github.com/the-13th-letter/derivepassphrase/raw/master/docs/reference/derivepassphrase.ssh_agent.md" title="View source of this page" class="md-content__button md-icon"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17 18c.56 0 1 .44 1 1s-.44 1-1 1-1-.44-1-1 .44-1 1-1m0-3c-2.73 0-5.06 1.66-6 4 .94 2.34 3.27 4 6 4s5.06-1.66 6-4c-.94-2.34-3.27-4-6-4m0 6.5a2.5 2.5 0 0 1-2.5-2.5 2.5 2.5 0 0 1 2.5-2.5 2.5 2.5 0 0 1 2.5 2.5 2.5 2.5 0 0 1-2.5 2.5M9.27 20H6V4h7v5h5v4.07c.7.08 1.36.25 2 .49V8l-6-6H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h4.5a8.2 8.2 0 0 1-1.23-2"/></svg> </a> <h1>Submodule ssh_agent</h1> <div class="doc doc-object doc-module"> <h2 id="derivepassphrase.ssh_agent" class="doc doc-heading"> <code class="doc-symbol doc-symbol-heading doc-symbol-module"></code> <span class="doc doc-object-name doc-module-name">derivepassphrase.ssh_agent</span> <a href="#derivepassphrase.ssh_agent" class="headerlink" title="Permanent link">¶</a></h2> <div class="doc doc-contents first"> <p>A bare-bones SSH agent client supporting signing and key listing.</p> <div class="doc doc-children"> <div class="doc doc-object doc-class"> <h3 id="derivepassphrase.ssh_agent.TrailingDataError" class="doc doc-heading"> <code class="doc-symbol doc-symbol-heading doc-symbol-class"></code> <span class="doc doc-object-name doc-class-name">TrailingDataError</span> <a href="#derivepassphrase.ssh_agent.TrailingDataError" class="headerlink" title="Permanent link">¶</a></h3> <div class="doc-signature highlight"><pre><span></span><code><span class="nf">TrailingDataError</span><span class="p">()</span> </code></pre></div> <div class="doc doc-contents "> <p class="doc doc-class-bases"> Bases: <code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/exceptions.html#RuntimeError">RuntimeError</a></code></p> <p>The result contained trailing data.</p> <div class="doc doc-children"> </div> </div> </div> <div class="doc doc-object doc-class"> <h3 id="derivepassphrase.ssh_agent.SSHAgentFailedError" class="doc doc-heading"> <code class="doc-symbol doc-symbol-heading doc-symbol-class"></code> <span class="doc doc-object-name doc-class-name">SSHAgentFailedError</span> <a href="#derivepassphrase.ssh_agent.SSHAgentFailedError" class="headerlink" title="Permanent link">¶</a></h3> <div class="doc doc-contents "> <p class="doc doc-class-bases"> Bases: <code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/exceptions.html#RuntimeError">RuntimeError</a></code></p> <p>The SSH agent failed to complete the requested operation.</p> <div class="doc doc-children"> </div> </div> </div> <div class="doc doc-object doc-class"> <h3 id="derivepassphrase.ssh_agent.SSHAgentClient" class="doc doc-heading"> <code class="doc-symbol doc-symbol-heading doc-symbol-class"></code> <span class="doc doc-object-name doc-class-name">SSHAgentClient</span> <a href="#derivepassphrase.ssh_agent.SSHAgentClient" class="headerlink" title="Permanent link">¶</a></h3> <div class="doc-signature highlight"><pre><span></span><code><span class="nf">SSHAgentClient</span><span class="p">(</span> <span class="o">*</span><span class="p">,</span> <span class="n">socket</span><span class="p">:</span> <span class="n"><a class="autorefs autorefs-external" title="socket.socket" href="https://docs.python.org/3/library/socket.html#socket.socket">socket</a></span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="n">timeout</span><span class="p">:</span> <span class="n"><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/functions.html#int">int</a></span> <span class="o">=</span> <span class="mi">125</span> <span class="p">)</span> </code></pre></div> <div class="doc doc-contents "> <p>A bare-bones SSH agent client supporting signing and key listing.</p> <p>The main use case is requesting the agent sign some data, after checking that the necessary key is already loaded.</p> <p>The main fleshed out methods are <a class="autorefs autorefs-internal" href="#derivepassphrase.ssh_agent.SSHAgentClient.list_keys"><code>list_keys</code></a> and <a class="autorefs autorefs-internal" href="#derivepassphrase.ssh_agent.SSHAgentClient.sign"><code>sign</code></a>, which implement the <a class="autorefs autorefs-internal" href="../derivepassphrase._types/#derivepassphrase._types.SSH_AGENTC.REQUEST_IDENTITIES"><code>REQUEST_IDENTITIES</code></a> and <a class="autorefs autorefs-internal" href="../derivepassphrase._types/#derivepassphrase._types.SSH_AGENTC.SIGN_REQUEST"><code>SIGN_REQUEST</code></a> requests. If you <em>really</em> wanted to, there is enough infrastructure in place to issue other requests as defined in the protocol—it’s merely the wrapper functions and the protocol numbers table that are missing.</p> <p><span class="doc-section-title">Parameters:</span></p> <table> <thead> <tr> <th>Name</th> <th>Type</th> <th>Description</th> <th>Default</th> </tr> </thead> <tbody> <tr class="doc-section-item"> <td> <code>socket</code> </td> <td> <code><a class="autorefs autorefs-external" title="socket.socket" href="https://docs.python.org/3/library/socket.html#socket.socket">socket</a> | None</code> </td> <td> <div class="doc-md-description"> <p>An optional socket, already connected to the SSH agent. If not given, we query the <code>SSH_AUTH_SOCK</code> environment variable to auto-discover the correct socket address.</p> <p><a href="https://github.com/the-13th-letter/derivepassphrase/issues/13">We currently only support connecting via UNIX domain sockets</a>, and only on platforms with support for <a href="https://docs.python.org/3/library/socket.html#socket.AF_UNIX"><code>socket.AF_UNIX</code></a>.</p> </div> </td> <td> <code>None</code> </td> </tr> <tr class="doc-section-item"> <td> <code>timeout</code> </td> <td> <code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/functions.html#int">int</a></code> </td> <td> <div class="doc-md-description"> <p>A connection timeout for the SSH agent. Only used if the socket is not yet connected. The default value gives ample time for agent connections forwarded via SSH on high-latency networks (e.g. Tor).</p> </div> </td> <td> <code>125</code> </td> </tr> </tbody> </table> <p><span class="doc-section-title">Raises:</span></p> <table> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr class="doc-section-item"> <td> <code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/exceptions.html#KeyError">KeyError</a></code> </td> <td> <div class="doc-md-description"> <p>The <code>SSH_AUTH_SOCK</code> environment variable was not found.</p> </div> </td> </tr> <tr class="doc-section-item"> <td> <code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/exceptions.html#NotImplementedError">NotImplementedError</a></code> </td> <td> <div class="doc-md-description"> <p>This Python version does not support UNIX domain sockets, necessary to automatically connect to a running SSH agent via the <code>SSH_AUTH_SOCK</code> environment variable.</p> </div> </td> </tr> <tr class="doc-section-item"> <td> <code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/exceptions.html#OSError">OSError</a></code> </td> <td> <div class="doc-md-description"> <p>There was an error setting up a socket connection to the agent.</p> </div> </td> </tr> </tbody> </table> <div class="doc doc-children"> <div class="doc doc-object doc-function"> <h4 id="derivepassphrase.ssh_agent.SSHAgentClient.__enter__" class="doc doc-heading"> <code class="doc-symbol doc-symbol-heading doc-symbol-method"></code> <span class="doc doc-object-name doc-function-name">__enter__</span> <a href="#derivepassphrase.ssh_agent.SSHAgentClient.__enter__" class="headerlink" title="Permanent link">¶</a></h4> <div class="doc-signature highlight"><pre><span></span><code><span class="fm">__enter__</span><span class="p">()</span> <span class="o">-></span> <span class="nf"><a class="autorefs autorefs-external" title="typing_extensions.Self" href="https://typing-extensions.readthedocs.io/en/latest/index.html#typing_extensions.Self">Self</a></span> </code></pre></div> <div class="doc doc-contents "> <p>Close socket connection upon context manager completion.</p> <p><span class="doc-section-title">Returns:</span></p> <table> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr class="doc-section-item"> <td> <code><a class="autorefs autorefs-external" title="typing_extensions.Self" href="https://typing-extensions.readthedocs.io/en/latest/index.html#typing_extensions.Self">Self</a></code> </td> <td> <div class="doc-md-description"> <p>Self.</p> </div> </td> </tr> </tbody> </table> </div> </div> <div class="doc doc-object doc-function"> <h4 id="derivepassphrase.ssh_agent.SSHAgentClient.__exit__" class="doc doc-heading"> <code class="doc-symbol doc-symbol-heading doc-symbol-method"></code> <span class="doc doc-object-name doc-function-name">__exit__</span> <a href="#derivepassphrase.ssh_agent.SSHAgentClient.__exit__" class="headerlink" title="Permanent link">¶</a></h4> <div class="doc-signature highlight"><pre><span></span><code><span class="fm">__exit__</span><span class="p">(</span> <span class="nf">exc_type</span><span class="p">:</span> <span class="n"><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/functions.html#type">type</a></span><span class="p">[</span><span class="n"><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/exceptions.html#BaseException">BaseException</a></span><span class="p">]</span> <span class="o">|</span> <span class="kc">None</span><span class="p">,</span> <span class="n">exc_val</span><span class="p">:</span> <span class="n"><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/exceptions.html#BaseException">BaseException</a></span> <span class="o">|</span> <span class="kc">None</span><span class="p">,</span> <span class="n">exc_tb</span><span class="p">:</span> <span class="n"><a class="autorefs autorefs-external" title="types.TracebackType" href="https://docs.python.org/3/library/types.html#types.TracebackType">TracebackType</a></span> <span class="o">|</span> <span class="kc">None</span><span class="p">,</span> <span class="p">)</span> <span class="o">-></span> <span class="n"><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/functions.html#bool">bool</a></span> </code></pre></div> <div class="doc doc-contents "> <p>Close socket connection upon context manager completion.</p> <p><span class="doc-section-title">Parameters:</span></p> <table> <thead> <tr> <th>Name</th> <th>Type</th> <th>Description</th> <th>Default</th> </tr> </thead> <tbody> <tr class="doc-section-item"> <td> <code>exc_type</code> </td> <td> <code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/functions.html#type">type</a>[<a class="autorefs autorefs-external" href="https://docs.python.org/3/library/exceptions.html#BaseException">BaseException</a>] | None</code> </td> <td> <div class="doc-md-description"> <p>An optional exception type.</p> </div> </td> <td> <em>required</em> </td> </tr> <tr class="doc-section-item"> <td> <code>exc_val</code> </td> <td> <code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/exceptions.html#BaseException">BaseException</a> | None</code> </td> <td> <div class="doc-md-description"> <p>An optional exception value.</p> </div> </td> <td> <em>required</em> </td> </tr> <tr class="doc-section-item"> <td> <code>exc_tb</code> </td> <td> <code><a class="autorefs autorefs-external" title="types.TracebackType" href="https://docs.python.org/3/library/types.html#types.TracebackType">TracebackType</a> | None</code> </td> <td> <div class="doc-md-description"> <p>An optional exception traceback.</p> </div> </td> <td> <em>required</em> </td> </tr> </tbody> </table> <p><span class="doc-section-title">Returns:</span></p> <table> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr class="doc-section-item"> <td> <code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/functions.html#bool">bool</a></code> </td> <td> <div class="doc-md-description"> <p>True if the exception was handled, false if it should propagate.</p> </div> </td> </tr> </tbody> </table> </div> </div> <div class="doc doc-object doc-function"> <h4 id="derivepassphrase.ssh_agent.SSHAgentClient.uint32" class="doc doc-heading"> <code class="doc-symbol doc-symbol-heading doc-symbol-method"></code> <span class="doc doc-object-name doc-function-name">uint32</span> <span class="doc doc-labels"> <small class="doc doc-label doc-label-staticmethod"><code>staticmethod</code></small> </span> <a href="#derivepassphrase.ssh_agent.SSHAgentClient.uint32" class="headerlink" title="Permanent link">¶</a></h4> <div class="doc-signature highlight"><pre><span></span><code><span class="nf">uint32</span><span class="p">(</span><span class="n">num</span><span class="p">:</span> <span class="n"><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/functions.html#int">int</a></span><span class="p">)</span> <span class="o">-></span> <span class="n"><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#bytes">bytes</a></span> </code></pre></div> <div class="doc doc-contents "> <p>Format the number as a <code>uint32</code>, as per the agent protocol.</p> <p><span class="doc-section-title">Parameters:</span></p> <table> <thead> <tr> <th>Name</th> <th>Type</th> <th>Description</th> <th>Default</th> </tr> </thead> <tbody> <tr class="doc-section-item"> <td> <code>num</code> </td> <td> <code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/functions.html#int">int</a></code> </td> <td> <div class="doc-md-description"> <p>A number.</p> </div> </td> <td> <em>required</em> </td> </tr> </tbody> </table> <p><span class="doc-section-title">Returns:</span></p> <table> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr class="doc-section-item"> <td> <code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#bytes">bytes</a></code> </td> <td> <div class="doc-md-description"> <p>The number in SSH agent wire protocol format, i.e. as a 32-bit big endian number.</p> </div> </td> </tr> </tbody> </table> <p><span class="doc-section-title">Raises:</span></p> <table> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr class="doc-section-item"> <td> <code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/exceptions.html#OverflowError">OverflowError</a></code> </td> <td> <div class="doc-md-description"> <p>As per <a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#int.to_bytes"><code>int.to_bytes</code></a>.</p> </div> </td> </tr> </tbody> </table> <p><span class="doc-section-title">Examples:</span></p> <div class="highlight"><pre><span></span><code><span class="gp">>>> </span><span class="n">SSHAgentClient</span><span class="o">.</span><span class="n">uint32</span><span class="p">(</span><span class="mi">16777216</span><span class="p">)</span> <span class="go">b'\x01\x00\x00\x00'</span> </code></pre></div> </div> </div> <div class="doc doc-object doc-function"> <h4 id="derivepassphrase.ssh_agent.SSHAgentClient.string" class="doc doc-heading"> <code class="doc-symbol doc-symbol-heading doc-symbol-method"></code> <span class="doc doc-object-name doc-function-name">string</span> <span class="doc doc-labels"> <small class="doc doc-label doc-label-classmethod"><code>classmethod</code></small> </span> <a href="#derivepassphrase.ssh_agent.SSHAgentClient.string" class="headerlink" title="Permanent link">¶</a></h4> <div class="doc-signature highlight"><pre><span></span><code><span class="nf">string</span><span class="p">(</span><span class="n">payload</span><span class="p">:</span> <span class="n"><a class="autorefs autorefs-external" title="typing_extensions.Buffer" href="https://typing-extensions.readthedocs.io/en/latest/index.html#typing_extensions.Buffer">Buffer</a></span><span class="p">)</span> <span class="o">-></span> <span class="n"><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#bytes">bytes</a></span> </code></pre></div> <div class="doc doc-contents "> <p>Format the payload as an SSH string, as per the agent protocol.</p> <p><span class="doc-section-title">Parameters:</span></p> <table> <thead> <tr> <th>Name</th> <th>Type</th> <th>Description</th> <th>Default</th> </tr> </thead> <tbody> <tr class="doc-section-item"> <td> <code>payload</code> </td> <td> <code><a class="autorefs autorefs-external" title="typing_extensions.Buffer" href="https://typing-extensions.readthedocs.io/en/latest/index.html#typing_extensions.Buffer">Buffer</a></code> </td> <td> <div class="doc-md-description"> <p>A bytes-like object.</p> </div> </td> <td> <em>required</em> </td> </tr> </tbody> </table> <p><span class="doc-section-title">Returns:</span></p> <table> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr class="doc-section-item"> <td> <code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#bytes">bytes</a></code> </td> <td> <div class="doc-md-description"> <p>The payload, framed in the SSH agent wire protocol format, as a bytes object.</p> </div> </td> </tr> </tbody> </table> <p><span class="doc-section-title">Examples:</span></p> <div class="highlight"><pre><span></span><code><span class="gp">>>> </span><span class="n">SSHAgentClient</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="sa">b</span><span class="s1">'ssh-rsa'</span><span class="p">)</span> <span class="go">b'\x00\x00\x00\x07ssh-rsa'</span> </code></pre></div> </div> </div> <div class="doc doc-object doc-function"> <h4 id="derivepassphrase.ssh_agent.SSHAgentClient.unstring" class="doc doc-heading"> <code class="doc-symbol doc-symbol-heading doc-symbol-method"></code> <span class="doc doc-object-name doc-function-name">unstring</span> <span class="doc doc-labels"> <small class="doc doc-label doc-label-classmethod"><code>classmethod</code></small> </span> <a href="#derivepassphrase.ssh_agent.SSHAgentClient.unstring" class="headerlink" title="Permanent link">¶</a></h4> <div class="doc-signature highlight"><pre><span></span><code><span class="nf">unstring</span><span class="p">(</span><span class="n">bytestring</span><span class="p">:</span> <span class="n"><a class="autorefs autorefs-external" title="typing_extensions.Buffer" href="https://typing-extensions.readthedocs.io/en/latest/index.html#typing_extensions.Buffer">Buffer</a></span><span class="p">)</span> <span class="o">-></span> <span class="n"><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#bytes">bytes</a></span> </code></pre></div> <div class="doc doc-contents "> <p>Unpack an SSH string.</p> <p><span class="doc-section-title">Parameters:</span></p> <table> <thead> <tr> <th>Name</th> <th>Type</th> <th>Description</th> <th>Default</th> </tr> </thead> <tbody> <tr class="doc-section-item"> <td> <code>bytestring</code> </td> <td> <code><a class="autorefs autorefs-external" title="typing_extensions.Buffer" href="https://typing-extensions.readthedocs.io/en/latest/index.html#typing_extensions.Buffer">Buffer</a></code> </td> <td> <div class="doc-md-description"> <p>A framed bytes-like object.</p> </div> </td> <td> <em>required</em> </td> </tr> </tbody> </table> <p><span class="doc-section-title">Returns:</span></p> <table> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr class="doc-section-item"> <td> <code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#bytes">bytes</a></code> </td> <td> <div class="doc-md-description"> <p>The payload, as a bytes object.</p> </div> </td> </tr> </tbody> </table> <p><span class="doc-section-title">Raises:</span></p> <table> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr class="doc-section-item"> <td> <code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/exceptions.html#ValueError">ValueError</a></code> </td> <td> <div class="doc-md-description"> <p>The byte string is not an SSH string.</p> </div> </td> </tr> </tbody> </table> <p><span class="doc-section-title">Examples:</span></p> <div class="highlight"><pre><span></span><code><span class="gp">>>> </span><span class="n">SSHAgentClient</span><span class="o">.</span><span class="n">unstring</span><span class="p">(</span><span class="sa">b</span><span class="s1">'</span><span class="se">\x00\x00\x00\x07</span><span class="s1">ssh-rsa'</span><span class="p">)</span> <span class="go">b'ssh-rsa'</span> <span class="gp">>>> </span><span class="n">SSHAgentClient</span><span class="o">.</span><span class="n">unstring</span><span class="p">(</span><span class="n">SSHAgentClient</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="sa">b</span><span class="s1">'ssh-ed25519'</span><span class="p">))</span> <span class="go">b'ssh-ed25519'</span> </code></pre></div> </div> </div> <div class="doc doc-object doc-function"> <h4 id="derivepassphrase.ssh_agent.SSHAgentClient.unstring_prefix" class="doc doc-heading"> <code class="doc-symbol doc-symbol-heading doc-symbol-method"></code> <span class="doc doc-object-name doc-function-name">unstring_prefix</span> <span class="doc doc-labels"> <small class="doc doc-label doc-label-classmethod"><code>classmethod</code></small> </span> <a href="#derivepassphrase.ssh_agent.SSHAgentClient.unstring_prefix" class="headerlink" title="Permanent link">¶</a></h4> <div class="doc-signature highlight"><pre><span></span><code><span class="nf">unstring_prefix</span><span class="p">(</span><span class="n">bytestring</span><span class="p">:</span> <span class="n"><a class="autorefs autorefs-external" title="typing_extensions.Buffer" href="https://typing-extensions.readthedocs.io/en/latest/index.html#typing_extensions.Buffer">Buffer</a></span><span class="p">)</span> <span class="o">-></span> <span class="n"><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#tuple">tuple</a></span><span class="p">[</span><span class="n"><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#bytes">bytes</a></span><span class="p">,</span> <span class="n"><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#bytes">bytes</a></span><span class="p">]</span> </code></pre></div> <div class="doc doc-contents "> <p>Unpack an SSH string at the beginning of the byte string.</p> <p><span class="doc-section-title">Parameters:</span></p> <table> <thead> <tr> <th>Name</th> <th>Type</th> <th>Description</th> <th>Default</th> </tr> </thead> <tbody> <tr class="doc-section-item"> <td> <code>bytestring</code> </td> <td> <code><a class="autorefs autorefs-external" title="typing_extensions.Buffer" href="https://typing-extensions.readthedocs.io/en/latest/index.html#typing_extensions.Buffer">Buffer</a></code> </td> <td> <div class="doc-md-description"> <p>A bytes-like object, beginning with a framed/SSH byte string.</p> </div> </td> <td> <em>required</em> </td> </tr> </tbody> </table> <p><span class="doc-section-title">Returns:</span></p> <table> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr class="doc-section-item"> <td> <code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#tuple">tuple</a>[<a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#bytes">bytes</a>, <a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#bytes">bytes</a>]</code> </td> <td> <div class="doc-md-description"> <p>A 2-tuple <code>(a, b)</code>, where <code>a</code> is the unframed byte string/payload at the beginning of input byte string, and <code>b</code> is the remainder of the input byte string.</p> </div> </td> </tr> </tbody> </table> <p><span class="doc-section-title">Raises:</span></p> <table> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr class="doc-section-item"> <td> <code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/exceptions.html#ValueError">ValueError</a></code> </td> <td> <div class="doc-md-description"> <p>The byte string does not begin with an SSH string.</p> </div> </td> </tr> </tbody> </table> <p><span class="doc-section-title">Examples:</span></p> <div class="highlight"><pre><span></span><code><span class="gp">>>> </span><span class="n">SSHAgentClient</span><span class="o">.</span><span class="n">unstring_prefix</span><span class="p">(</span> <span class="gp">... </span> <span class="sa">b</span><span class="s1">'</span><span class="se">\x00\x00\x00\x07</span><span class="s1">ssh-rsa____trailing data'</span> <span class="gp">... </span><span class="p">)</span> <span class="go">(b'ssh-rsa', b'____trailing data')</span> <span class="gp">>>> </span><span class="n">SSHAgentClient</span><span class="o">.</span><span class="n">unstring_prefix</span><span class="p">(</span> <span class="gp">... </span> <span class="n">SSHAgentClient</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="sa">b</span><span class="s1">'ssh-ed25519'</span><span class="p">)</span> <span class="gp">... </span><span class="p">)</span> <span class="go">(b'ssh-ed25519', b'')</span> </code></pre></div> </div> </div> <div class="doc doc-object doc-function"> <h4 id="derivepassphrase.ssh_agent.SSHAgentClient.request" class="doc doc-heading"> <code class="doc-symbol doc-symbol-heading doc-symbol-method"></code> <span class="doc doc-object-name doc-function-name">request</span> <a href="#derivepassphrase.ssh_agent.SSHAgentClient.request" class="headerlink" title="Permanent link">¶</a></h4> <div class="doc-overloads"> <div class="doc-signature highlight"><pre><span></span><code><span class="nf">request</span><span class="p">(</span> <span class="n">code</span><span class="p">:</span> <span class="n"><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/functions.html#int">int</a></span> <span class="o">|</span> <span class="n"><a class="autorefs autorefs-internal" title="derivepassphrase._types.SSH_AGENTC" href="../derivepassphrase._types/#derivepassphrase._types.SSH_AGENTC">SSH_AGENTC</a></span><span class="p">,</span> <span class="n">payload</span><span class="p">:</span> <span class="n"><a class="autorefs autorefs-external" title="typing_extensions.Buffer" href="https://typing-extensions.readthedocs.io/en/latest/index.html#typing_extensions.Buffer">Buffer</a></span><span class="p">,</span> <span class="o">/</span><span class="p">,</span> <span class="o">*</span><span class="p">,</span> <span class="n">response_code</span><span class="p">:</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="p">)</span> <span class="o">-></span> <span class="n"><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#tuple">tuple</a></span><span class="p">[</span><span class="n"><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/functions.html#int">int</a></span><span class="p">,</span> <span class="n"><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#bytes">bytes</a></span><span class="p">]</span> </code></pre></div><div class="doc-signature highlight"><pre><span></span><code><span class="nf">request</span><span class="p">(</span> <span class="n">code</span><span class="p">:</span> <span class="n"><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/functions.html#int">int</a></span> <span class="o">|</span> <span class="n"><a class="autorefs autorefs-internal" title="derivepassphrase._types.SSH_AGENTC" href="../derivepassphrase._types/#derivepassphrase._types.SSH_AGENTC">SSH_AGENTC</a></span><span class="p">,</span> <span class="n">payload</span><span class="p">:</span> <span class="n"><a class="autorefs autorefs-external" title="typing_extensions.Buffer" href="https://typing-extensions.readthedocs.io/en/latest/index.html#typing_extensions.Buffer">Buffer</a></span><span class="p">,</span> <span class="o">/</span><span class="p">,</span> <span class="o">*</span><span class="p">,</span> <span class="n">response_code</span><span class="p">:</span> <span class="n"><a class="autorefs autorefs-external" title="collections.abc.Iterable" href="https://docs.python.org/3/library/collections.abc.html#collections.abc.Iterable">Iterable</a></span><span class="p">[</span><span class="n"><a class="autorefs autorefs-internal" title="derivepassphrase._types.SSH_AGENT" href="../derivepassphrase._types/#derivepassphrase._types.SSH_AGENT">SSH_AGENT</a></span> <span class="o">|</span> <span class="n"><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/functions.html#int">int</a></span><span class="p">]</span> <span class="o">=</span> <span class="n"><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#frozenset">frozenset</a></span><span class="p">(</span> <span class="p">{</span><span class="n"><a class="autorefs autorefs-internal" title="derivepassphrase._types.SSH_AGENT.SUCCESS" href="../derivepassphrase._types/#derivepassphrase._types.SSH_AGENT.SUCCESS">SUCCESS</a></span><span class="p">}</span> <span class="p">),</span> <span class="p">)</span> <span class="o">-></span> <span class="n"><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#tuple">tuple</a></span><span class="p">[</span><span class="n"><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/functions.html#int">int</a></span><span class="p">,</span> <span class="n"><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#bytes">bytes</a></span><span class="p">]</span> </code></pre></div><div class="doc-signature highlight"><pre><span></span><code><span class="nf">request</span><span class="p">(</span> <span class="n">code</span><span class="p">:</span> <span class="n"><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/functions.html#int">int</a></span> <span class="o">|</span> <span class="n"><a class="autorefs autorefs-internal" title="derivepassphrase._types.SSH_AGENTC" href="../derivepassphrase._types/#derivepassphrase._types.SSH_AGENTC">SSH_AGENTC</a></span><span class="p">,</span> <span class="n">payload</span><span class="p">:</span> <span class="n"><a class="autorefs autorefs-external" title="typing_extensions.Buffer" href="https://typing-extensions.readthedocs.io/en/latest/index.html#typing_extensions.Buffer">Buffer</a></span><span class="p">,</span> <span class="o">/</span><span class="p">,</span> <span class="o">*</span><span class="p">,</span> <span class="n">response_code</span><span class="p">:</span> <span class="n"><a class="autorefs autorefs-internal" title="derivepassphrase._types.SSH_AGENT" href="../derivepassphrase._types/#derivepassphrase._types.SSH_AGENT">SSH_AGENT</a></span> <span class="o">|</span> <span class="n"><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/functions.html#int">int</a></span> <span class="o">=</span> <span class="n"><a class="autorefs autorefs-internal" title="derivepassphrase._types.SSH_AGENT.SUCCESS" href="../derivepassphrase._types/#derivepassphrase._types.SSH_AGENT.SUCCESS">SUCCESS</a></span><span class="p">,</span> <span class="p">)</span> <span class="o">-></span> <span class="n"><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#bytes">bytes</a></span> </code></pre></div> </div> <div class="doc-signature highlight"><pre><span></span><code><span class="nf">request</span><span class="p">(</span> <span class="n">code</span><span class="p">:</span> <span class="n"><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/functions.html#int">int</a></span> <span class="o">|</span> <span class="n"><a class="autorefs autorefs-internal" title="derivepassphrase._types.SSH_AGENTC" href="../derivepassphrase._types/#derivepassphrase._types.SSH_AGENTC">SSH_AGENTC</a></span><span class="p">,</span> <span class="n">payload</span><span class="p">:</span> <span class="n"><a class="autorefs autorefs-external" title="typing_extensions.Buffer" href="https://typing-extensions.readthedocs.io/en/latest/index.html#typing_extensions.Buffer">Buffer</a></span><span class="p">,</span> <span class="o">/</span><span class="p">,</span> <span class="o">*</span><span class="p">,</span> <span class="n">response_code</span><span class="p">:</span> <span class="p">(</span> <span class="n"><a class="autorefs autorefs-external" title="collections.abc.Iterable" href="https://docs.python.org/3/library/collections.abc.html#collections.abc.Iterable">Iterable</a></span><span class="p">[</span><span class="n"><a class="autorefs autorefs-internal" title="derivepassphrase._types.SSH_AGENT" href="../derivepassphrase._types/#derivepassphrase._types.SSH_AGENT">SSH_AGENT</a></span> <span class="o">|</span> <span class="n"><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/functions.html#int">int</a></span><span class="p">]</span> <span class="o">|</span> <span class="n"><a class="autorefs autorefs-internal" title="derivepassphrase._types.SSH_AGENT" href="../derivepassphrase._types/#derivepassphrase._types.SSH_AGENT">SSH_AGENT</a></span> <span class="o">|</span> <span class="n"><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/functions.html#int">int</a></span> <span class="o">|</span> <span class="kc">None</span> <span class="p">)</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="p">)</span> <span class="o">-></span> <span class="n"><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#tuple">tuple</a></span><span class="p">[</span><span class="n"><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/functions.html#int">int</a></span><span class="p">,</span> <span class="n"><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#bytes">bytes</a></span><span class="p">]</span> <span class="o">|</span> <span class="n"><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#bytes">bytes</a></span> </code></pre></div> <div class="doc doc-contents "> <p>Issue a generic request to the SSH agent.</p> <p><span class="doc-section-title">Parameters:</span></p> <table> <thead> <tr> <th>Name</th> <th>Type</th> <th>Description</th> <th>Default</th> </tr> </thead> <tbody> <tr class="doc-section-item"> <td> <code>code</code> </td> <td> <code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/functions.html#int">int</a> | <a class="autorefs autorefs-internal" title="derivepassphrase._types.SSH_AGENTC" href="../derivepassphrase._types/#derivepassphrase._types.SSH_AGENTC">SSH_AGENTC</a></code> </td> <td> <div class="doc-md-description"> <p>The request code. See the SSH agent protocol for protocol numbers to use here (and which protocol numbers to expect in a response).</p> </div> </td> <td> <em>required</em> </td> </tr> <tr class="doc-section-item"> <td> <code>payload</code> </td> <td> <code><a class="autorefs autorefs-external" title="typing_extensions.Buffer" href="https://typing-extensions.readthedocs.io/en/latest/index.html#typing_extensions.Buffer">Buffer</a></code> </td> <td> <div class="doc-md-description"> <p>A bytes-like object containing the payload, or “contents”, of the request. Request-specific.</p> <p>It is our responsibility to add any necessary wire framing around the request code and the payload, not the caller’s.</p> </div> </td> <td> <em>required</em> </td> </tr> <tr class="doc-section-item"> <td> <code>response_code</code> </td> <td> <code><a class="autorefs autorefs-external" title="collections.abc.Iterable" href="https://docs.python.org/3/library/collections.abc.html#collections.abc.Iterable">Iterable</a>[<a class="autorefs autorefs-internal" title="derivepassphrase._types.SSH_AGENT" href="../derivepassphrase._types/#derivepassphrase._types.SSH_AGENT">SSH_AGENT</a> | <a class="autorefs autorefs-external" href="https://docs.python.org/3/library/functions.html#int">int</a>] | <a class="autorefs autorefs-internal" title="derivepassphrase._types.SSH_AGENT" href="../derivepassphrase._types/#derivepassphrase._types.SSH_AGENT">SSH_AGENT</a> | <a class="autorefs autorefs-external" href="https://docs.python.org/3/library/functions.html#int">int</a> | None</code> </td> <td> <div class="doc-md-description"> <p>An optional response code, or a set of response codes, that we expect. If given, and the actual response code does not match, raise an error.</p> </div> </td> <td> <code>None</code> </td> </tr> </tbody> </table> <p><span class="doc-section-title">Returns:</span></p> <table> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr class="doc-section-item"> <td> <code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#tuple">tuple</a>[<a class="autorefs autorefs-external" href="https://docs.python.org/3/library/functions.html#int">int</a>, <a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#bytes">bytes</a>] | <a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#bytes">bytes</a></code> </td> <td> <div class="doc-md-description"> <p>A 2-tuple consisting of the response code and the payload, with all wire framing removed.</p> <p>If a response code was passed, then only return the payload.</p> </div> </td> </tr> </tbody> </table> <p><span class="doc-section-title">Raises:</span></p> <table> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr class="doc-section-item"> <td> <code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/exceptions.html#EOFError">EOFError</a></code> </td> <td> <div class="doc-md-description"> <p>The response from the SSH agent is truncated or missing.</p> </div> </td> </tr> <tr class="doc-section-item"> <td> <code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/exceptions.html#OSError">OSError</a></code> </td> <td> <div class="doc-md-description"> <p>There was a communication error with the SSH agent.</p> </div> </td> </tr> <tr class="doc-section-item"> <td> <code><a class="autorefs autorefs-internal" title="derivepassphrase.ssh_agent.SSHAgentFailedError" href="#derivepassphrase.ssh_agent.SSHAgentFailedError">SSHAgentFailedError</a></code> </td> <td> <div class="doc-md-description"> <p>We expected specific response codes, but did not receive any of them.</p> </div> </td> </tr> </tbody> </table> </div> </div> <div class="doc doc-object doc-function"> <h4 id="derivepassphrase.ssh_agent.SSHAgentClient.list_keys" class="doc doc-heading"> <code class="doc-symbol doc-symbol-heading doc-symbol-method"></code> <span class="doc doc-object-name doc-function-name">list_keys</span> <a href="#derivepassphrase.ssh_agent.SSHAgentClient.list_keys" class="headerlink" title="Permanent link">¶</a></h4> <div class="doc-signature highlight"><pre><span></span><code><span class="nf">list_keys</span><span class="p">()</span> <span class="o">-></span> <span class="n"><a class="autorefs autorefs-external" title="collections.abc.Sequence" href="https://docs.python.org/3/library/collections.abc.html#collections.abc.Sequence">Sequence</a></span><span class="p">[</span><span class="n"><a class="autorefs autorefs-internal" title="derivepassphrase._types.KeyCommentPair" href="../derivepassphrase._types/#derivepassphrase._types.KeyCommentPair">KeyCommentPair</a></span><span class="p">]</span> </code></pre></div> <div class="doc doc-contents "> <p>Request a list of keys known to the SSH agent.</p> <p><span class="doc-section-title">Returns:</span></p> <table> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr class="doc-section-item"> <td> <code><a class="autorefs autorefs-external" title="collections.abc.Sequence" href="https://docs.python.org/3/library/collections.abc.html#collections.abc.Sequence">Sequence</a>[<a class="autorefs autorefs-internal" title="derivepassphrase._types.KeyCommentPair" href="../derivepassphrase._types/#derivepassphrase._types.KeyCommentPair">KeyCommentPair</a>]</code> </td> <td> <div class="doc-md-description"> <p>A read-only sequence of key/comment pairs.</p> </div> </td> </tr> </tbody> </table> <p><span class="doc-section-title">Raises:</span></p> <table> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr class="doc-section-item"> <td> <code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/exceptions.html#EOFError">EOFError</a></code> </td> <td> <div class="doc-md-description"> <p>The response from the SSH agent is truncated or missing.</p> </div> </td> </tr> <tr class="doc-section-item"> <td> <code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/exceptions.html#OSError">OSError</a></code> </td> <td> <div class="doc-md-description"> <p>There was a communication error with the SSH agent.</p> </div> </td> </tr> <tr class="doc-section-item"> <td> <code><a class="autorefs autorefs-internal" title="derivepassphrase.ssh_agent.TrailingDataError" href="#derivepassphrase.ssh_agent.TrailingDataError">TrailingDataError</a></code> </td> <td> <div class="doc-md-description"> <p>The response from the SSH agent is too long.</p> </div> </td> </tr> <tr class="doc-section-item"> <td> <code><a class="autorefs autorefs-internal" title="derivepassphrase.ssh_agent.SSHAgentFailedError" href="#derivepassphrase.ssh_agent.SSHAgentFailedError">SSHAgentFailedError</a></code> </td> <td> <div class="doc-md-description"> <p>The agent failed to complete the request.</p> </div> </td> </tr> </tbody> </table> </div> </div> <div class="doc doc-object doc-function"> <h4 id="derivepassphrase.ssh_agent.SSHAgentClient.sign" class="doc doc-heading"> <code class="doc-symbol doc-symbol-heading doc-symbol-method"></code> <span class="doc doc-object-name doc-function-name">sign</span> <a href="#derivepassphrase.ssh_agent.SSHAgentClient.sign" class="headerlink" title="Permanent link">¶</a></h4> <div class="doc-signature highlight"><pre><span></span><code><span class="nf">sign</span><span class="p">(</span> <span class="n">key</span><span class="p">:</span> <span class="n"><a class="autorefs autorefs-external" title="typing_extensions.Buffer" href="https://typing-extensions.readthedocs.io/en/latest/index.html#typing_extensions.Buffer">Buffer</a></span><span class="p">,</span> <span class="n">payload</span><span class="p">:</span> <span class="n"><a class="autorefs autorefs-external" title="typing_extensions.Buffer" href="https://typing-extensions.readthedocs.io/en/latest/index.html#typing_extensions.Buffer">Buffer</a></span><span class="p">,</span> <span class="o">*</span><span class="p">,</span> <span class="n">flags</span><span class="p">:</span> <span class="n"><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/functions.html#int">int</a></span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span> <span class="n">check_if_key_loaded</span><span class="p">:</span> <span class="n"><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/functions.html#bool">bool</a></span> <span class="o">=</span> <span class="kc">False</span> <span class="p">)</span> <span class="o">-></span> <span class="n"><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#bytes">bytes</a></span> </code></pre></div> <div class="doc doc-contents "> <p>Request the SSH agent sign the payload with the key.</p> <p><span class="doc-section-title">Parameters:</span></p> <table> <thead> <tr> <th>Name</th> <th>Type</th> <th>Description</th> <th>Default</th> </tr> </thead> <tbody> <tr class="doc-section-item"> <td> <code>key</code> </td> <td> <code><a class="autorefs autorefs-external" title="typing_extensions.Buffer" href="https://typing-extensions.readthedocs.io/en/latest/index.html#typing_extensions.Buffer">Buffer</a></code> </td> <td> <div class="doc-md-description"> <p>The public SSH key to sign the payload with, in the same format as returned by, e.g., the <a class="autorefs autorefs-internal" href="#derivepassphrase.ssh_agent.SSHAgentClient.list_keys"><code>list_keys</code></a> method. The corresponding private key must have previously been loaded into the agent to successfully issue a signature.</p> </div> </td> <td> <em>required</em> </td> </tr> <tr class="doc-section-item"> <td> <code>payload</code> </td> <td> <code><a class="autorefs autorefs-external" title="typing_extensions.Buffer" href="https://typing-extensions.readthedocs.io/en/latest/index.html#typing_extensions.Buffer">Buffer</a></code> </td> <td> <div class="doc-md-description"> <p>A byte string of data to sign.</p> </div> </td> <td> <em>required</em> </td> </tr> <tr class="doc-section-item"> <td> <code>flags</code> </td> <td> <code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/functions.html#int">int</a></code> </td> <td> <div class="doc-md-description"> <p>Optional flags for the signing request. Currently passed on as-is to the agent. In real-world usage, this could be used, e.g., to request more modern hash algorithms when signing with RSA keys. (No such real-world usage is currently implemented.)</p> </div> </td> <td> <code>0</code> </td> </tr> <tr class="doc-section-item"> <td> <code>check_if_key_loaded</code> </td> <td> <code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/functions.html#bool">bool</a></code> </td> <td> <div class="doc-md-description"> <p>If true, check beforehand (via <a class="autorefs autorefs-internal" href="#derivepassphrase.ssh_agent.SSHAgentClient.list_keys"><code>list_keys</code></a>) if the corresponding key has been loaded into the agent.</p> </div> </td> <td> <code>False</code> </td> </tr> </tbody> </table> <p><span class="doc-section-title">Returns:</span></p> <table> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr class="doc-section-item"> <td> <code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#bytes">bytes</a></code> </td> <td> <div class="doc-md-description"> <p>The binary signature of the payload under the given key.</p> </div> </td> </tr> </tbody> </table> <p><span class="doc-section-title">Raises:</span></p> <table> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr class="doc-section-item"> <td> <code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/exceptions.html#EOFError">EOFError</a></code> </td> <td> <div class="doc-md-description"> <p>The response from the SSH agent is truncated or missing.</p> </div> </td> </tr> <tr class="doc-section-item"> <td> <code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/exceptions.html#OSError">OSError</a></code> </td> <td> <div class="doc-md-description"> <p>There was a communication error with the SSH agent.</p> </div> </td> </tr> <tr class="doc-section-item"> <td> <code><a class="autorefs autorefs-internal" title="derivepassphrase.ssh_agent.TrailingDataError" href="#derivepassphrase.ssh_agent.TrailingDataError">TrailingDataError</a></code> </td> <td> <div class="doc-md-description"> <p>The response from the SSH agent is too long.</p> </div> </td> </tr> <tr class="doc-section-item"> <td> <code><a class="autorefs autorefs-internal" title="derivepassphrase.ssh_agent.SSHAgentFailedError" href="#derivepassphrase.ssh_agent.SSHAgentFailedError">SSHAgentFailedError</a></code> </td> <td> <div class="doc-md-description"> <p>The agent failed to complete the request.</p> </div> </td> </tr> <tr class="doc-section-item"> <td> <code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/exceptions.html#KeyError">KeyError</a></code> </td> <td> <div class="doc-md-description"> <p><code>check_if_key_loaded</code> is true, and the <code>key</code> was not loaded into the agent.</p> </div> </td> </tr> </tbody> </table> </div> </div> </div> </div> </div> </div> </div> </div> </article> </div> </div> </main> <footer class="md-footer"> <nav class="md-footer__inner md-grid" aria-label="Footer" > <a href="../derivepassphrase.sequin/" class="md-footer__link md-footer__link--prev" aria-label="Previous: Submodule sequin"> <div class="md-footer__button md-icon"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11z"/></svg> </div> <div class="md-footer__title"> <span class="md-footer__direction"> Previous </span> <div class="md-ellipsis"> Submodule sequin </div> </div> </a> <a href="../derivepassphrase._types/" class="md-footer__link md-footer__link--next" aria-label="Next: Submodule _types"> <div class="md-footer__title"> <span class="md-footer__direction"> Next </span> <div class="md-ellipsis"> Submodule _types </div> </div> <div class="md-footer__button md-icon"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 11v2h12l-5.5 5.5 1.42 1.42L19.84 12l-7.92-7.92L10.5 5.5 16 11z"/></svg> </div> </a> </nav> <div class="md-footer-meta md-typeset"> <div class="md-footer-meta__inner md-grid"> <div class="md-copyright"> <div class="md-copyright__highlight"> Copyright © 2024 Marco Ricci (the-13th-letter) </div> Made with <a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener"> Material for MkDocs </a> and <a href="https://mkdocstrings.github.io/python/" target="_blank" rel="noopener"> mkdocstrings-python </a> </div> </div> </div> </footer> </div> <div class="md-dialog" data-md-component="dialog"> <div class="md-dialog__inner md-typeset"></div> </div> </body> </html>