Token generator and validator

TBD, just a diff preview for now.