Maps every subcommands from the LastPass CLI and tries to parse the results into Objects
Also contains wrapper functions to help with some shortcomings of the CLI
$ npm install @absolunet/lastpass-sdk
const lastpass = require('@absolunet/lastpass-sdk');
const { success:logged } = lastpass.login('user@example.com');
if (logged) {
const results = lastpass.show('site-prod-ubuntu', { password:true });
if (results.success) {
console.log(results.data[0].password);
} else {
console.error(`Something went wrong: ${results.message}`);
}
}
- Uses dargs for arguments mapping
- Successful calls returns an Object with
success:true
,raw
properties (Some return adata
property with parsed data) - Failed calls returns an Object with
success:false
,message
properties (Some may also returndata
,raw
if pertinent)
Login to LastPass
Required
Type: String
LastPass username
Type: String
LastPass password if you want to skip the manual PIN entry
Logout from LastPass
Change master password
Show entries details
Returns data as an Array
of Object
of entry's fields
Required
Type: String
or Array[String]
Entry name or unique id
List all entries
Returns data as an Array
of Object
of entry's fields
Type: String
Group name
Move entry to another group
Required
Type: String
Unique entry name or id
Required
Type: String
Group name
Add entry
Required
Type: String
Entry name or unique id
Edit entry
Required
Type: String
Entry name or unique id
Generate password
Returns data as an Object
with password
Required
Type: String
Entry name or unique id
Type: String
Password length
Default: 32
Duplicate entry
Required
Type: String
Unique entry name or id
Remove entry
Required
Type: String
Unique entry name or id
Check if logged
Returns data as an Object
with username
Synchronize the local cache with the LastPass servers
Import entries
Required
Type: String
Path to file to import
Export entries
List users of a shared folder
Required
Type: String
Shared folder
Add user to a shared folder
Required
Type: String
Shared folder
Required
Type: String
LastPass username
Modify user of a shared folder
Required
Type: String
Shared folder
Required
Type: String
LastPass username
Delete user from a shared folder
Required
Type: String
Shared folder
Required
Type: String
LastPass username
Create a shared folder
Required
Type: String
Shared folder
Remove a shared folder
Required
Type: String
Shared folder
Manipulate account access lists on a shared folder for a specific user
Required
Type: String
Shared folder
Required
Type: String
LastPass username
Required
Type: String
or Array[String]
Sites
Scans for entries via 'lpass show' (IMPORTANT: Must be logged in or will throw an error)
Returns an Array
of Object
of entries fullname and id
Required
Type: String
or Array[String]
Entry name or search patterns
Type: Boolean
Activate 'lpass show --basic-regexp' flag
Type: Boolean
Activate 'lpass show --fixed-strings' flag
MIT © Absolunet