Encapsulates cursor-based pagination results, providing data and next-cursor token for paged query helpers.
using System.Security.Cryptography;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace IqraCore.Entities.Helpers
{
public class PaginationCursor<T>
{
// TODO LOAD FROM CONFIG APPSETTINGS.JSON
private static readonly string SecretKey = "YOUR_SUPER_SECRET_KEY_FROM_CONFIG_256_BITS_LONG";
public DateTime Timestamp { get; set; }
public string Id { get; set; }
public T Filter { get; set; }
[JsonIgnore] // Don't include the signature in the data to be signed
public string? Signature { get; set; }
public string Encode()
{
var payloadJson = JsonSerializer.Serialize(this, new JsonSerializerOptions { DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull });
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key