using System;
namespace Timeline.Services.Token
{
    public interface IUserTokenHandler
    {
        /// 
        /// Create a token for a given token info.
        /// 
        /// The info to generate token.
        /// Return the generated token.
        /// Thrown when  is null.
        string GenerateToken(UserTokenInfo tokenInfo);
        /// 
        /// Verify a token and get the saved info. Do not validate lifetime!!!
        /// 
        /// The token to verify.
        /// The saved info in token.
        /// Thrown when  is null.
        /// Thrown when the token is of bad format.
        /// 
        /// If this method throw , it usually means the token is not created by this service.
        /// Do not check expire time in this method, only check whether it is present.
        /// 
        UserTokenInfo VerifyToken(string token);
    }
}