{"version":3,"file":"timestamp.mjs","names":[],"sources":["../../src/utils/timestamp.ts"],"sourcesContent":["// Question: Spec isn't clear about the endianness. Assumes big-endian here\n// since ACA-Py uses big-endian.\nexport default function timestamp(): Uint8Array {\n  let time = Date.now()\n  const bytes = []\n  for (let i = 0; i < 8; i++) {\n    const byte = time & 0xff\n    bytes.push(byte)\n    time = (time - byte) / 256 // Javascript right shift (>>>) only works on 32 bit integers\n  }\n  return Uint8Array.from(bytes).reverse()\n}\n\n/**\n * Returns the current time in seconds\n */\nexport function nowInSeconds() {\n  return Math.floor(Date.now() / 1000)\n}\n\nexport function addSecondsToDate(date: Date, seconds: number) {\n  return new Date(date.getTime() + seconds * 1000)\n}\n\nexport function dateToSeconds(date: Date) {\n  return Math.floor(date.getTime() / 1000)\n}\n"],"mappings":";AAEA,SAAwB,YAAwB;CAC9C,IAAI,OAAO,KAAK,IAAI;CACpB,MAAM,QAAQ,CAAC;CACf,KAAK,IAAI,IAAI,GAAG,IAAI,GAAG,KAAK;EAC1B,MAAM,OAAO,OAAO;EACpB,MAAM,KAAK,IAAI;EACf,QAAQ,OAAO,QAAQ;CACzB;CACA,OAAO,WAAW,KAAK,KAAK,CAAC,CAAC,QAAQ;AACxC;;;;AAKA,SAAgB,eAAe;CAC7B,OAAO,KAAK,MAAM,KAAK,IAAI,IAAI,GAAI;AACrC;AAEA,SAAgB,iBAAiB,MAAY,SAAiB;CAC5D,OAAO,IAAI,KAAK,KAAK,QAAQ,IAAI,UAAU,GAAI;AACjD;AAEA,SAAgB,cAAc,MAAY;CACxC,OAAO,KAAK,MAAM,KAAK,QAAQ,IAAI,GAAI;AACzC"}