Skip to content

Commit

Permalink
chore: Remove support for 1Password CLI version one
Browse files Browse the repository at this point in the history
  • Loading branch information
twpayne committed Nov 9, 2023
1 parent 1f4f1d4 commit bdca3a1
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 370 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ CLI](https://developer.1password.com/docs/cli) (`op`).

!!! warning

When using 1Password CLI v2 with biometric authentication, account shorthand
names are not available. In order to assist with this, chezmoi supports
multiple derived values from `op account list` that can be changed into the
appropriate 1Password *account-uuid*.
When using the 1Password CLI with biometric authentication, account
shorthand names are not available. In order to assist with this, chezmoi
supports multiple derived values from `op account list` that can be changed
into the appropriate 1Password *account-uuid*.

### Example

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,3 @@ config variable.
{{ (onepassword "$UUID" "$VAULT_UUID" "$ACCOUNT_NAME").details.password }}
{{ (onepassword "$UUID" "" "$ACCOUNT_NAME").details.password }}
```

!!! warning

When using [1Password CLI 2.0](https://developer.1password.com/), note that
the structure of the data returned by the `onepassword` template function
is different and your templates will need updating.

You may wish to use `onepasswordDetailsFields` or `onepasswordItemFields`
instead of this function, as `onepassword` returns fields as a list of
objects. However, this function may return values that are inaccessible from
the other functions. Testing the output of this function is recommended:

```console
$ chezmoi execute-template "{{ onepassword \"$UUID\" | toJson }}" | jq .
```

Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ elements of `details.fields` are returned as a map indexed by each field's `id`
If there is no valid session in the environment, by default you will be
interactively prompted to sign in.

!!! info

For 1Password CLI 1.x, the map is indexed by each field's `designation`.

The output from `op` is cached so calling `onepasswordDetailsFields` multiple
times with the same *uuid* will only invoke `op` once. If the optional
*vault-uuid* is supplied, it will be passed along to the `op get` call, which
Expand Down Expand Up @@ -75,18 +71,3 @@ accounts).
}
}
```

!!! warning

When using [1Password CLI 2.0](https://developer.1password.com/docs/cli),
note that the structure of the data returned by the
`onepasswordDetailsFields` template function is different and your templates
will need updating.

You may wish to use `onepassword`, `onepasswordItemFields`, or
`onepasswordRead` instead of this function, as it may not return expected
values. Testing the output of this function is recommended:

```console
$ chezmoi execute-template "{{ onepasswordDetailsFields \"$UUID\" | toJson }}" | jq .
```
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,6 @@ interactively prompted to sign in.
$ op item get abcdefghijklmnopqrstuvwxyz --fields exampleLabel
```

!!! info

For 1Password CLI 1.x.

```
{{ (onepasswordItemFields "abcdefghijklmnopqrstuvwxyz").exampleLabel.v }}
```

is equivalent to calling

```console
$ op item get abcdefghijklmnopqrstuvwxyz --fields exampleLabel
```

!!! example

Given the output from `op`:
Expand Down Expand Up @@ -128,17 +114,3 @@ interactively prompted to sign in.
}
}
```

!!! warning

When using [1Password CLI 2.0](https://developer.1password.com/docs/cli),
note that the structure of the data returned by the `onepasswordItemFields`
template function is different and your templates will need updating.

You may wish to use `onepassword`, `onepasswordDetailsFields`, or
`onepasswordRead` instead of this function, as it may not return expected
values. Testing the output of this function is recommended:

```console
$ chezmoi execute-template "{{ onepasswordItemFields \"$UUID\" | toJson }}" | jq .
```
14 changes: 0 additions & 14 deletions assets/chezmoi.io/docs/user-guide/password-managers/1password.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ chezmoi includes support for [1Password](https://1password.com/) using the
[1Password CLI](https://support.1password.com/command-line-getting-started/) to
expose data as a template function.

!!! note

The [1Password CLI 2.0](https://developer.1password.com/) has been released.
Examples will be shown using the changed details for this version and
examples for 1Password CLI 1.x will follow.

Log in and get a session using:

```console
Expand All @@ -19,14 +13,6 @@ $ eval $(op signin --account $SUBDOMAIN)

This is not necessary if you are using biometric authentication.

!!! info

For 1Password CLI 1.x, use:

```console
$ eval $(op signin $SUBDOMAIN.1password.com $EMAIL)
```

The output of `op read $URL` is available as the `onepasswordRead` template
function, for example:

Expand Down
1 change: 1 addition & 0 deletions internal/cmd/doctorcmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ func (c *Config) runDoctorCmd(cmd *cobra.Command, args []string) error {
ifNotExist: checkResultInfo,
versionArgs: []string{"--version"},
versionRx: onepasswordVersionRx,
minVersion: &onepasswordMinVersion,
},
&binaryCheck{
name: "bitwarden-command",
Expand Down
Loading

0 comments on commit bdca3a1

Please sign in to comment.