Models — aparte-secrets 1.1.1

A password in a message, caught before it is sent.

aparte-secrets finds passwords, API keys, tokens and private keys in text. It reads the value and what is said around it, so it finds what a pattern scanner has no rule for — a password in a sentence, the key of a provider nobody listed — and leaves hashes, UUIDs and placeholders alone. ~200 KB, a few milliseconds, nothing leaves the page.

What the model found

What is sent instead

Loading the model, ~200 KB…

Everything above is the model’s, computed in this tab as you type: what it found, and the placeholders mask() puts in its place. Every value in the examples is invented. The latency is measured here, not quoted.

What it (weighs)

~200 KBthe fileint8 — English and French
0.76F1 on chat messageswritten after training — OpenAI’s privacy-filter 0.53, gitleaks 0.29
0.85line F1 on CredDataSamsung’s public benchmark — gitleaks 0.39
… msper message, one coremeasured above, in your tab
0network callsafter the file: the model runs in the page
0dependenciesin the browser and Node

On clean code it is noisier than a pattern scanner: 0.17 false alerts per 1,000 lines, against 0.02 for gitleaks. Every test set and every number are on the model card →

Before the message (leaves)

Mask the message, send the masked text, and put the values back into the answer — all three on the client. A value found once is masked everywhere it appears.

import { loadSecrets } from '@aparte/secrets';

const secrets = await loadSecrets();
const { text, secrets: map } = secrets.mask(message);   // "[PASSWORD_1]" in place of the value
const answer = await askTheModel(text);                 // the secret never leaves the device
secrets.unmask(answer, map);                            // the values back, locally

npm install @aparte/secrets — once your app is bundled, serve the model file yourself and pass it in: with Vite, import modelUrl from '@aparte/secrets/model?url', then loadSecrets(modelUrl). For names, emails and phone numbers, run aparte-privacy on the same text.

In your (repository)

The same model scans files and commits, on your machine or on the CI runner, with no network call. It finds what has no fixed format, so it goes beside gitleaks or secretlint, not instead of them. Values are redacted in every output.

npx @aparte/secrets-cli                 # every file git tracks
npx @aparte/secrets-cli --staged        # only what the next commit adds

On GitHub, each finding becomes an annotation on its line of the pull request:

steps:
  - uses: actions/checkout@v5
  - uses: apartejs/aparte-secrets-action@v1

Also as a pre-commit hook (id: aparte-secrets) and as a secretlint rule. Options, baselines and SARIF output: the CLI and the Action.

Where it (runs)

One model, one runtime per language. Each reads the same file and finds the same spans, with the same categories and the same scores.

JavaScript
Browsers, Node npm install @aparte/secrets
Swift
iOS, macOS, tvOS, watchOS, visionOS, Linux, Windows Swift Package Manager: https://github.com/apartejs/aparte-secrets-swift
Kotlin
Android 5.0+, any JVM 8+ — from Kotlin or Java Maven Central: dev.apartejs:secrets

In Swift, AparteSecrets brings the runtime and the model:

import AparteSecrets

let secrets = try Secrets.load()   // load once, share across threads
secrets.detect("the wifi password is Sunflower77# for the guests")

In Xcode, File → Add Package Dependencies… and paste the repository URL.

In Kotlin, on Android or the JVM:

import dev.apartejs.secrets.Secrets

val secrets = Secrets.load()   // load once, share across threads
secrets.detect("the wifi password is Sunflower77# for the guests")

Add dev.apartejs:secrets to your Gradle dependencies; it is usable from Java too. On Android, load it off the main thread.

What it (is), and is not

Context, not patterns
It reads the words around a value: a random-looking string is a key when the text says it is one. That is how it finds passwords and unknown providers, and why a key pasted alone, with nothing said about it, is harder for it.
Beside a scanner
On clean code it raises more false alerts than gitleaks or detect-secrets, which only report the formats they know. In chat, about one alert in four is not a secret. Use it for what they miss, next to them.
Boundaries
A trailing symbol or a punctuation-heavy value can be cut a character short or long. Escaped JSON reads worse than plain text.
English and French
The only languages it is tested on. The chat test sets are synthetic — secrets written into real messages; CredData and the clean repositories are the independent references.
Open
MIT, code and weights. A Python reference reader is published beside the model, and every runtime gives the same spans as it on the reference texts. No secret, even an invented one, lives in the code repository: the test texts are on Hugging Face.