onepassword

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SignIn

func SignIn(ctx context.Context, account string) (string, error)

Sign in to 1Password, returning the token. In case account doesn't exist, it will prompt for account creation and will login the user.

Types

type Account

type Account struct {
	BaseType
	Domain    string `json:"domain"`
	Type      string `json:"type"`
	State     string `json:"state"`
	CreatedAt string `json:"created_at"`
}

type AuthResponse

type AuthResponse struct {
	URL         string `json:"url"`
	Email       string `json:"email"`
	UserUUID    string `json:"user_uuid"`
	AccountUUID string `json:"account_uuid"`
	Shorthand   string `json:"shorthand"`
}

type BaseType

type BaseType struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type Cli

type Cli struct {
	// contains filtered or unexported fields
}

1Password CLI instance.

func NewCli

func NewCli(token string) *Cli

func (*Cli) AddUserToGroup

func (cli *Cli) AddUserToGroup(ctx context.Context, group, role, user string) error

AddUserToGroup adds user to group.

func (*Cli) AddUserToVault added in v0.0.7

func (cli *Cli) AddUserToVault(ctx context.Context, vault, user, permissions string) error

AddUserToVault adds user to vault.

func (*Cli) GetAccount

func (cli *Cli) GetAccount(ctx context.Context) (Account, error)

GetAccount gets information about the account.

func (*Cli) GetSignedInAccount

func (cli *Cli) GetSignedInAccount(ctx context.Context) (AuthResponse, error)

GetSignedInAccount gets information about the signed in account.

func (*Cli) ListGroupMembers

func (cli *Cli) ListGroupMembers(ctx context.Context, group string) ([]User, error)

ListGroupMembers lists all members of a group.

func (*Cli) ListGroups

func (cli *Cli) ListGroups(ctx context.Context) ([]Group, error)

ListGroups lists all groups in the account.

func (*Cli) ListUsers

func (cli *Cli) ListUsers(ctx context.Context) ([]User, error)

ListUsers lists all users in the account.

func (*Cli) ListVaultGroups

func (cli *Cli) ListVaultGroups(ctx context.Context, vaultId string) ([]Group, error)

ListVaultGroups lists all groups that have access to a vault.

func (*Cli) ListVaultMembers

func (cli *Cli) ListVaultMembers(ctx context.Context, vaultId string) ([]User, error)

ListVaultMembers lists all users that have access to a vault.

func (*Cli) ListVaults

func (cli *Cli) ListVaults(ctx context.Context) ([]Vault, error)

ListVaults lists all vaults in the account.

func (*Cli) RemoveUserFromGroup

func (cli *Cli) RemoveUserFromGroup(ctx context.Context, group, user string) error

RemoveUserFromGroup removes user from group.

func (*Cli) RemoveUserFromVault added in v0.0.7

func (cli *Cli) RemoveUserFromVault(ctx context.Context, vault, user, permissions string) error

RemoveUserFromVault removes user from vault. This will error out if the principal's grant was inherited via a group membership with permissions to the vault. 1Password CLI errors with "the accessor doesn't have any permissions" if the grant is inherited from a group. Avoid mixing group and individual grants to vaults when using just-in-time provisioning.

type Group

type Group struct {
	BaseType
	Description string   `json:"description,omitempty"`
	State       string   `json:"state"`
	CreatedAt   string   `json:"created_at"`
	Permissions []string `json:"permissions,omitempty"`
}

type User

type User struct {
	BaseType
	Email       string   `json:"email"`
	Type        string   `json:"type"`
	State       string   `json:"state"`
	Role        string   `json:"role,omitempty"`
	Permissions []string `json:"permissions,omitempty"`
}

type Vault

type Vault struct {
	BaseType
	ContentVersion int `json:"content_version"`
}

Jump to

Keyboard shortcuts

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