3 ms·
One time I made an authentication system for an application that had some types like PlainTextAccountPassword and HashedAccountPassword. The storage backend for
by oftenwrong 6y ago
One time I made an authentication system for an application that had some types like PlainTextAccountPassword and HashedAccountPassword. The storage backend for accounts accepted a HashedAccountPassword only. This way it would be less likely that a maintainer would end up storing a plain text password.
It is possible to do something like this in nearly any language with a type system.
- stjohnswarts 6y agoYeah, easy to make a class for that in Python and you basically have a new type. It can even check itself, although I'm not sure that's a great idea :) .