public static AuthToken DeserializeToken(string token) { try { var array = Convert.FromBase64String(token); array = Decrypt(array); using (var ms = new MemoryStream(array)) using (DeflateStream ds = new DeflateStream(ms, CompressionMode.Decompress)) { var bytes = ds.ReadAllBytes(); return(JsonExtensions.FromJsonBytes <AuthToken>(bytes, EntityJsonContext.FullJsonSerializerOptions)); } } catch (Exception) { throw new AuthenticationException("Invalid token"); } }
public static object?[]? GetOperationArgs(this PackageEntity package) { return(package.OperationArguments == null ? null : (object?[])JsonExtensions.FromJsonBytes <object[]>(package.OperationArguments, EntityJsonContext.FullJsonSerializerOptions)); }