Files
jellytau/api/jellytau_lib/profiles/pin/index.html
T

16 lines
6.7 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Profile PIN: hashing, and the lockout policy that decides what a guess costs."><title>jellytau_lib::profiles::pin - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-17e0aaed.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="jellytau_lib" data-themes="" data-resource-suffix="" data-rustdoc-version="1.97.1 (8bab26f4f 2026-07-14)" data-channel="1.97.1" data-search-js="search-fd9372ac.js" data-stringdex-js="stringdex-2da4960a.js" data-settings-js="settings-170eb4bf.js" ><script src="../../../static.files/storage-41dd4d93.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../static.files/main-fcd733ba.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-f7c3ffd8.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><a class="skip-main-content" href="#main-content">Skip to main content</a><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module pin</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../jellytau_lib/index.html">jellytau_<wbr>lib</a><span class="version">0.11.5</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module pin</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#constants" title="Constants">Constants</a></li><li><a href="#functions" title="Functions">Functions</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In jellytau_<wbr>lib::<wbr>profiles</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content" tabindex="-1"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../index.html">jellytau_lib</a>::<wbr><a href="../index.html">profiles</a></div><h1>Module <span>pin</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/jellytau_lib/profiles/pin.rs.html#1-290">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Profile PIN: hashing, and the lockout policy that decides what a guess costs.</p>
<p>The policy half is deliberately pure — it takes the stored counter state and
the current time, and returns the decision plus the next state. That is what
makes “five wrong guesses then a lockout that survives a restart” testable
without a database, a clock, or a running app.</p>
<p>What this is <em>not</em>: at-rest protection. The PIN gates switching to a profile;
it does not encrypt that profiles access token, so anyone holding the
database and the keyring has every token regardless. That trade is deliberate
and its reasoning lives in DR-268 — a wrapped token would leave a locked
profile unable to resume its own downloads or drain its own sync queue until
somebody walked past and typed the code.</p>
<p>TRACES: UR-083 | DR-268</p>
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.PinState.html" title="struct jellytau_lib::profiles::pin::PinState">PinState</a></dt><dd>Persisted counter state for one profiles PIN.</dd></dl><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><dl class="item-table"><dt><a class="enum" href="enum.PinDecision.html" title="enum jellytau_lib::profiles::pin::PinDecision">PinDecision</a></dt><dd>What the caller should do with an attempt.</dd></dl><h2 id="constants" class="section-header">Constants<a href="#constants" class="anchor">§</a></h2><dl class="item-table"><dt><a class="constant" href="constant.BASE_LOCKOUT_SECS.html" title="constant jellytau_lib::profiles::pin::BASE_LOCKOUT_SECS">BASE_<wbr>LOCKOUT_<wbr>SECS</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>How long the first lockout lasts. Each subsequent failure doubles it.</dd><dt><a class="constant" href="constant.MAX_ATTEMPTS.html" title="constant jellytau_lib::profiles::pin::MAX_ATTEMPTS">MAX_<wbr>ATTEMPTS</a></dt><dd>Wrong guesses allowed before the first lockout.</dd><dt><a class="constant" href="constant.MAX_LOCKOUT_SECS.html" title="constant jellytau_lib::profiles::pin::MAX_LOCKOUT_SECS">MAX_<wbr>LOCKOUT_<wbr>SECS</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Ceiling on the doubling, so a forgotten PIN never bricks the tile — the
password route is always there, and a lockout measured in hours would push
people towards not setting a PIN at all.</dd></dl><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><dl class="item-table"><dt><a class="fn" href="fn.evaluate.html" title="fn jellytau_lib::profiles::pin::evaluate">evaluate</a></dt><dd>Decide an attempt and produce the state to persist.</dd><dt><a class="fn" href="fn.hash_pin.html" title="fn jellytau_lib::profiles::pin::hash_pin">hash_<wbr>pin</a></dt><dd>Hash a PIN for storage. Returns a PHC string with the salt embedded.</dd><dt><a class="fn" href="fn.validate_pin.html" title="fn jellytau_lib::profiles::pin::validate_pin">validate_<wbr>pin</a></dt><dd>A PIN must be 48 digits. Rejecting non-digits here rather than in the pad
keeps the rule where the rule is enforced.</dd><dt><a class="fn" href="fn.verify_pin.html" title="fn jellytau_lib::profiles::pin::verify_pin">verify_<wbr>pin</a></dt><dd>Compare a candidate PIN against a stored PHC string.</dd></dl></section></div></main></body></html>