ESIC

object ESIC(source)

Validator, formatter, and masker for ESIC (Employee State Insurance Corporation) numbers.

An ESIC number is a 17-digit identifier assigned to insured employees under the Employees' State Insurance Act, 1948. It is a private health-linked identifier and must be masked in any user-facing display per ESIC PII policy.

There is no publicly documented checksum algorithm for ESIC numbers. Validation is format-only (length + digit-only check).

This object is stateless and thread-safe.

Samples

ESIC.validate("12345678901234567") // ValidationResult.Valid
ESIC.format("12345678901234567") // "12345678901234567"
ESIC.mask("12345678901234567") // "XXXXXXXXXXXXX4567"

Functions

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

Formats an ESIC number to its canonical 17-digit form.

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 an ESIC number for PII-safe display.

Link copied to clipboard

Validates an ESIC number.