README
¶
POSH 1Password provider
Integrates 1Password into your shell and adds helpers for your commands.
Help
1Password session helper.
Usage:
op [command]
Available commands:
get [id] Retrieve an entry from your account
signin Sign into your 1Password account for the session
register [email] Add your 1Password account
Usage
Plugin
package plugin
type Plugin struct {
l log.Logger
oo *onepassword.OnePassword
cacche cache.Cache
commands command.Commands
}
func New(l log.Logger) (plugin.Plugin, error) {
inst := &Plugin{
l: l,
cache: cache.MemoryCache{},
commands: command.Commands{},
}
// ...
inst.op, err := onepassword.New(l, inst.cache));
if err != nil {
return nil, errors.Wrap(err, "failed to create onepassword")
}
// ...
inst.commands.MustAdd(onepassword.NewCommand(l, onePassword))
// ...
return inst, nil
}
Config
Add this to your '.posh.yml' file:
onePassword:
account: <ACCOUNT>
tokenFilename: .posh/config/.op
To add a requirement check for op, add:
require:
scripts:
- name: op
command: |
[[ $(op account --account <ACCOUNT> get 2>&1) =~ "found no account" ]] && exit 1 || exit 0
help: |
You're 1Password account is not registered yet! Please do so by running:
$ op account add --address <ACCOUNT>.1password.eu --email <EMAIL>
packages:
- name: op
version: '~2'
command: op --version
help: |
Please ensure you have the 1Password cli 'op' installed in the required version: %s!
$ brew update
$ brew install 1password-cli
Documentation
¶
Index ¶
- Variables
- func AuthChecker(p *OnePassword) check.Checker
- type Command
- func (c *Command) Complete(ctx context.Context, r *readline.Readline) []goprompt.Suggest
- func (c *Command) Description() string
- func (c *Command) Execute(ctx context.Context, r *readline.Readline) error
- func (c *Command) Help(ctx context.Context, r *readline.Readline) string
- func (c *Command) Name() string
- type CommandOption
- type Config
- type OnePassword
- func (op *OnePassword) Get(ctx context.Context, secret Secret) (string, error)
- func (op *OnePassword) GetDocument(ctx context.Context, secret Secret) (string, error)
- func (op *OnePassword) GetOnetimePassword(ctx context.Context, account, uuid string) (string, error)
- func (op *OnePassword) IsAuthenticated(ctx context.Context) (bool, error)
- func (op *OnePassword) Render(ctx context.Context, source string) ([]byte, error)
- func (op *OnePassword) RenderFile(ctx context.Context, source string) ([]byte, error)
- func (op *OnePassword) RenderFileTo(ctx context.Context, source, target string) error
- func (op *OnePassword) SignIn(ctx context.Context) error
- type Option
- type Secret
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotSignedIn = errors.New("you're not signed into your 1password account")
Functions ¶
func AuthChecker ¶ added in v0.3.0
func AuthChecker(p *OnePassword) check.Checker
Types ¶
type Command ¶
type Command struct {
// contains filtered or unexported fields
}
func NewCommand ¶
func NewCommand(l log.Logger, op *OnePassword, opts ...CommandOption) (*Command, error)
func (*Command) Description ¶
type CommandOption ¶
func CommandWithName ¶ added in v0.3.3
func CommandWithName(v string) CommandOption
type OnePassword ¶
type OnePassword struct {
// contains filtered or unexported fields
}
func (*OnePassword) GetDocument ¶ added in v0.1.0
func (*OnePassword) GetOnetimePassword ¶
func (*OnePassword) IsAuthenticated ¶ added in v0.3.0
func (op *OnePassword) IsAuthenticated(ctx context.Context) (bool, error)
func (*OnePassword) RenderFile ¶
func (*OnePassword) RenderFileTo ¶
func (op *OnePassword) RenderFileTo(ctx context.Context, source, target string) error
Click to show internal directories.
Click to hide internal directories.