ggez-banking-sdk
Version:
A Node.js package to handle GGEZ Banking API endpoints, Simplify the process of managing CRUD operations with this efficient and easy-to-use package.
27 lines (26 loc) • 973 B
JavaScript
import { pad, padMilliseconds } from "..";
import crypto from "crypto";
const generateSourceID = (userId) => {
const now = new Date();
// Format date and time components
const day = pad(now.getDate());
const month = pad(now.getMonth() + 1); // Months are zero-based
const year = now.getFullYear();
const hours = pad(now.getHours());
const minutes = pad(now.getMinutes());
const seconds = pad(now.getSeconds());
const milliseconds = padMilliseconds(now.getMilliseconds());
const timestamp = `${day}${month}${year}.${hours}${minutes}${seconds}.${milliseconds}`;
const source_id = `U.${userId || 0}.${timestamp}`;
return source_id;
};
const generateWiped = () => {
return "____";
};
const generateBase64 = (length = 32) => {
return crypto.randomBytes(length).toString("base64");
};
const generateUUID = () => {
return crypto.randomUUID();
};
export { generateSourceID, generateWiped, generateBase64, generateUUID };