connect-sdk-go

module
v1.5.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2023 License: MIT

README ยถ

1Password Connect SDK for Go

Access your 1Password items in your Go applications through your self-hosted 1Password Connect server.

Get started

The 1Password Connect Go SDK provides access to the 1Password Connect API, to facilitate communication with the Connect server hosted on your infrastructure and 1Password. The library is intended to be used by your applications, pipelines, and other automations to simplify accessing items stored in your 1Password vaults.

โœจ Quickstart

  1. Download and install the 1Password Connect Go SDK:

    go get github.com/1Password/connect-sdk-go
    
  2. Export the OP_CONNECT_HOST and OP_CONNECT_TOKEN environment variables:

    export OP_CONNECT_HOST=<your-connect-host> && \
        export OP_CONNECT_TOKEN=<your-connect-token>
    
  3. Use it in your code

    • Read a secret:

      import "github.com/1Password/connect-sdk-go/connect"
      
      func main () {
          client := connect.NewClientFromEnvironment()
          item, err := client.GetItem("<item-uuid>", "<vault-uuid>")
          if err != nil {
              log.Fatal(err)
          }
      }
      
    • Write a secret:

      import (
          "github.com/1Password/connect-sdk-go/connect"
          "github.com/1Password/connect-sdk-go/onepassword"
      )
      
      func main () {
          client := connect.NewClientFromEnvironment()
          item := &onepassword.Item{
              Title:    "Secret String",
              Category: onepassword.Login,
              Fields: []*onepassword.ItemField{{
                  Value: "mysecret",
                  Type:  "STRING",
              }},
          }
      
          postedItem, err := client.CreateItem(item, "<vault-uuid>")
          if err != nil {
              log.Fatal(err)
          }
      }
      

For more examples, check out USAGE.md.

๐Ÿ’™ Community & Support

๐Ÿ” Security

1Password requests you practice responsible disclosure if you discover a vulnerability.

Please file requests via BugCrowd.

For information about security practices, please visit the 1Password Bug Bounty Program.

Directories ยถ

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL