using System;
using System.Threading.Tasks;
using Timeline.Entities;
using Timeline.Services.User;
namespace Timeline.Services.Token
{
public interface IUserTokenManager
{
///
/// Try to create a token for given username and password.
///
/// The username.
/// The password.
/// The expire time of the token.
/// The created token and the user info.
/// Thrown when or is null.
/// Thrown when is of bad format.
/// Thrown when the user with does not exist.
/// Thrown when is wrong.
public Task CreateTokenAsync(string username, string password, DateTime? expireAt = null);
///
/// Verify a token and get the saved user info. This also check the database for existence of the user.
///
/// The token.
/// The user stored in token.
/// Thrown when is null.
/// Thrown when the token is expired.
/// Thrown when the token is of bad version.
/// Thrown when the token is of bad format.
/// Thrown when the user specified by the token does not exist. Usually the user had been deleted after the token was issued.
public Task VerifyTokenAsync(string token);
}
}