mirror of
https://github.com/logos-messaging/js-rln.git
synced 2026-01-03 06:03:08 +00:00
refactor: use standard JS lib
This commit is contained in:
parent
50c30f1332
commit
b0b9e1e46b
@ -1,5 +1,3 @@
|
||||
import { writeUIntLE } from "./byte_utils.js";
|
||||
|
||||
const DefaultEpochUnitSeconds = 10; // the rln-relay epoch length in seconds
|
||||
|
||||
export function dateToEpoch(
|
||||
@ -11,7 +9,10 @@ export function dateToEpoch(
|
||||
}
|
||||
|
||||
export function epochIntToBytes(epoch: number): Uint8Array {
|
||||
return writeUIntLE(new Uint8Array(32), epoch, 0, 8);
|
||||
const bytes = new Uint8Array(32);
|
||||
const db = new DataView(bytes.buffer);
|
||||
db.setUint32(0, epoch, true);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
export function epochBytesToInt(bytes: Uint8Array): number {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user