edit
The edit
command edits an object in your safe:
bsafe edit (item|item-collections|folder|org-collection) <id> [encodedJson] [options]
The edit
command takes an exact id, the object to edit and encoded JSON, where edits are to be made. A typical workflow would look something like the following:
For example:
bsafe get item 7ac9cae8-5067-4faf-b6ab-acfd00e2c328 | jq '.login.password="newp@ssw0rd"' | bsafe encode | bsafe edit item 7ac9cae8-5067-4faf-b6ab-acfd00e2c328
To edit a collection:
bsafe get collection ee9f9dc2-ec29-4b7f-9afb-aac8010631a1 | jq '.name="My Collection"' | bsafe encode | bsafe edit item-collections ee9f9dc2-ec29-4b7f-9afb-aac8010631a1
The edit
command will perform a replace operation on the object. Upon success, the updated object will be returned as JSON.
The get
command retrieves a single object from your safe:
bsafe get (item|username|password|uri|totp|exposed|attachment|folder|collection|team|team-collection|template|fingerprint) <id> [options]
The get command takes an item id or string for its argument. If you use anything other than an exact id; for example, a string, get will search your safe objects for one with a value that matches. For example, the following command would return a Github password:
bsafe get password Github
Note
The get
command can only return one result, so you should use specific search terms. If multiple results are found, the CLI will return an error.
The encode
command Base 64 encodes stdin. This command is typically used in combination with a command-line JSON processor such as jq
when performing create and edit operations, for example:
bsafe get template folder | jq '.name="My First Folder"' | bsafe encode | bsafe create folder
bsafe get item 7ac9cae8-5067-4faf-b6ab-acfd00e2c328 | jq '.login.password="newp@ssw0rd"' | bsafe encode | bsafe edit item 7ac9cae8-5067-4faf-b6ab-acfd00e2c328