public static string Encode <T>(T data, int time = 10) { JWTData <T> payload = new JWTData <T> { data = data, exp = Authentication.GetNow.AddMinutes(time).ToBinary() }; return(Securities.JWTEncode(payload)); }
public static T Decode <T>(string token) { JWTData <T> payload = Securities.JWTDecode <JWTData <T> >(token); if (payload != null) { if (new DateTime(payload.exp) >= Authentication.GetNow) { return(payload.data); } } return(default(T)); }