UAN

object UAN(source)

Validator, formatter, and masker for EPFO Universal Account Numbers (UAN).

UAN is a 12-digit number issued by the Employees' Provident Fund Organisation (EPFO) of India. It uniquely identifies each EPFO member across employers and persists throughout their career.

Format: 12 consecutive digits — no checksum algorithm is publicly documented by EPFO.

Accepted input forms (all normalised before validation):

  • Raw digits: "101234567890"

  • With spaces: "1012 3456 7890" — internal whitespace stripped

  • Whitespace padded: " 101234567890 " — leading/trailing whitespace trimmed

Note: Hyphens are not stripped — not a documented UAN input convention. "1012-3456-7890" normalises to "1012-3456-7890" (13 chars after whitespace strip) → InvalidReason.WRONG_LENGTH.

UAN is employment PII — links to individual's EPF contributions and employment history. Always mask before displaying in UI or logging. See mask.

This object is stateless and thread-safe.

Samples

UAN.validate("100123456789") // ValidationResult.Valid
UAN.format("100123456789") // "100123456789"
UAN.mask("100123456789") // "XXXXXXXX6789"

Functions

Link copied to clipboard
fun format(value: String): String

Formats a UAN to canonical form: 12 consecutive digits, no separators.

Link copied to clipboard
fun isValid(value: String): Boolean

Returns true if validate returns ValidationResult.Valid.

Link copied to clipboard
fun mask(value: String, visibleStart: Int = 0, visibleEnd: Int = 4, maskChar: Char = 'X'): String

Masks a UAN for PII-safe display.

Link copied to clipboard

Validates an EPFO Universal Account Number (UAN).