local-pii

Security & Hashing

Private mappings, placeholder disclosure, and the trust boundary between Detection and Generation.

The private mapping is the secret

The mapping from placeholder to original user content is the only thing that can restore protected content. Keep it in memory. Do not log it, send it to analytics or crash reporters, or persist it outside a platform keystore. Keep original content out of telemetry that runs before Detection.

What a Generation provider sees

StrategyValueEqualityType
sequential()not exposedwithin a privacy sessionyes ([EMAIL_1])
hashed({ secret })not exposedstable with the keyyes
token()not exposedwithin a privacy sessionnot exposed
token({ secret })not exposedstable with the keynot exposed

Equality can be useful for stable references, but it is metadata. Equal canonical values reuse one token() during a privacy session; a new session breaks that link. token() is still the safer default for type obscurity and machine-parsed output.

Why unkeyed hashing is forbidden

A plain hash of an email or phone is guessable: a provider holding the hash can recompute candidates offline. hashed and token({ secret }) use the key you supply, so generate and store a strong random key; the strategies do not check its entropy. Expo apps that install expo-crypto and expo-secure-store can use getOrCreateDeviceSecret() from local-pii/expo. Without the key, a correct guess cannot be verified.

Tool arguments are a disclosure boundary. Rehydrating an argument gives your tool the original value; if that tool forwards it elsewhere, that is a new disclosure that your application owns. See Tool Calls.

On this page