Expand description
What is never handed to an agent as it is (docs/ai.md, “Masking”): the one-time code, password or sign-in link a message carries, IBANs, payment card numbers and French social security numbers (NIR). Each number is checked by its own rule (ISO 13616’s mod 97, Luhn’s, the NIR’s key), so an order number or a phone number stays as written. The window shows them all.
Structs§
- Secrets 🔒
- What a message carries: the kinds of secret, and the codes themselves.
Constants§
- AFTER 🔒
- BEFORE 🔒
- How far around a number
codes::detectis asked about it: its phrases sit up to 160 characters before a code, or 100 after it (codes.rs). A piece that starts nearer is tried too, asdetectreads only the first phrase of a piece (“never share your code… your code: 482913”). - CODE 🔒
- LINK 🔒
- NIR 🔒
- OVERLAP 🔒
- PASSWORD 🔒
- PIECE 🔒
- Characters
codes::detectis given at once to find a secret that is not a code (it reads 6000), and how far two of these pieces overlap: more than any of its phrases.
Functions§
- apart 🔒
- What may stand between the characters of a code as it is printed: a space of any width, a hyphen, a dot, or the line break or tab of a table made text.
- card_at 🔒
- A payment card number, Luhn’s check digit right: 16 or 19 digits from a network’s first digit (2 to 6), or 15 from American Express’s 34 and 37. Fourteen digits are left alone: a SIRET has a Luhn key too, and is no secret.
- codes_
in 🔒 - The codes a text holds, as
codes::detectreads them. - could_
be_ 🔒code - Whether a code could start here, as
codes::detecttakes one: four to eight digits that are not a year, or three and three (“482 913”). - hide_
code 🔒 - Every place
codeis written, its characters next to each other or apart (“482 913”, “482-913”, “4 8 2 9 1 3”), as a word of its own; and for a code printed with letters before it (“G-482913”), its digits alone too. - hide_
code_ 🔒as - hide_
links 🔒 - Every web address replaced: one with a scheme (“https://”, “HTTPS://”, an app’s own “name://”), one that starts with “www.”, or a host and a path (“bank.example/reset/…”), as a mail turned into text writes them.
- iban_at 🔒
- An IBAN starting at
start, written whole or in groups: ISO 13616, its check digits by mod 97. The longest form that checks out is taken. - iban_
checks 🔒 - json
- Every text of an answer’s data masked as
textmasks it: the data says no more than the lines do. - link_at 🔒
- Whether a link starts the text.
- luhn 🔒
- message
- A message’s subject and text as an agent gets them, when it carries a
short-lived secret (
codes::detect): every code hidden wherever it is written, spaced or not; every link hidden, as good as the code (a reset, a sign-in link, an address to confirm); a password’s message kept whole from the agent, as where the password sits is not known. Then the numberstexthides.words: what the codes detector looks for, as the configuration makes it (Words::of), so that a code it finds in the window is hidden from the agent too. - nir_at 🔒
- A French social security number (NIR): 15 characters, the first 1, 2, 7 or 8, the last two its key, 97 less the first thirteen modulo 97; Corsica’s departments, 2A and 2B, count as 19 and 18 in the key.
- runs 🔒
- Runs of
allowedcharacters fromstart, a single space (or hyphen, whenhyphens) allowed between them: each place a run could end, with the characters kept so far. A place is kept only where no letter or digit follows. - secrets 🔒
- Every secret of a message.
codes::detectreads the first 6000 characters, the first phrase it knows and the code beside it, and says one kind: so each number that could be a code is asked about with the words around it, in a text where codes printed apart (“4 8 2 9 1 3”) are joined too; and the rest is read piece by piece with every digit blanked, so that a password or a link further on is not hidden behind a code. - separator 🔒
- What may stand between the groups of an account or a card number: a space, of any width (HTML mail turned into text has non-breaking ones).
- squeezed 🔒
- The text with short groups of digits joined when together they make four to eight (“4 8 2 9 1 3”, “48 29 13”, “482 913”): a code printed in boxes, or by a table turned into text, read as one. A longer series (a phone number) stays as it is.
- text
- A text with its IBANs, card numbers and social security numbers hidden; the last four characters of an IBAN or a card stay, to tell them apart.