git.schokokeks.org
Repositories
Help
Report an Issue
derivepassphrase.git
Code
Commits
Branches
Tags
Suche
Strukturansicht:
5e5cfc6
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
derivepassphrase.git
0.x
reference
derivepassphrase
index.html
Deployed df4e33299f05 to 0.x with MkDocs 1.6.0 and mike 2.1.2
Marco Ricci
commited
5e5cfc6
at 2024-07-28 19:37:17
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/"> <link rel="prev" href="../derivepassphrase.1/"> <link rel="next" href="../sequin/"> <link rel="icon" href="../../assets/images/favicon.png"> <meta name="generator" content="mkdocs-1.6.0, mkdocs-material-9.5.30"> <title>Module derivepassphrase - derivepassphrase</title> <link rel="stylesheet" href="../../assets/stylesheets/main.3cba04c6.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" class="md-skip"> Skip to content </a> </div> <div data-md-component="announce"> </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 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.54Z"/></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.81z"/></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--active md-nav__item--section md-nav__item--nested"> <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_2" checked> <label class="md-nav__link" for="__nav_2" id="__nav_2_label" tabindex=""> <span class="md-ellipsis"> Reference </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="true"> <label class="md-nav__title" for="__nav_2"> <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="../" class="md-nav__link"> <span class="md-ellipsis"> Reference overview </span> </a> </li> <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 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"> Module derivepassphrase </span> <span class="md-nav__icon md-icon"></span> </label> <a href="./" class="md-nav__link md-nav__link--active"> <span class="md-ellipsis"> Module derivepassphrase </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" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-module"></code> derivepassphrase </span> </a> <nav class="md-nav" aria-label=" derivepassphrase"> <ul class="md-nav__list"> <li class="md-nav__item"> <a href="#derivepassphrase.AmbiguousByteRepresentationError" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-class"></code> AmbiguousByteRepresentationError </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.Vault" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-class"></code> Vault </span> </a> <nav class="md-nav" aria-label=" Vault"> <ul class="md-nav__list"> <li class="md-nav__item"> <a href="#derivepassphrase.Vault.create_hash" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-method"></code> create_hash </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.Vault.generate" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-method"></code> generate </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.Vault.phrase_from_key" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-method"></code> phrase_from_key </span> </a> </li> </ul> </nav> </li> <li class="md-nav__item"> <a href="#derivepassphrase.__main__" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-module"></code> __main__ </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.cli" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-module"></code> cli </span> </a> <nav class="md-nav" aria-label=" cli"> <ul class="md-nav__list"> <li class="md-nav__item"> <a href="#derivepassphrase.cli.OptionGroupOption" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-class"></code> OptionGroupOption </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.cli.CommandWithHelpGroups" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-class"></code> CommandWithHelpGroups </span> </a> <nav class="md-nav" aria-label=" CommandWithHelpGroups"> <ul class="md-nav__list"> <li class="md-nav__item"> <a href="#derivepassphrase.cli.CommandWithHelpGroups.format_options" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-method"></code> format_options </span> </a> </li> </ul> </nav> </li> <li class="md-nav__item"> <a href="#derivepassphrase.cli.PasswordGenerationOption" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-class"></code> PasswordGenerationOption </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.cli.ConfigurationOption" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-class"></code> ConfigurationOption </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.cli.StorageManagementOption" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-class"></code> StorageManagementOption </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.cli.derivepassphrase" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-function"></code> derivepassphrase </span> </a> </li> </ul> </nav> </li> <li class="md-nav__item"> <a href="#derivepassphrase.types" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-module"></code> types </span> </a> <nav class="md-nav" aria-label=" types"> <ul class="md-nav__list"> <li class="md-nav__item"> <a href="#derivepassphrase.types.VaultConfigGlobalSettings" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-class"></code> VaultConfigGlobalSettings </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.types.VaultConfigServicesSettings" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-class"></code> VaultConfigServicesSettings </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.types.VaultConfig" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-class"></code> VaultConfig </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.types.is_vault_config" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-function"></code> is_vault_config </span> </a> </li> </ul> </nav> </li> </ul> </nav> </li> </ul> </nav> </li> <li class="md-nav__item"> <a href="../sequin/" class="md-nav__link"> <span class="md-ellipsis"> Module sequin </span> </a> </li> <li class="md-nav__item"> <a href="../ssh_agent_client/" class="md-nav__link"> <span class="md-ellipsis"> Module ssh_agent_client </span> </a> </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" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-module"></code> derivepassphrase </span> </a> <nav class="md-nav" aria-label=" derivepassphrase"> <ul class="md-nav__list"> <li class="md-nav__item"> <a href="#derivepassphrase.AmbiguousByteRepresentationError" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-class"></code> AmbiguousByteRepresentationError </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.Vault" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-class"></code> Vault </span> </a> <nav class="md-nav" aria-label=" Vault"> <ul class="md-nav__list"> <li class="md-nav__item"> <a href="#derivepassphrase.Vault.create_hash" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-method"></code> create_hash </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.Vault.generate" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-method"></code> generate </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.Vault.phrase_from_key" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-method"></code> phrase_from_key </span> </a> </li> </ul> </nav> </li> <li class="md-nav__item"> <a href="#derivepassphrase.__main__" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-module"></code> __main__ </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.cli" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-module"></code> cli </span> </a> <nav class="md-nav" aria-label=" cli"> <ul class="md-nav__list"> <li class="md-nav__item"> <a href="#derivepassphrase.cli.OptionGroupOption" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-class"></code> OptionGroupOption </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.cli.CommandWithHelpGroups" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-class"></code> CommandWithHelpGroups </span> </a> <nav class="md-nav" aria-label=" CommandWithHelpGroups"> <ul class="md-nav__list"> <li class="md-nav__item"> <a href="#derivepassphrase.cli.CommandWithHelpGroups.format_options" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-method"></code> format_options </span> </a> </li> </ul> </nav> </li> <li class="md-nav__item"> <a href="#derivepassphrase.cli.PasswordGenerationOption" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-class"></code> PasswordGenerationOption </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.cli.ConfigurationOption" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-class"></code> ConfigurationOption </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.cli.StorageManagementOption" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-class"></code> StorageManagementOption </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.cli.derivepassphrase" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-function"></code> derivepassphrase </span> </a> </li> </ul> </nav> </li> <li class="md-nav__item"> <a href="#derivepassphrase.types" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-module"></code> types </span> </a> <nav class="md-nav" aria-label=" types"> <ul class="md-nav__list"> <li class="md-nav__item"> <a href="#derivepassphrase.types.VaultConfigGlobalSettings" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-class"></code> VaultConfigGlobalSettings </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.types.VaultConfigServicesSettings" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-class"></code> VaultConfigServicesSettings </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.types.VaultConfig" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-class"></code> VaultConfig </span> </a> </li> <li class="md-nav__item"> <a href="#derivepassphrase.types.is_vault_config" class="md-nav__link"> <span class="md-ellipsis"> <code class="doc-symbol doc-symbol-toc doc-symbol-function"></code> is_vault_config </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.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.15 8.15 0 0 1-1.23-2Z"/></svg> </a> <h1>Module derivepassphrase</h1> <div class="doc doc-object doc-module"> <h2 id="derivepassphrase" 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</span> <a href="#derivepassphrase" class="headerlink" title="Permanent link">¶</a></h2> <div class="doc doc-contents first"> <p>Work-alike of vault(1) – a deterministic, stateless password manager</p> <div class="doc doc-children"> <div class="doc doc-object doc-class"> <h3 id="derivepassphrase.AmbiguousByteRepresentationError" class="doc doc-heading"> <code class="doc-symbol doc-symbol-heading doc-symbol-class"></code> <span class="doc doc-object-name doc-class-name">AmbiguousByteRepresentationError</span> <a href="#derivepassphrase.AmbiguousByteRepresentationError" class="headerlink" title="Permanent link">¶</a></h3> <div class="doc-signature highlight"><pre><span></span><code><span class="nf">AmbiguousByteRepresentationError</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#ValueError">ValueError</a></code></p> <p>The object has an ambiguous byte representation.</p> <div class="doc doc-children"> </div> </div> </div> <div class="doc doc-object doc-class"> <h3 id="derivepassphrase.Vault" class="doc doc-heading"> <code class="doc-symbol doc-symbol-heading doc-symbol-class"></code> <span class="doc doc-object-name doc-class-name">Vault</span> <a href="#derivepassphrase.Vault" class="headerlink" title="Permanent link">¶</a></h3> <div class="doc-signature highlight"><pre><span></span><code><span class="nf">Vault</span><span class="p">(</span> <span class="o">*</span><span class="p">,</span> <span class="n">phrase</span><span class="p">:</span> <span class="nb">bytes</span> <span class="o">|</span> <span class="nb">bytearray</span> <span class="o">|</span> <span class="nb">str</span> <span class="o">=</span> <span class="sa">b</span><span class="s2">""</span><span class="p">,</span> <span class="n">length</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">20</span><span class="p">,</span> <span class="n">repeat</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span> <span class="n">lower</span><span class="p">:</span> <span class="nb">int</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">upper</span><span class="p">:</span> <span class="nb">int</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">number</span><span class="p">:</span> <span class="nb">int</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">space</span><span class="p">:</span> <span class="nb">int</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">dash</span><span class="p">:</span> <span class="nb">int</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">symbol</span><span class="p">:</span> <span class="nb">int</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span> <span class="p">)</span> </code></pre></div> <div class="doc doc-contents "> <p>A work-alike of James Coglan’s vault.</p> <p>Store settings for generating (actually: deriving) passphrases for named services, with various constraints, given only a master passphrase. Also, actually generate the passphrase. The derivation is deterministic and non-secret; only the master passphrase need be kept secret. The implementation is compatible with <a href="https://getvau.lt">vault</a>.</p> <p><a href="https://blog.jcoglan.com/2012/07/16/designing-vaults-generator-algorithm/">James Coglan explains the passphrase derivation algorithm in great detail</a> in his blog post on said topic: A principally infinite bit stream is obtained by running a key-derivation function on the master passphrase and the service name, then this bit stream is fed into a <a class="autorefs autorefs-internal" href="../sequin/#sequin.Sequin">Sequin</a> to generate random numbers in the correct range, and finally these random numbers select passphrase characters until the desired length is reached.</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>phrase</code></td> <td> <code><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#bytearray">bytearray</a> | <a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#str">str</a></code> </td> <td> <div class="doc-md-description"> <p>The master passphrase from which to derive the service passphrases. If a text string, then the byte representation must be unique.</p> </div> </td> <td> <code>b''</code> </td> </tr> <tr class="doc-section-item"> <td><code>length</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>Desired passphrase length.</p> </div> </td> <td> <code>20</code> </td> </tr> <tr class="doc-section-item"> <td><code>repeat</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>The maximum number of immediate character repetitions allowed in the passphrase. Disabled if set to 0.</p> </div> </td> <td> <code>0</code> </td> </tr> <tr class="doc-section-item"> <td><code>lower</code></td> <td> <code><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>Optional constraint on ASCII lowercase characters. If positive, include this many lowercase characters somewhere in the passphrase. If 0, avoid lowercase characters altogether.</p> </div> </td> <td> <code>None</code> </td> </tr> <tr class="doc-section-item"> <td><code>upper</code></td> <td> <code><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>Same as <code>lower</code>, but for ASCII uppercase characters.</p> </div> </td> <td> <code>None</code> </td> </tr> <tr class="doc-section-item"> <td><code>number</code></td> <td> <code><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>Same as <code>lower</code>, but for ASCII digits.</p> </div> </td> <td> <code>None</code> </td> </tr> <tr class="doc-section-item"> <td><code>space</code></td> <td> <code><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>Same as <code>lower</code>, but for the space character.</p> </div> </td> <td> <code>None</code> </td> </tr> <tr class="doc-section-item"> <td><code>dash</code></td> <td> <code><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>Same as <code>lower</code>, but for the hyphen-minus and underscore characters.</p> </div> </td> <td> <code>None</code> </td> </tr> <tr class="doc-section-item"> <td><code>symbol</code></td> <td> <code><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>Same as <code>lower</code>, but for all other hitherto unlisted ASCII printable characters (except backquote).</p> </div> </td> <td> <code>None</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-internal" title="derivepassphrase.AmbiguousByteRepresentationError" href="#derivepassphrase.AmbiguousByteRepresentationError">AmbiguousByteRepresentationError</a></code> </td> <td> <div class="doc-md-description"> <p>The phrase is a text string with differing NFC- and NFD-normalized UTF-8 byte representations.</p> </div> </td> </tr> </tbody> </table> <div class="doc doc-children"> <div class="doc doc-object doc-function"> <h4 id="derivepassphrase.Vault.create_hash" class="doc doc-heading"> <code class="doc-symbol doc-symbol-heading doc-symbol-method"></code> <span class="doc doc-object-name doc-function-name">create_hash</span> <span class="doc doc-labels"> <small class="doc doc-label doc-label-classmethod"><code>classmethod</code></small> </span> <a href="#derivepassphrase.Vault.create_hash" class="headerlink" title="Permanent link">¶</a></h4> <div class="doc-signature highlight"><pre><span></span><code><span class="nf">create_hash</span><span class="p">(</span> <span class="n">phrase</span><span class="p">:</span> <span class="nb">bytes</span> <span class="o">|</span> <span class="nb">bytearray</span> <span class="o">|</span> <span class="nb">str</span><span class="p">,</span> <span class="n">service</span><span class="p">:</span> <span class="nb">bytes</span> <span class="o">|</span> <span class="nb">bytearray</span><span class="p">,</span> <span class="o">*</span><span class="p">,</span> <span class="n">length</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">32</span> <span class="p">)</span> <span class="o">-></span> <span class="nb">bytes</span> </code></pre></div> <div class="doc doc-contents "> <p>Create a pseudorandom byte stream from phrase and service.</p> <p>Create a pseudorandom byte stream from <code>phrase</code> and <code>service</code> by feeding them into the key-derivation function PBKDF2 (8 iterations, using SHA-1).</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>phrase</code></td> <td> <code><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#bytearray">bytearray</a> | <a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#str">str</a></code> </td> <td> <div class="doc-md-description"> <p>A master passphrase, or sometimes an SSH signature. Used as the key for PBKDF2, the underlying cryptographic primitive.</p> <p>If a text string, then the byte representation must be unique.</p> </div> </td> <td> <em>required</em> </td> </tr> <tr class="doc-section-item"> <td><code>service</code></td> <td> <code><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#bytearray">bytearray</a></code> </td> <td> <div class="doc-md-description"> <p>A vault service name. Will be suffixed with <code>Vault._UUID</code>, and then used as the salt value for PBKDF2.</p> </div> </td> <td> <em>required</em> </td> </tr> <tr class="doc-section-item"> <td><code>length</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>The length of the byte stream to generate.</p> </div> </td> <td> <code>32</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>A pseudorandom byte string of length <code>length</code>.</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-internal" title="derivepassphrase.AmbiguousByteRepresentationError" href="#derivepassphrase.AmbiguousByteRepresentationError">AmbiguousByteRepresentationError</a></code> </td> <td> <div class="doc-md-description"> <p>The phrase is a text string with differing NFC- and NFD-normalized UTF-8 byte representations.</p> </div> </td> </tr> </tbody> </table> <details class="note" open> <summary>Note</summary> <p>Shorter values returned from this method (with the same key and message) are prefixes of longer values returned from this method. (This property is inherited from the underlying PBKDF2 function.) It is thus safe (if slow) to call this method with the same input with ever-increasing target lengths.</p> </details> <p><span class="doc-section-title">Examples:</span></p> <div class="highlight"><pre><span></span><code><span class="gp">>>> </span><span class="c1"># See also Vault.phrase_from_key examples.</span> <span class="gp">>>> </span><span class="n">phrase</span> <span class="o">=</span> <span class="nb">bytes</span><span class="o">.</span><span class="n">fromhex</span><span class="p">(</span><span class="s1">'''</span> <span class="gp">... </span><span class="s1">00 00 00 0b 73 73 68 2d 65 64 32 35 35 31 39</span> <span class="gp">... </span><span class="s1">00 00 00 40</span> <span class="gp">... </span><span class="s1">f0 98 19 80 6c 1a 97 d5 26 03 6e cc e3 65 8f 86</span> <span class="gp">... </span><span class="s1">66 07 13 19 13 09 21 33 33 f9 e4 36 53 1d af fd</span> <span class="gp">... </span><span class="s1">0d 08 1f ec f8 73 9b 8c 5f 55 39 16 7c 53 54 2c</span> <span class="gp">... </span><span class="s1">1e 52 bb 30 ed 7f 89 e2 2f 69 51 55 d8 9e a6 02</span> <span class="gp">... </span><span class="s1">'''</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">Vault</span><span class="o">.</span><span class="n">create_hash</span><span class="p">(</span><span class="n">phrase</span><span class="p">,</span> <span class="sa">b</span><span class="s1">'some_service'</span><span class="p">,</span> <span class="n">length</span><span class="o">=</span><span class="mi">4</span><span class="p">)</span> <span class="go">b'M\xb1<S'</span> <span class="gp">>>> </span><span class="n">Vault</span><span class="o">.</span><span class="n">create_hash</span><span class="p">(</span><span class="n">phrase</span><span class="p">,</span> <span class="sa">b</span><span class="s1">'some_service'</span><span class="p">,</span> <span class="n">length</span><span class="o">=</span><span class="mi">16</span><span class="p">)</span> <span class="go">b'M\xb1<S\x827E\xd1M\xaf\xf8~\xc8n\x10\xcc'</span> <span class="gp">>>> </span><span class="n">Vault</span><span class="o">.</span><span class="n">create_hash</span><span class="p">(</span><span class="n">phrase</span><span class="p">,</span> <span class="sa">b</span><span class="s1">'NOSUCHSERVICE'</span><span class="p">,</span> <span class="n">length</span><span class="o">=</span><span class="mi">16</span><span class="p">)</span> <span class="go">b'\x1c\xc3\x9c\xd9\xb6\x1a\x99CS\x07\xc41\xf4\x85#s'</span> </code></pre></div> </div> </div> <div class="doc doc-object doc-function"> <h4 id="derivepassphrase.Vault.generate" class="doc doc-heading"> <code class="doc-symbol doc-symbol-heading doc-symbol-method"></code> <span class="doc doc-object-name doc-function-name">generate</span> <a href="#derivepassphrase.Vault.generate" class="headerlink" title="Permanent link">¶</a></h4> <div class="doc-signature highlight"><pre><span></span><code><span class="nf">generate</span><span class="p">(</span> <span class="n">service_name</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="nb">bytes</span> <span class="o">|</span> <span class="nb">bytearray</span><span class="p">,</span> <span class="o">/</span><span class="p">,</span> <span class="o">*</span><span class="p">,</span> <span class="n">phrase</span><span class="p">:</span> <span class="nb">bytes</span> <span class="o">|</span> <span class="nb">bytearray</span> <span class="o">|</span> <span class="nb">str</span> <span class="o">=</span> <span class="sa">b</span><span class="s2">""</span><span class="p">,</span> <span class="p">)</span> <span class="o">-></span> <span class="nb">bytes</span> </code></pre></div> <div class="doc doc-contents "> <p>Generate a service passphrase.</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>service_name</code></td> <td> <code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#str">str</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#bytearray">bytearray</a></code> </td> <td> <div class="doc-md-description"> <p>The service name.</p> </div> </td> <td> <em>required</em> </td> </tr> <tr class="doc-section-item"> <td><code>phrase</code></td> <td> <code><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#bytearray">bytearray</a> | <a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#str">str</a></code> </td> <td> <div class="doc-md-description"> <p>If given, override the passphrase given during construction.</p> <p>If a text string, then the byte representation must be unique.</p> </div> </td> <td> <code>b''</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 service passphrase.</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-internal" title="derivepassphrase.AmbiguousByteRepresentationError" href="#derivepassphrase.AmbiguousByteRepresentationError">AmbiguousByteRepresentationError</a></code> </td> <td> <div class="doc-md-description"> <p>The phrase is a text string with differing NFC- and NFD-normalized UTF-8 byte representations.</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">phrase</span> <span class="o">=</span> <span class="sa">b</span><span class="s1">'She cells C shells bye the sea shoars'</span> <span class="gp">>>> </span><span class="c1"># Using default options in constructor.</span> <span class="gp">>>> </span><span class="n">Vault</span><span class="p">(</span><span class="n">phrase</span><span class="o">=</span><span class="n">phrase</span><span class="p">)</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="sa">b</span><span class="s1">'google'</span><span class="p">)</span> <span class="go">b': 4TVH#5:aZl8LueOT\\{'</span> <span class="gp">>>> </span><span class="c1"># Also possible:</span> <span class="gp">>>> </span><span class="n">Vault</span><span class="p">()</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="sa">b</span><span class="s1">'google'</span><span class="p">,</span> <span class="n">phrase</span><span class="o">=</span><span class="n">phrase</span><span class="p">)</span> <span class="go">b': 4TVH#5:aZl8LueOT\\{'</span> </code></pre></div> </div> </div> <div class="doc doc-object doc-function"> <h4 id="derivepassphrase.Vault.phrase_from_key" class="doc doc-heading"> <code class="doc-symbol doc-symbol-heading doc-symbol-method"></code> <span class="doc doc-object-name doc-function-name">phrase_from_key</span> <span class="doc doc-labels"> <small class="doc doc-label doc-label-classmethod"><code>classmethod</code></small> </span> <a href="#derivepassphrase.Vault.phrase_from_key" class="headerlink" title="Permanent link">¶</a></h4> <div class="doc-signature highlight"><pre><span></span><code><span class="nf">phrase_from_key</span><span class="p">(</span><span class="n">key</span><span class="p">:</span> <span class="nb">bytes</span> <span class="o">|</span> <span class="nb">bytearray</span><span class="p">)</span> <span class="o">-></span> <span class="nb">bytes</span> </code></pre></div> <div class="doc doc-contents "> <p>Obtain the master passphrase from a configured SSH key.</p> <p>vault allows the usage of certain SSH keys to derive a master passphrase, by signing the vault UUID with the SSH key. The key type must ensure that signatures are deterministic.</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" 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#bytearray">bytearray</a></code> </td> <td> <div class="doc-md-description"> <p>The (public) SSH key to use for signing.</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 signature of the vault UUID under this key, unframed but encoded in base64.</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 SSH key is principally unsuitable for this use case. Usually this means that the signature is not deterministic.</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="kn">import</span> <span class="nn">base64</span> <span class="gp">>>> </span><span class="c1"># Actual Ed25519 test public key.</span> <span class="gp">>>> </span><span class="n">public_key</span> <span class="o">=</span> <span class="nb">bytes</span><span class="o">.</span><span class="n">fromhex</span><span class="p">(</span><span class="s1">'''</span> <span class="gp">... </span><span class="s1">00 00 00 0b 73 73 68 2d 65 64 32 35 35 31 39</span> <span class="gp">... </span><span class="s1">00 00 00 20</span> <span class="gp">... </span><span class="s1">81 78 81 68 26 d6 02 48 5f 0f ff 32 48 6f e4 c1</span> <span class="gp">... </span><span class="s1">30 89 dc 1c 6a 45 06 09 e9 09 0f fb c2 12 69 76</span> <span class="gp">... </span><span class="s1">'''</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">expected_sig_raw</span> <span class="o">=</span> <span class="nb">bytes</span><span class="o">.</span><span class="n">fromhex</span><span class="p">(</span><span class="s1">'''</span> <span class="gp">... </span><span class="s1">00 00 00 0b 73 73 68 2d 65 64 32 35 35 31 39</span> <span class="gp">... </span><span class="s1">00 00 00 40</span> <span class="gp">... </span><span class="s1">f0 98 19 80 6c 1a 97 d5 26 03 6e cc e3 65 8f 86</span> <span class="gp">... </span><span class="s1">66 07 13 19 13 09 21 33 33 f9 e4 36 53 1d af fd</span> <span class="gp">... </span><span class="s1">0d 08 1f ec f8 73 9b 8c 5f 55 39 16 7c 53 54 2c</span> <span class="gp">... </span><span class="s1">1e 52 bb 30 ed 7f 89 e2 2f 69 51 55 d8 9e a6 02</span> <span class="gp">... </span><span class="s1">'''</span><span class="p">)</span> <span class="gp">>>> </span><span class="c1"># Raw Ed25519 signatures are 64 bytes long.</span> <span class="gp">>>> </span><span class="n">signature_blob</span> <span class="o">=</span> <span class="n">expected_sig_raw</span><span class="p">[</span><span class="o">-</span><span class="mi">64</span><span class="p">:]</span> <span class="gp">>>> </span><span class="n">phrase</span> <span class="o">=</span> <span class="n">base64</span><span class="o">.</span><span class="n">standard_b64encode</span><span class="p">(</span><span class="n">signature_blob</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">Vault</span><span class="o">.</span><span class="n">phrase_from_key</span><span class="p">(</span><span class="n">phrase</span><span class="p">)</span> <span class="o">==</span> <span class="n">expected</span> <span class="go">True</span> </code></pre></div> </div> </div> </div> </div> </div> <div class="doc doc-object doc-module"> <h3 id="derivepassphrase.__main__" class="doc doc-heading"> <code class="doc-symbol doc-symbol-heading doc-symbol-module"></code> <span class="doc doc-object-name doc-module-name">__main__</span> <a href="#derivepassphrase.__main__" class="headerlink" title="Permanent link">¶</a></h3> <div class="doc doc-contents "> <p>Run <a class="autorefs autorefs-internal" href="#derivepassphrase.cli.derivepassphrase"><code>derivepassphrase.cli.derivepassphrase</code></a> on import.</p> <div class="doc doc-children"> </div> </div> </div> <div class="doc doc-object doc-module"> <h3 id="derivepassphrase.cli" class="doc doc-heading"> <code class="doc-symbol doc-symbol-heading doc-symbol-module"></code> <span class="doc doc-object-name doc-module-name">cli</span> <a href="#derivepassphrase.cli" class="headerlink" title="Permanent link">¶</a></h3> <div class="doc doc-contents "> <p>Command-line interface for derivepassphrase.</p> <div class="doc doc-children"> <div class="doc doc-object doc-class"> <h4 id="derivepassphrase.cli.OptionGroupOption" class="doc doc-heading"> <code class="doc-symbol doc-symbol-heading doc-symbol-class"></code> <span class="doc doc-object-name doc-class-name">OptionGroupOption</span> <a href="#derivepassphrase.cli.OptionGroupOption" class="headerlink" title="Permanent link">¶</a></h4> <div class="doc-signature highlight"><pre><span></span><code><span class="nf">OptionGroupOption</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">:</span> <span class="n">Any</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">:</span> <span class="n">Any</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" title="click.Option" href="https://click.palletsprojects.com/en/8.1.x/api/#click.Option">Option</a></code></p> <p>A <a class="autorefs autorefs-external" href="https://click.palletsprojects.com/en/8.1.x/api/#click.Option"><code>click.Option</code></a> with an associated group name and group epilog.</p> <p>Used by <a class="autorefs autorefs-internal" href="#derivepassphrase.cli.CommandWithHelpGroups"><code>derivepassphrase.cli.CommandWithHelpGroups</code></a> to print help sections. Each subclass contains its own group name and epilog.</p> <p><span class="doc-section-title">Attributes:</span></p> <table> <thead> <tr> <th>Name</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr class="doc-section-item"> <td><code><span title="derivepassphrase.cli.OptionGroupOption.option_group_name">option_group_name</span></code></td> <td> <code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#str">str</a></code> </td> <td> <div class="doc-md-description"> <p>The name of the option group. Used as a heading on the help text for options in this section.</p> </div> </td> </tr> <tr class="doc-section-item"> <td><code><span title="derivepassphrase.cli.OptionGroupOption.epilog">epilog</span></code></td> <td> <code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#str">str</a></code> </td> <td> <div class="doc-md-description"> <p>An epilog to print after listing the options in this section.</p> </div> </td> </tr> </tbody> </table> <div class="doc doc-children"> </div> </div> </div> <div class="doc doc-object doc-class"> <h4 id="derivepassphrase.cli.CommandWithHelpGroups" class="doc doc-heading"> <code class="doc-symbol doc-symbol-heading doc-symbol-class"></code> <span class="doc doc-object-name doc-class-name">CommandWithHelpGroups</span> <a href="#derivepassphrase.cli.CommandWithHelpGroups" class="headerlink" title="Permanent link">¶</a></h4> <div class="doc doc-contents "> <p class="doc doc-class-bases"> Bases: <code><a class="autorefs autorefs-external" title="click.Command" href="https://click.palletsprojects.com/en/8.1.x/api/#click.Command">Command</a></code></p> <p>A <a class="autorefs autorefs-external" href="https://click.palletsprojects.com/en/8.1.x/api/#click.Command"><code>click.Command</code></a> with support for help/option groups.</p> <p>Inspired by <a href="https://github.com/pallets/click/issues/373#issuecomment-515293746">a comment on <code>pallets/click#373</code></a>, and further modified to support group epilogs.</p> <div class="doc doc-children"> <div class="doc doc-object doc-function"> <h5 id="derivepassphrase.cli.CommandWithHelpGroups.format_options" class="doc doc-heading"> <code class="doc-symbol doc-symbol-heading doc-symbol-method"></code> <span class="doc doc-object-name doc-function-name">format_options</span> <a href="#derivepassphrase.cli.CommandWithHelpGroups.format_options" class="headerlink" title="Permanent link">¶</a></h5> <div class="doc-signature highlight"><pre><span></span><code><span class="nf">format_options</span><span class="p">(</span> <span class="n">ctx</span><span class="p">:</span> <span class="n">click</span><span class="o">.</span><span class="n">Context</span><span class="p">,</span> <span class="n">formatter</span><span class="p">:</span> <span class="n">click</span><span class="o">.</span><span class="n">HelpFormatter</span> <span class="p">)</span> <span class="o">-></span> <span class="kc">None</span> </code></pre></div> <div class="doc doc-contents "> <p>Format options on the help listing, grouped into sections.</p> <p>This is a callback for <a class="autorefs autorefs-external" href="https://click.palletsprojects.com/en/8.1.x/api/#click.Command.get_help"><code>click.Command.get_help</code></a> that implements the <code>--help</code> listing, by calling appropriate methods of the <code>formatter</code>. We list all options (like the base implementation), but grouped into sections according to the concrete <a class="autorefs autorefs-external" href="https://click.palletsprojects.com/en/8.1.x/api/#click.Option"><code>click.Option</code></a> subclass being used. If the option is an instance of some subclass <code>X</code> of <a class="autorefs autorefs-internal" href="#derivepassphrase.cli.OptionGroupOption"><code>derivepassphrase.cli.OptionGroupOption</code></a>, then the section heading and the epilog are taken from <code>X.option_group_name</code> and <code>X.epilog</code>; otherwise, the section heading is “Options” (or “Other options” if there are other option groups) and the epilog is empty.</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>ctx</code></td> <td> <code><a class="autorefs autorefs-external" title="click.Context" href="https://click.palletsprojects.com/en/8.1.x/api/#click.Context">Context</a></code> </td> <td> <div class="doc-md-description"> <p>The click context.</p> </div> </td> <td> <em>required</em> </td> </tr> <tr class="doc-section-item"> <td><code>formatter</code></td> <td> <code><a class="autorefs autorefs-external" title="click.HelpFormatter" href="https://click.palletsprojects.com/en/8.1.x/api/#click.HelpFormatter">HelpFormatter</a></code> </td> <td> <div class="doc-md-description"> <p>The formatter for the <code>--help</code> listing.</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>None</code> </td> <td> <div class="doc-md-description"> <p>Nothing. Output is generated by calling appropriate methods on <code>formatter</code> instead.</p> </div> </td> </tr> </tbody> </table> </div> </div> </div> </div> </div> <div class="doc doc-object doc-class"> <h4 id="derivepassphrase.cli.PasswordGenerationOption" class="doc doc-heading"> <code class="doc-symbol doc-symbol-heading doc-symbol-class"></code> <span class="doc doc-object-name doc-class-name">PasswordGenerationOption</span> <a href="#derivepassphrase.cli.PasswordGenerationOption" class="headerlink" title="Permanent link">¶</a></h4> <div class="doc-signature highlight"><pre><span></span><code><span class="nf">PasswordGenerationOption</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">:</span> <span class="n">Any</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">:</span> <span class="n">Any</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-internal" title="derivepassphrase.cli.OptionGroupOption" href="#derivepassphrase.cli.OptionGroupOption">OptionGroupOption</a></code></p> <p>Password generation options for the CLI.</p> <div class="doc doc-children"> </div> </div> </div> <div class="doc doc-object doc-class"> <h4 id="derivepassphrase.cli.ConfigurationOption" class="doc doc-heading"> <code class="doc-symbol doc-symbol-heading doc-symbol-class"></code> <span class="doc doc-object-name doc-class-name">ConfigurationOption</span> <a href="#derivepassphrase.cli.ConfigurationOption" class="headerlink" title="Permanent link">¶</a></h4> <div class="doc-signature highlight"><pre><span></span><code><span class="nf">ConfigurationOption</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">:</span> <span class="n">Any</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">:</span> <span class="n">Any</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-internal" title="derivepassphrase.cli.OptionGroupOption" href="#derivepassphrase.cli.OptionGroupOption">OptionGroupOption</a></code></p> <p>Configuration options for the CLI.</p> <div class="doc doc-children"> </div> </div> </div> <div class="doc doc-object doc-class"> <h4 id="derivepassphrase.cli.StorageManagementOption" class="doc doc-heading"> <code class="doc-symbol doc-symbol-heading doc-symbol-class"></code> <span class="doc doc-object-name doc-class-name">StorageManagementOption</span> <a href="#derivepassphrase.cli.StorageManagementOption" class="headerlink" title="Permanent link">¶</a></h4> <div class="doc-signature highlight"><pre><span></span><code><span class="nf">StorageManagementOption</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">:</span> <span class="n">Any</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">:</span> <span class="n">Any</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-internal" title="derivepassphrase.cli.OptionGroupOption" href="#derivepassphrase.cli.OptionGroupOption">OptionGroupOption</a></code></p> <p>Storage management options for the CLI.</p> <div class="doc doc-children"> </div> </div> </div> <div class="doc doc-object doc-function"> <h4 id="derivepassphrase.cli.derivepassphrase" class="doc doc-heading"> <code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">derivepassphrase</span> <a href="#derivepassphrase.cli.derivepassphrase" class="headerlink" title="Permanent link">¶</a></h4> <div class="doc-signature highlight"><pre><span></span><code><span class="nf">derivepassphrase</span><span class="p">(</span> <span class="n">ctx</span><span class="p">:</span> <span class="n">click</span><span class="o">.</span><span class="n">Context</span><span class="p">,</span> <span class="o">/</span><span class="p">,</span> <span class="o">*</span><span class="p">,</span> <span class="n">service</span><span class="p">:</span> <span class="nb">str</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">use_phrase</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> <span class="n">use_key</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> <span class="n">length</span><span class="p">:</span> <span class="nb">int</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">repeat</span><span class="p">:</span> <span class="nb">int</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">lower</span><span class="p">:</span> <span class="nb">int</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">upper</span><span class="p">:</span> <span class="nb">int</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">number</span><span class="p">:</span> <span class="nb">int</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">space</span><span class="p">:</span> <span class="nb">int</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">dash</span><span class="p">:</span> <span class="nb">int</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">symbol</span><span class="p">:</span> <span class="nb">int</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">edit_notes</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> <span class="n">store_config_only</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> <span class="n">delete_service_settings</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> <span class="n">delete_globals</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> <span class="n">clear_all_settings</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> <span class="n">export_settings</span><span class="p">:</span> <span class="p">(</span> <span class="n">TextIO</span> <span class="o">|</span> <span class="n">pathlib</span><span class="o">.</span><span class="n">Path</span> <span class="o">|</span> <span class="n">os</span><span class="o">.</span><span class="n">PathLike</span><span class="p">[</span><span class="nb">str</span><span class="p">]</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="n">import_settings</span><span class="p">:</span> <span class="p">(</span> <span class="n">TextIO</span> <span class="o">|</span> <span class="n">pathlib</span><span class="o">.</span><span class="n">Path</span> <span class="o">|</span> <span class="n">os</span><span class="o">.</span><span class="n">PathLike</span><span class="p">[</span><span class="nb">str</span><span class="p">]</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="kc">None</span> </code></pre></div> <div class="doc doc-contents "> <p>Derive a strong passphrase, deterministically, from a master secret.</p> <p>Using a master passphrase or a master SSH key, derive a passphrase for SERVICE, subject to length, character and character repetition constraints. The derivation is cryptographically strong, meaning that even if a single passphrase is compromised, guessing the master passphrase or a different service’s passphrase is computationally infeasible. The derivation is also deterministic, given the same inputs, thus the resulting passphrase need not be stored explicitly. The service name and constraints themselves also need not be kept secret; the latter are usually stored in a world-readable file.</p> <p>If operating on global settings, or importing/exporting settings, then SERVICE must be omitted. Otherwise it is required.</p> <p>This is a <a href="https://click.palletsprojects.com/"><code>click</code></a>-powered command-line interface function, and not intended for programmatic use. Call with arguments <code>['--help']</code> to see full documentation of the interface. (See also <a class="autorefs autorefs-external" href="https://click.palletsprojects.com/en/8.1.x/api/#click.testing.CliRunner"><code>click.testing.CliRunner</code></a> for controlled, programmatic invocation.)</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>ctx</code></td> <td> <code><a class="autorefs autorefs-external" title="click.Context" href="https://click.palletsprojects.com/en/8.1.x/api/#click.Context">Context</a></code> </td> <td> <div class="doc-md-description"> <p>The <code>click</code> context.</p> </div> </td> <td> <em>required</em> </td> </tr> </tbody> </table> <p><span class="doc-section-title">Other Parameters:</span></p> <table> <thead> <tr> <th>Name</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr class="doc-section-item"> <td><code>service</code></td> <td> <code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#str">str</a> | None</code> </td> <td> <div class="doc-md-description"> <p>A service name. Required, unless operating on global settings or importing/exporting settings.</p> </div> </td> </tr> <tr class="doc-section-item"> <td><code>use_phrase</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>Command-line argument <code>-p</code>/<code>--phrase</code>. If given, query the user for a passphrase instead of an SSH key.</p> </div> </td> </tr> <tr class="doc-section-item"> <td><code>use_key</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>Command-line argument <code>-k</code>/<code>--key</code>. If given, query the user for an SSH key instead of a passphrase.</p> </div> </td> </tr> <tr class="doc-section-item"> <td><code>length</code></td> <td> <code><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>Command-line argument <code>-l</code>/<code>--length</code>. Override the default length of the generated passphrase.</p> </div> </td> </tr> <tr class="doc-section-item"> <td><code>repeat</code></td> <td> <code><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>Command-line argument <code>-r</code>/<code>--repeat</code>. Override the default repetition limit if positive, or disable the repetition limit if 0.</p> </div> </td> </tr> <tr class="doc-section-item"> <td><code>lower</code></td> <td> <code><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>Command-line argument <code>--lower</code>. Require a given amount of ASCII lowercase characters if positive, else forbid ASCII lowercase characters if 0.</p> </div> </td> </tr> <tr class="doc-section-item"> <td><code>upper</code></td> <td> <code><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>Command-line argument <code>--upper</code>. Same as <code>lower</code>, but for ASCII uppercase characters.</p> </div> </td> </tr> <tr class="doc-section-item"> <td><code>number</code></td> <td> <code><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>Command-line argument <code>--number</code>. Same as <code>lower</code>, but for ASCII digits.</p> </div> </td> </tr> <tr class="doc-section-item"> <td><code>space</code></td> <td> <code><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>Command-line argument <code>--number</code>. Same as <code>lower</code>, but for the space character.</p> </div> </td> </tr> <tr class="doc-section-item"> <td><code>dash</code></td> <td> <code><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>Command-line argument <code>--number</code>. Same as <code>lower</code>, but for the hyphen-minus and underscore characters.</p> </div> </td> </tr> <tr class="doc-section-item"> <td><code>symbol</code></td> <td> <code><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>Command-line argument <code>--number</code>. Same as <code>lower</code>, but for all other ASCII printable characters (except backquote).</p> </div> </td> </tr> <tr class="doc-section-item"> <td><code>edit_notes</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>Command-line argument <code>-n</code>/<code>--notes</code>. If given, spawn an editor to edit notes for <code>service</code>.</p> </div> </td> </tr> <tr class="doc-section-item"> <td><code>store_config_only</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>Command-line argument <code>-c</code>/<code>--config</code>. If given, saves the other given settings (<code>--key</code>, …, <code>--symbol</code>) to the configuration file, either specifically for <code>service</code> or as global settings.</p> </div> </td> </tr> <tr class="doc-section-item"> <td><code>delete_service_settings</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>Command-line argument <code>-x</code>/<code>--delete</code>. If given, removes the settings for <code>service</code> from the configuration file.</p> </div> </td> </tr> <tr class="doc-section-item"> <td><code>delete_globals</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>Command-line argument <code>--delete-globals</code>. If given, removes the global settings from the configuration file.</p> </div> </td> </tr> <tr class="doc-section-item"> <td><code>clear_all_settings</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>Command-line argument <code>-X</code>/<code>--clear</code>. If given, removes all settings from the configuration file.</p> </div> </td> </tr> <tr class="doc-section-item"> <td><code>export_settings</code></td> <td> <code><a class="autorefs autorefs-external" title="typing.TextIO" href="https://docs.python.org/3/library/typing.html#typing.TextIO">TextIO</a> | <a class="autorefs autorefs-external" title="pathlib.Path" href="https://docs.python.org/3/library/pathlib.html#pathlib.Path">Path</a> | <a class="autorefs autorefs-external" title="os.PathLike" href="https://docs.python.org/3/library/os.html#os.PathLike">PathLike</a>[<a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#str">str</a>] | None</code> </td> <td> <div class="doc-md-description"> <p>Command-line argument <code>-e</code>/<code>--export</code>. If a file object, then it must be open for writing and accept <code>str</code> inputs. Otherwise, a filename to open for writing. Using <code>-</code> for standard output is supported.</p> </div> </td> </tr> <tr class="doc-section-item"> <td><code>import_settings</code></td> <td> <code><a class="autorefs autorefs-external" title="typing.TextIO" href="https://docs.python.org/3/library/typing.html#typing.TextIO">TextIO</a> | <a class="autorefs autorefs-external" title="pathlib.Path" href="https://docs.python.org/3/library/pathlib.html#pathlib.Path">Path</a> | <a class="autorefs autorefs-external" title="os.PathLike" href="https://docs.python.org/3/library/os.html#os.PathLike">PathLike</a>[<a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#str">str</a>] | None</code> </td> <td> <div class="doc-md-description"> <p>Command-line argument <code>-i</code>/<code>--import</code>. If a file object, it must be open for reading and yield <code>str</code> values. Otherwise, a filename to open for reading. Using <code>-</code> for standard input is supported.</p> </div> </td> </tr> </tbody> </table> </div> </div> </div> </div> </div> <div class="doc doc-object doc-module"> <h3 id="derivepassphrase.types" class="doc doc-heading"> <code class="doc-symbol doc-symbol-heading doc-symbol-module"></code> <span class="doc doc-object-name doc-module-name">types</span> <a href="#derivepassphrase.types" class="headerlink" title="Permanent link">¶</a></h3> <div class="doc doc-contents "> <p>Common typing declarations for the parent module.</p> <div class="doc doc-children"> <div class="doc doc-object doc-class"> <h4 id="derivepassphrase.types.VaultConfigGlobalSettings" class="doc doc-heading"> <code class="doc-symbol doc-symbol-heading doc-symbol-class"></code> <span class="doc doc-object-name doc-class-name">VaultConfigGlobalSettings</span> <a href="#derivepassphrase.types.VaultConfigGlobalSettings" class="headerlink" title="Permanent link">¶</a></h4> <div class="doc doc-contents "> <p class="doc doc-class-bases"> Bases: <code><span title="typing_extensions.TypedDict">TypedDict</span></code></p> <p>Configuration for vault: global settings.</p> <p><span class="doc-section-title">Attributes:</span></p> <table> <thead> <tr> <th>Name</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr class="doc-section-item"> <td><code><span title="derivepassphrase.types.VaultConfigGlobalSettings.key">key</span></code></td> <td> <code><span title="typing_extensions.NotRequired">NotRequired</span>[<a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#str">str</a>]</code> </td> <td> <div class="doc-md-description"> <p>The base64-encoded ssh public key to use, overriding the master passphrase. Optional.</p> </div> </td> </tr> <tr class="doc-section-item"> <td><code><span title="derivepassphrase.types.VaultConfigGlobalSettings.phrase">phrase</span></code></td> <td> <code><span title="typing_extensions.NotRequired">NotRequired</span>[<a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#str">str</a>]</code> </td> <td> <div class="doc-md-description"> <p>The master passphrase. Optional.</p> </div> </td> </tr> </tbody> </table> <div class="doc doc-children"> </div> </div> </div> <div class="doc doc-object doc-class"> <h4 id="derivepassphrase.types.VaultConfigServicesSettings" class="doc doc-heading"> <code class="doc-symbol doc-symbol-heading doc-symbol-class"></code> <span class="doc doc-object-name doc-class-name">VaultConfigServicesSettings</span> <a href="#derivepassphrase.types.VaultConfigServicesSettings" class="headerlink" title="Permanent link">¶</a></h4> <div class="doc doc-contents "> <p class="doc doc-class-bases"> Bases: <code><a class="autorefs autorefs-internal" title="derivepassphrase.types.VaultConfigGlobalSettings" href="#derivepassphrase.types.VaultConfigGlobalSettings">VaultConfigGlobalSettings</a></code></p> <p>Configuration for vault: services settings.</p> <p><span class="doc-section-title">Attributes:</span></p> <table> <thead> <tr> <th>Name</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr class="doc-section-item"> <td><code><span title="derivepassphrase.types.VaultConfigServicesSettings.notes">notes</span></code></td> <td> <code><span title="typing_extensions.NotRequired">NotRequired</span>[<a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#str">str</a>]</code> </td> <td> <div class="doc-md-description"> <p>Optional notes for this service, to display to the user when generating the passphrase.</p> </div> </td> </tr> <tr class="doc-section-item"> <td><code><span title="derivepassphrase.types.VaultConfigServicesSettings.length">length</span></code></td> <td> <code><span title="typing_extensions.NotRequired">NotRequired</span>[<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>Desired passphrase length.</p> </div> </td> </tr> <tr class="doc-section-item"> <td><code><span title="derivepassphrase.types.VaultConfigServicesSettings.repeat">repeat</span></code></td> <td> <code><span title="typing_extensions.NotRequired">NotRequired</span>[<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>The maximum number of immediate character repetitions allowed in the passphrase. Disabled if set to 0.</p> </div> </td> </tr> <tr class="doc-section-item"> <td><code><span title="derivepassphrase.types.VaultConfigServicesSettings.lower">lower</span></code></td> <td> <code><span title="typing_extensions.NotRequired">NotRequired</span>[<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 constraint on ASCII lowercase characters. If positive, include this many lowercase characters somewhere in the passphrase. If 0, avoid lowercase characters altogether.</p> </div> </td> </tr> <tr class="doc-section-item"> <td><code><span title="derivepassphrase.types.VaultConfigServicesSettings.upper">upper</span></code></td> <td> <code><span title="typing_extensions.NotRequired">NotRequired</span>[<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>Same as <code>lower</code>, but for ASCII uppercase characters.</p> </div> </td> </tr> <tr class="doc-section-item"> <td><code><span title="derivepassphrase.types.VaultConfigServicesSettings.number">number</span></code></td> <td> <code><span title="typing_extensions.NotRequired">NotRequired</span>[<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>Same as <code>lower</code>, but for ASCII digits.</p> </div> </td> </tr> <tr class="doc-section-item"> <td><code><span title="derivepassphrase.types.VaultConfigServicesSettings.space">space</span></code></td> <td> <code><span title="typing_extensions.NotRequired">NotRequired</span>[<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>Same as <code>lower</code>, but for the space character.</p> </div> </td> </tr> <tr class="doc-section-item"> <td><code><span title="derivepassphrase.types.VaultConfigServicesSettings.dash">dash</span></code></td> <td> <code><span title="typing_extensions.NotRequired">NotRequired</span>[<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>Same as <code>lower</code>, but for the hyphen-minus and underscore characters.</p> </div> </td> </tr> <tr class="doc-section-item"> <td><code><span title="derivepassphrase.types.VaultConfigServicesSettings.symbol">symbol</span></code></td> <td> <code><span title="typing_extensions.NotRequired">NotRequired</span>[<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>Same as <code>lower</code>, but for all other hitherto unlisted ASCII printable characters (except backquote).</p> </div> </td> </tr> </tbody> </table> <div class="doc doc-children"> </div> </div> </div> <div class="doc doc-object doc-class"> <h4 id="derivepassphrase.types.VaultConfig" class="doc doc-heading"> <code class="doc-symbol doc-symbol-heading doc-symbol-class"></code> <span class="doc doc-object-name doc-class-name">VaultConfig</span> <a href="#derivepassphrase.types.VaultConfig" class="headerlink" title="Permanent link">¶</a></h4> <div class="doc doc-contents "> <p class="doc doc-class-bases"> Bases: <code><span title="typing_extensions.TypedDict">TypedDict</span></code>, <code><span title="derivepassphrase.types._VaultConfig">_VaultConfig</span></code></p> <p>Configuration for vault.</p> <p>Usually stored as JSON.</p> <p><span class="doc-section-title">Attributes:</span></p> <table> <thead> <tr> <th>Name</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr class="doc-section-item"> <td><code><span title="derivepassphrase.types.VaultConfig.global">global</span></code></td> <td> <code><span title="typing_extensions.NotRequired">NotRequired</span>[<a class="autorefs autorefs-internal" title="derivepassphrase.types.VaultConfigGlobalSettings" href="#derivepassphrase.types.VaultConfigGlobalSettings">VaultConfigGlobalSettings</a>]</code> </td> <td> <div class="doc-md-description"> <p>Global settings.</p> </div> </td> </tr> <tr class="doc-section-item"> <td><code><span title="derivepassphrase.types.VaultConfig.services">services</span></code></td> <td> <code><span title="typing_extensions.Required">Required</span>[<a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#dict">dict</a>[<a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#str">str</a>, <a class="autorefs autorefs-internal" title="derivepassphrase.types.VaultConfigServicesSettings" href="#derivepassphrase.types.VaultConfigServicesSettings">VaultConfigServicesSettings</a>]]</code> </td> <td> <div class="doc-md-description"> <p>Service-specific settings.</p> </div> </td> </tr> </tbody> </table> <div class="doc doc-children"> </div> </div> </div> <div class="doc doc-object doc-function"> <h4 id="derivepassphrase.types.is_vault_config" class="doc doc-heading"> <code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">is_vault_config</span> <a href="#derivepassphrase.types.is_vault_config" class="headerlink" title="Permanent link">¶</a></h4> <div class="doc-signature highlight"><pre><span></span><code><span class="nf">is_vault_config</span><span class="p">(</span><span class="n">obj</span><span class="p">:</span> <span class="n">Any</span><span class="p">)</span> <span class="o">-></span> <span class="n">TypeGuard</span><span class="p">[</span><span class="n">VaultConfig</span><span class="p">]</span> </code></pre></div> <div class="doc doc-contents "> <p>Check if <code>obj</code> is a valid vault config, according to typing.</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>obj</code></td> <td> <code><span title="typing_extensions.Any">Any</span></code> </td> <td> <div class="doc-md-description"> <p>The object to test.</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" title="typing.TypeGuard" href="https://docs.python.org/3/library/typing.html#typing.TypeGuard">TypeGuard</a>[<a class="autorefs autorefs-internal" title="derivepassphrase.types.VaultConfig" href="#derivepassphrase.types.VaultConfig">VaultConfig</a>]</code> </td> <td> <div class="doc-md-description"> <p>True if this is a vault config, false otherwise.</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.1/" class="md-footer__link md-footer__link--prev" aria-label="Previous: Man page: derivepassphrase"> <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 11h12Z"/></svg> </div> <div class="md-footer__title"> <span class="md-footer__direction"> Previous </span> <div class="md-ellipsis"> Man page: derivepassphrase </div> </div> </a> <a href="../sequin/" class="md-footer__link md-footer__link--next" aria-label="Next: Module sequin"> <div class="md-footer__title"> <span class="md-footer__direction"> Next </span> <div class="md-ellipsis"> Module sequin </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 11H4Z"/></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>