[Tokenlib] Encapsulate encode and decode into a TokenManager