ttid
v1.0.1
Published
Tintoa Timestamp Identification
Downloads
18
Maintainers
Readme
TTID (Tintoa Timestamp Identification)
Creates unique ids with timestamp and optional encoded data.
Installation
npm install ttid --save
Usage
import { TTID, options } from "ttid";
// Setup ttid first
TTID.key = "mySecret"; // Set the key for data encryption/decryption
TTID.algorithm = options.algorithms.AES192; // set the dec/enc algorithm. Defaults to AES192
TTID.sign = "november"; // set an encrypted identifier to the id. Will be encrypted with the TTID.key.
let id = new TTID();
console.log(id.string); // '4686fa31a0fa5efd78eac34f0b2e8ea6-16836a786cd-349f935-0'
console.log(id.date) // 2019-01-10T07:27:20.173Z
let id2 = new TTID("Secret Data Inside");
console.log(id2.string); // '4686fa31a0fa5efd78eac34f0b2e8ea6-16836aa0fbd-4f02528d96e5f6b875ac25e7ba03a1ed760aed9ce32383a17668c204cdc4f4a7-1'
console.log(id2.data); // "Secret Data Inside"