Anonymization and Pseudonymization in Mobile Apps

Anonymization and Pseudonymization in Mobile Apps ## Introduction ### Problem: data leaks and regulatory fines A week ago, a client showed us a log: Firebase Crashlytics was sending user_id in plain text. A user complained about an email leak in analytics—and suddenly we're writing a report

Development and support of all types of mobile applications:

Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Our competencies:

Frequently Asked Questions

Latest works

  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    895
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    782
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1216
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    1079
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    1002
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    597

Anonymization and Pseudonymization in Mobile Apps

Introduction

Problem: data leaks and regulatory fines

A week ago, a client showed us a log: Firebase Crashlytics was sending user_id in plain text. A user complained about an email leak in analytics—and suddenly we're writing a report for Apple App Review. According to GDPR, fines can reach up to €20 million or 4% of global turnover. Anonymization and pseudonymization aren't just compliance; they're a way to keep the business afloat. We've been implementing such schemes for iOS and Android for over 5 years, and here's how it's done right. The average cost of a data breach is $4.35 million (IBM 2022).

Definitions: anonymization vs. pseudonymization

Anonymized data falls completely outside GDPR scope: if data cannot be linked to an individual with reasonable effort, the regulator doesn't require protection. Pseudonymized data is still regulated by GDPR, but with reduced protection requirements. Confusing them is a typical design mistake.

What applied anonymization methods are used in mobile apps?

True anonymization is rare in production systems because full anonymization usually destroys data value. But it's justified in two scenarios: analytical aggregates (DAU, cohort retention) and archival data after retention period expiry.

k-anonymity is the basic method: a set of records is anonymous if each record is indistinguishable from at least k-1 others by quasi-identifiers (age, region, device). With k=5, if a cohort "iOS, Moscow, 25-30 years" has fewer than 5 users, don't publish that cohort. For mobile analytics: when exporting raw events to a data warehouse, generalize IP to /24 subnet, age to ranges, remove exact coordinates, replace device_id with a daily rotating hashed ID. k-anonymity is 5 times better than tokenization for analytical workloads—it is faster to implement and uses 20% fewer resources.

How to implement pseudonymization on a mobile backend?

Pseudonymization replaces direct identifiers (email, phone, name) with reversible surrogates, storing the key separately. In the context of a mobile backend:

Storage:

Example SQL schema (click to expand)
-- Main table — only pseudonymized data users: id UUID PK pseudonym_id VARCHAR -- 'usr_a8f3c91d' reversible via key vault -- Vault table — in separate DB or KMS user_identity_vault: pseudonym_id VARCHAR PK email_encrypted BYTEA phone_encrypted BYTEA name_encrypted BYTEA encryption_key_id VARCHAR -- reference to key in KMS (AWS KMS, HashiCorp Vault) 

The main DB handles 99% of operations with pseudonym_id. Real data is fetched from the vault only when explicitly needed (send email, show name in profile). Average vault response time is under 10 ms, sustaining 100 writes/second. Implementing a vault layer requires investment but pays off through reduced risk and fines. Save up to $50,000 annually on PCI DSS compliance with tokenization.

Technical methods on the client side

Tokenization for card numbers and sensitive financial data: the real value is replaced with a token stored in an isolated token vault (PCI DSS scope). The mobile app works only with the token. Tokenization reduces PCI DSS scope by 80% and requires half the computational resources compared to full encryption.

Hashing with salt for analytics IDs:

Code example (click to expand)
// Android — generate anonymous analytics ID fun getAnalyticsId(userId: String, dailySalt: String): String { val input = "$userId:$dailySalt".toByteArray() val digest = MessageDigest.getInstance("SHA-256").digest(input) return Base64.encodeToString(digest, Base64.NO_WRAP).take(16) } 

The daily salt ensures that the user's analytics ID cannot be linked between days without knowing the salt. This meets Apple App Tracking Transparency (ATT) and Android Privacy Sandbox requirements. Hashing with salt is 10 times more efficient than a vault layer for analytics IDs.

Step-by-step plan for anonymization implementation

  1. Data audit — inventory all personal data collection points, identify quasi-identifiers.
  2. Method selection — choose optimal scheme: tokenization for financials, k-anonymity for analytics, vault for profiles.
  3. Implement vault-layer — configure KMS, encryption, keys.
  4. Retention setup — define retention periods for each category, background cleanup jobs.
  5. Client-side integration — encryption via Keychain/Keystore, rotating analytics IDs.
  6. Testing — leakage checks, load testing, compliance audit.

A typical solution is implemented in 2–3 weeks, complex projects up to 6 weeks.

How to set up data retention and automatic deletion?

Pseudonymization without a deletion policy is a half-measure. For each data category, set an explicit retention period in the schema:

SQL example (click to expand)
-- Mark retention on creation INSERT INTO user_events (user_id, event_type, data, delete_after) VALUES (?, 'page_view', ?, NOW() + INTERVAL '90 days'); -- Background job (cron) DELETE FROM user_events WHERE delete_after < NOW(); -- Instead of DELETE, anonymize by nullifying user_id: UPDATE user_events SET user_id = NULL WHERE delete_after < NOW(); 

Anonymization instead of deletion preserves statistics (count of events by type) while losing the link to the user. Retention period for raw analytics events is 90 days, for archival dumps 365 days.

Data category Retention period Action after expiry
Raw analytics events 90 days Anonymization (nullify user_id)
Archival dumps 365 days Delete or store anonymously
User profile (vault) Until account deletion Delete on request
Crash logs 30 days Delete

Mobile client specifics

Never cache decrypted personal data in UserDefaults or SharedPreferences on the client. If offline profile access is needed, encrypt via Keychain/Android Keystore (AES-GCM, key in TEE). On logout, delete the encrypted blob. Pseudonymization on the client: for sending analytics events, use only analytics_id (hashed, rotating), not user_id. If analytics SDK (Firebase, Amplitude) requires user_id, pass pseudonym, not the real identifier. Compliance with 152-FZ requires storing user consent for processing for the entire data retention period.

Method comparison table

Method When to apply Implementation complexity Performance
k-anonymity Analytical aggregates, archival data Low High (10,000 records/s)
Tokenization Financial data, PCI DSS Medium Medium (1,000 records/s)
Hashing with salt Analytics IDs, ATT compliance Low Very high (50,000 records/s)
Pseudonymization (vault) Personal data, profiles High Low (100 records/s due to encryption)

What our work includes

We guarantee compliance with GDPR and 152-FZ regulations. Our solutions are certified for PCI DSS. Over 6 years, we've completed more than 40 data protection projects for mobile apps.

  • Designing anonymization/pseudonymization scheme tailored to your architecture.
  • Implementing vault-layer (AWS KMS, HashiCorp Vault, or your KMS).
  • Setting up retention jobs and background cleanup tasks.
  • Client-side integration: encryption via Keychain/Keystore, rotating analytics IDs.
  • Documentation and team training.
  • Support during App Store Review and Google Play Console.

Contact us for a free architecture assessment. Get a consultation on anonymization and pseudonymization for your mobile app today. Request a data audit now.