The Model Doesn’t Need Their Phone Number A developer who wired a WhatsApp agent to an LLM described replacing raw personal data in prompts with keyed HMAC-SHA256 tokens, keeping the HMAC key in AWS KMS via either a GenerateMac call on an HMAC_256 key or a cached GenerateDataKey plaintext key used locally with Node's crypto. The developer cited GDPR pseudonymisation requirements and Colombia's Ley 1581 of 2012, which obliges controllers and processors to apply technical, human and administrative safeguards against unauthorized access, use or loss, as the reason to stop sending names, phone numbers and email addresses to model vendors. The approach uses deterministic tokens so the model can still join a conversation thread, while noting HMAC KMS keys cannot encrypt data or auto-rotate and that GenerateMac accepts messages up to 4,096 bytes. The first time I wired a WhatsApp agent to an LLM, I almost sent it a thread full of names, phone numbers, and email addresses, as if a prompt were just another log line. It isn’t. Once that text leaves your code, you have a new copy of other people’s data: in your own logs, in a vendor’s systems, maybe in a trace you forgot you had turned on. Assistants that read team chats do this by default. The model needs to know that the same person who asked for the report yesterday wrote again today. It does not need her name, or that her number was in the message. A prompt that contains personal data is not “just context.” It is processing of that data in a place you do not fully control. You log prompts to debug a bad completion. An LLM vendor may retain inputs for abuse review, or for a period set in their terms and data processing agreement — details that change. Someone pastes a trace into a ticket. None of that looks like a database, and all of it is still a copy. Under the GDPR, pseudonymisation means processing personal data so it can no longer be attributed to a person without additional information, and keeping that additional information separate and protected. 1 Pseudonymised data is still personal data; it is not anonymous. 2 The regulation also lists pseudonymisation among the technical measures to consider when you secure processing. 3 In Colombia, Ley 1581 of 2012 requires the controller and the processor to handle personal data with the technical, human, and administrative measures needed to prevent unauthorized access, use, or loss, and to require any processor to respect the security and privacy of that information. 4 5 Sending raw phone numbers to a model vendor, and then logging the prompt, is hard to square with that duty. I am not a lawyer, and this is not legal advice. It is the reason I stopped putting raw personal data in prompts. The flow looks like this: Deterministic matters. If Ana Pérez becomes NAME v1 9f3c2a11b0e74d18 in one message and a different string in the next, the model cannot join the thread. A keyed hash gives you the same token for the same normalized value, without putting a reversible ciphertext in the prompt. I keep the HMAC key in AWS KMS. There are two honest ways to do that. The stricter one is to create an HMAC KMS key — KeySpec HMAC 256, KeyUsage GENERATE VERIFY MAC — and call GenerateMac with MacAlgorithm HMAC SHA 256. 6 7 The key material is generated and used inside KMS and never leaves it unencrypted. 8 Each unique value is an API call. The message you pass to GenerateMac can be up to 4,096 bytes, which is plenty for a name or an email. 6 The cheaper one, in latency and in request volume, is to call GenerateDataKey on a regular symmetric encryption KMS key, cache the plaintext data key in memory, and run HMAC-SHA256 locally with Node's crypto. 9 Keep the encrypted copy CiphertextBlob so you can decrypt it again after a restart. The data key now lives in RAM: do not log it, rotate it on a schedule, and treat a memory dump as a key-compromise event. HMAC KMS keys cannot encrypt data or mint data keys, so the cache path needs a separate encryption key. They also do not support automatic rotation: if you need a new key, you create one and you version the tokens. 8 js import { createHmac } from "node:crypto";import { KMSClient, GenerateMacCommand, GenerateDataKeyCommand,} from "@aws-sdk/client-kms";const kms = new KMSClient {} ; // region from AWS REGIONconst HMAC KEY ID = process.env.PII HMAC KEY ID ; // alias/pii-hmacconst DATA KEY KMS ID = process.env.PII DATA KEY KMS ID ; // ENCRYPT DECRYPT keyconst EMAIL RE = /\b A-Z0-9. %+- +@ A-Z0-9.- +\. A-Z {2,}\b/gi;// Simplified. In production I prefer a library such as libphonenumber-js.const PHONE RE = / ?< \d ?:\+\d{1,3} \s.- ? ? ?:\ ?\d{2,4}\ ? \s.- ? ?\d{3,4} \s.- ?\d{3,4} ? \d /g;type Kind = "EMAIL" | "PHONE" | "NAME";type TokenMap = Map