Update
This commit is contained in:
38
repl.ts
38
repl.ts
@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env ts-node-transpile-only
|
||||
import fs from "fs"
|
||||
import chalk from "chalk"
|
||||
import prompts from "prompts"
|
||||
import { OnePassword } from "./src/index"
|
||||
@ -7,24 +8,35 @@ async function main(args: string[]) {
|
||||
const instance = new OnePassword({ path: args[0] })
|
||||
const profiles = await instance.getProfileNames()
|
||||
|
||||
const { profile } = await prompts({
|
||||
type: "select",
|
||||
name: "profile",
|
||||
choices: profiles.map(t => ({ title: t, value: t })),
|
||||
message: "Which vault?",
|
||||
})
|
||||
// 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}}.`)
|
||||
// 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 } = await prompts({
|
||||
// type: "invisible",
|
||||
// name: "password",
|
||||
// message: "Master Password?",
|
||||
// })
|
||||
const password = "freddy"
|
||||
|
||||
vault.unlock(password)
|
||||
console.log(vault.overviews.values())
|
||||
|
||||
const d = vault.decryptAttachment(
|
||||
fs.readFileSync(
|
||||
"./freddy-2013-12-04.opvault/default/1C7D72EFA19A4EE98DB7A9661D2F5732_3B94A1F475014E27BFB00C99A42214DF.attachment"
|
||||
)
|
||||
)
|
||||
|
||||
fs.writeFileSync("./test", d)
|
||||
|
||||
// console.log(vault.overviews.values())
|
||||
}
|
||||
|
||||
main(process.argv.slice(2))
|
||||
|
Reference in New Issue
Block a user