1password-js 中文文档教程

发布于 8年前 浏览 28 项目主页 更新于 3年前

1password.js

1password.js 是一个处理 1password Vaults 的库。

Installation

您可以通过 npm 安装:

> npm install 1password-js

Usage

1password.js 公开了一个使用 vault 主密码和可选的配置文件名称实例化的类,并且可以使用 search 方法进行搜索:

const Vault = require('1password-js');

// Somehow we get the master password...

const vault = new Vault(masterPassword);

// Or, supplying a profile name:

const vault = new Vault(masterPassword, 'my-special-profile');

// Searching in the Vault
// `.search` return a Promise that will resolve to the item detail(s)
// or reject
vault.search('Github').then(items => {
    // The search may have multiple entries
    const password = items[0].itemDetail.fields.find(field => field.designation === 'password').value;
}).catch(() => {
    // There wasn't anything found with that title
})

Notes

这目前仅适用于 Mac。 如果您在其他系统上有 vault sqlite 数据库的位置,请创建一个问题,我会添加它!

License

麻省理工学院

1password.js

1password.js is a library to process 1password Vaults.

Installation

You can install via npm:

> npm install 1password-js

Usage

1password.js exposes a class that is instantiated with the vault master password and optionally, the profile name, and can be searched with the search method:

const Vault = require('1password-js');

// Somehow we get the master password...

const vault = new Vault(masterPassword);

// Or, supplying a profile name:

const vault = new Vault(masterPassword, 'my-special-profile');

// Searching in the Vault
// `.search` return a Promise that will resolve to the item detail(s)
// or reject
vault.search('Github').then(items => {
    // The search may have multiple entries
    const password = items[0].itemDetail.fields.find(field => field.designation === 'password').value;
}).catch(() => {
    // There wasn't anything found with that title
})

Notes

This only currently works on Mac. If you have the location of the vault sqlite database on other systems, create an issue and I'll add it!

License

MIT

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文