onepassword

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2020 License: MIT Imports: 12 Imported by: 0

README

Codefresh build status Go Report Card

1Password Client

Thin wrapper around the 1Password CLI for use in Golang.

This is a stub and should not be used in production.

Hopefully 1Password creates their own client library. See discussion.

Usage

First install the 1Password CLI.

Import the package, create a client, and retrieve an item.

import (
    "os"

    op "github.com/ameier38/onepassword"
)

func main() {
    password := os.GetEnv("OP_PASSWORD")
    secretKey := os.GetEnv("OP_SECRET_KEY")
    client := op.NewClient("op", "subdomain", "test@subdomain.com", password, secretKey)
    item := client.GetItem(VaultName("test-vault"), ItemName("test-item"))
}

Resources

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	OpPath    string
	Subdomain string
	Email     string
	Password  string
	SecretKey string
	Session   string
	// contains filtered or unexported fields
}

Client : 1Password client

func NewClient

func NewClient(opPath string, subdomain string, email string, password string, secretKey string) (*Client, error)

func (Client) GetDocument

func (op Client) GetDocument(vault VaultName, docName DocumentName) (DocumentValue, error)

Calls `op get document` command usage: op get document <document> [--vault=<vault>] [--session=<session>]

func (Client) GetItem

func (op Client) GetItem(vault VaultName, item ItemName) (ItemMap, error)

Calls `op get item` command. usage: op get item <item> [--vault=<vault>] [--session=<session>]

type DocumentName

type DocumentName string

type DocumentValue

type DocumentValue string

type FieldMap

type FieldMap map[FieldName]FieldValue

type FieldName

type FieldName string

type FieldValue

type FieldValue string

type ItemMap

type ItemMap map[SectionName]FieldMap

type ItemName

type ItemName string

type SectionName

type SectionName string

type VaultName

type VaultName string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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