#!/usr/bin/env -S node -r ts-node/register/transpile-only import fs from "fs" import chalk from "chalk" import prompts from "prompts" import { OnePassword } from "./src/index" const path = "./freddy-2013-12-04.opvault" async function main(args: string[]) { const instance = new OnePassword({ path }) const profiles = await instance.getProfileNames() // const { profile } = await prompts({ // type: "select", // name: "profile", // choices: profiles.map(t => ({ title: t, value: t })), // message: "Which vault?", // }) // console.log(chalk`You have chosen {green ${profile}}.`) const profile = "default" const vault = await instance.getProfile(profile) // const { password } = await prompts({ // type: "invisible", // name: "password", // message: "Master Password?", // }) const password = "freddy" vault.unlock(password) const find = vault.overviews.get("A note with some attachments")! const item = vault.getItem(find.uuid!)! console.log(item.attachments[0].metadata) // const d = vault.decryptAttachment( // item!.original, // fs.readFileSync( // "./freddy/default/F2DB5DA3FCA64372A751E0E85C67A538_AFBDA49A5F684179A78161E40CA2AAD3.attachment" // ) // ) // fs.writeFileSync("./test2.png", d.file) // console.log(vault.overviews.values()) } main(process.argv.slice(2))