unopass-go is a Go package that allows you to retrieve secrets from the 1Password CLI using your biometrics.

mkdir myproject && cd myproject
go mod init myproject
go get github.com/amadotejada/unopass-go/unopasspackage main
import (
"fmt"
"log"
"github.com/amadotejada/unopass-go/unopass"
)
/*
Parameters:
VAULT (string): the name of the 1Password vault
ITEM (string): the name of the item within the specified vault
FIELD (string): the name of the field to retrieve within the specified item
DEAUTHORIZE (bool): if true, sign out of the 1Password CLI session after the read
Returns:
(string, error) the value of the field, or an error
*/
func main() {
username, err := unopass.Secret("personal", "server", "username", false)
if err != nil {
log.Fatal(err)
}
password, err := unopass.Secret("personal", "server", "password", true)
if err != nil {
log.Fatal(err)
}
fmt.Println(username, password)
}- Go v1.20 or higher
- 1Password CLI v2.4.1 or higher
- 1Password App v8.7.1 or higher
- Biometrics enabled
Authorization expires after 10 minutes of inactivity in the session. There's a hard limit of 12 hours, after which you must reauthorize.