mask

fun mask(value: String, strategy: MaskStrategy, visibleChars: Int): String

Masks a secret value according to the specified strategy.

Example:

SecretMasker.mask("mypassword", MaskStrategy.PARTIAL, 4) // "mypa********"
SecretMasker.mask("apikey999", MaskStrategy.EDGES, 0) // "a*******9"
SecretMasker.mask("secret", MaskStrategy.FULL, 0) // "********"
SecretMasker.mask("", MaskStrategy.FULL, 0) // "********"

Return

The masked string representation.

Since

1.0

Parameters

value

The plaintext value to mask.

strategy

The masking strategy to apply.

visibleChars

Number of leading characters to leave visible (only used by MaskStrategy.PARTIAL).

See also