using System;
using System.Threading.Tasks;
namespace Timeline.Services.Token
{
public interface IUserTokenService
{
///
/// Create a token for a user. Please ensure the user id exists!
///
/// The user id.
/// The expire time of the token.
/// Return the generated token.
Task CreateTokenAsync(long userId, DateTime? expireTime);
///
/// Verify a token and get the info of the token.
///
/// The token to verify.
/// The info of the token.
/// Thrown when is null.
/// Thrown when the token is not valid for reasons other than expired.
/// Thrown when the token is expired.
Task ValidateTokenAsync(string token);
///
/// Revoke a token to make it no longer valid.
///
/// The token to revoke.
/// Return true if a token is revoked.
/// Thrown when is null.
///
/// This method returns true if a real token is revoked and returns false if the token is not valid.
/// If the token is expired, false is return.
///
Task RevokeTokenAsync(string token);
///
/// Revoke all tokens of a user.
///
/// User id of tokens.
/// Return the task.
Task RevokeAllTokenByUserIdAsync(long userId);
}
}