mirror of
https://github.com/tcsenpai/timecapsule.git
synced 2025-06-02 17:30:21 +00:00
24 lines
658 B
TypeScript
24 lines
658 B
TypeScript
import type timeKey from "./libs/types/timeKey"
|
|
import { timeEncrypt, timeDecrypt } from "./libs/Encryption";
|
|
|
|
async function main() {
|
|
// We set our secret and passwords here
|
|
let secret = "secret";
|
|
let password = "password";
|
|
// We want this to be opened only this day
|
|
let proposedTimeKey: timeKey = {
|
|
time: {
|
|
day: 29,
|
|
month: 3,
|
|
year: 2024,
|
|
},
|
|
password: ""
|
|
}
|
|
// Testing
|
|
let enc = await timeEncrypt(secret, password, proposedTimeKey);
|
|
console.log(`Encrypted: ${enc}`);
|
|
let dec = await timeDecrypt(enc, password);
|
|
console.log(`Decrypted: ${dec}`);
|
|
}
|
|
|
|
main() |