secret wrapper type

A small class that holds a secret and refuses to print it, so it can travel through code without leaking into logs.

In more detail

The type prints a masked form, such as the last four characters, and needs an explicit call such as reveal to read the real value, which review can search for. Printing becomes a decision the type makes once instead of every call site.

Example

The course's Secret type prints only the last four characters and needs an explicit reveal call to read the real value, which review can search for.

Related terms

Taught in

References