mask-pii (Elixir)

Version: 0.2.0

A lightweight, customizable Elixir library for masking Personally Identifiable Information (PII) such as email addresses and phone numbers.

It is designed to be safe, fast, and easy to integrate into logging or data processing pipelines.

Official website: https://finitefield.org/en/oss/mask-pii Developed by: Finite Field, K.K.

Features

Installation

Add :mask_pii to your dependencies:

# mix.exs
{:mask_pii, "~> 0.2.0"}

Then fetch dependencies:

mix deps.get

From a local checkout:

mix deps.get
mix deps.compile

Usage

alias MaskPII.Masker

masker =
  Masker.new()
  |> Masker.mask_emails()
  |> Masker.mask_phones()
  |> Masker.with_mask_char("#")

input_text = "Contact: alice@example.com or 090-1234-5678."
output = Masker.process(masker, input_text)

IO.puts(output)
# => "Contact: a####@example.com or ###-####-5678."

Configuration

The Masker module uses a builder-style API. By default, Masker.new() performs no masking (pass-through).

Builder Functions

Function Description Default
mask_emails/1 Enables detection and masking of email addresses. Disabled
mask_phones/1 Enables detection and masking of global phone numbers. Disabled
with_mask_char/2 Sets the character used for masking (e.g., "*", "#", "x"). "*"

Masking Logic Details

Emails

Phones (Global Support)