1Password

nicolaw 13th November 2020 at 2:24pm
TechnicalNotes

Usage

$ eval $(op signin acmeoil)
$ op list items | jq .

# Example
$ op get item "Deepwater Horizon" | jq -r '.details.fields[]|select(.designation=="password").value'
$ op get item "Deepwater Horizon" | jq -r '.details.sections[]|select(.fields?).fields[]|select(.t=="Access Token")|.v'

Initial Setup

nicolaw@nicolaw: ~$ op signin https://acmeoil.1password.com nicolaw@acme.com AB-CDEF12-345678-90ABC-DEF12-34567-890AB
Enter the password for nicolaw@acme.com at acmeoil.1password.com:
Enter your six-digit authentication code: 123456
export OP_SESSION_acmeoil="1234567890ABCDEFabcdef1234567890ABCDEFabcde"
# This command is meant to be used with your shell's eval function.
# Run 'eval $(op signin acmeoil)' to sign in to your 1Password account.
# Use the --raw flag to only output the session token.

nicolaw@nicolaw: ~ $ export OP_SESSION_acmeoil="1234567890ABCDEFabcdef1234567890ABCDEFabcde"

nicolaw@nicolaw: ~ $ ls -al ~/.op
total 8
drwx------   3 nicolaw  staff    96  1 Jan 19:00 ./
drwxr-xr-x+ 46 nicolaw  staff  1472  1 Jan 19:00 ../
-rw-------   1 nicolaw  staff   367  1 Jan 19:00 config

Creating Logins

$ op create item "Login" --title "My Login Foo" --tags "commandline,blah" \
  "$(op get template login \
  | jq -c --arg username dennis --arg password kucinich \
    'setpath(path(.fields[]|select(.name=="username")|.value);$username)
    |setpath(path(.fields[]|select(.name=="password")|.value);$password)' \
      | op encode)"