libsecrets

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2017 License: MIT Imports: 17 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(source client.Source, sink client.Sink, interactive bool, force bool) error

Decrypt decrypts data from the source stream to the sink stream

func Encrypt

func Encrypt(source client.Source, sink client.Sink, members []string) error

Encrypt encrypts data from the source stream to the sink stream for the list of provided members

func GetMemberListIdentifiers

func GetMemberListIdentifiers(members []*Member) (identifiers []string)

func RemoveScope

func RemoveScope(name string) (err error)

RemoveScope deletes an existing scope

Types

type BufferSink

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

BufferSink is used to capture Keybase decrypted data

func NewBufferSink

func NewBufferSink() *BufferSink

NewBufferSink returns a new BufferSink

func (*BufferSink) Bytes

func (s *BufferSink) Bytes() []byte

Bytes returns the bytes in the buffer

func (*BufferSink) Close

func (s *BufferSink) Close() error

Close is a stub to fit the Sink interface

func (*BufferSink) HitError

func (s *BufferSink) HitError(e error) error

HitError is a stub to fit the Sink interface

func (*BufferSink) Open

func (s *BufferSink) Open() error

Open is a stub to fit the Sink interface

func (*BufferSink) String

func (s *BufferSink) String() string

String returns the buffer as a string

func (*BufferSink) Write

func (s *BufferSink) Write(b []byte) (n int, err error)

Write writes bytes to an internal buffer

type BufferSource

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

func NewBufferSource

func NewBufferSource(b *[]byte) *BufferSource

func (*BufferSource) Close

func (b *BufferSource) Close() error

Close is a stub to fit the Source interface

func (*BufferSource) CloseWithError

func (b *BufferSource) CloseWithError(error) error

CloseWithError is a stub to fit the Source interface

func (*BufferSource) Open

func (b *BufferSource) Open() error

Open is a stub to fit the Source interface

func (*BufferSource) Read

func (b *BufferSource) Read(p []byte) (n int, err error)

Read lenth p bytes

type ExporterEnv

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

ExporterEnv formats data for environment variable

func NewExporterEnv

func NewExporterEnv(data *map[string]string) *ExporterEnv

NewExporterHuman instantiate a json formater

func (*ExporterEnv) String

func (f *ExporterEnv) String() string

String exports the data

type ExporterHuman

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

ExporterHuman formats data for human consumption

func NewExporterHuman

func NewExporterHuman(data *map[string]string) *ExporterHuman

NewExporterHuman instantiate a json formater

func (*ExporterHuman) String

func (f *ExporterHuman) String() string

String exports the data for humans

type ExporterJSON

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

ExporterJSON formats data as json

func NewExporterJSON

func NewExporterJSON(data *map[string]string) *ExporterJSON

NewExporterJSON instantiate a json formater

func (*ExporterJSON) String

func (f *ExporterJSON) String() string

String exports the scope data in json format

type ExporterYAML

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

ExporterYAML formats data as yaml

func NewExporterYAML

func NewExporterYAML(data *map[string]string) *ExporterYAML

NewExporterYAML instantiate a yaml formater

func (*ExporterYAML) String

func (f *ExporterYAML) String() string

String exports the scope data in yaml format

type Formatter

type Formatter interface {
	String() string
}

type GlobalContext

type GlobalContext struct {
	Log         logger.Logger
	KeybaseUser *keybase1.User
}

GlobalContext stores the application global context

var G *GlobalContext

G is the current global context

func NewGlobalContext

func NewGlobalContext() *GlobalContext

NewGlobalContext initializes a new global context

func (*GlobalContext) CurrentUser

func (g *GlobalContext) CurrentUser() (*keybase1.User, error)

CurrentUser Get the current Keybase User

func (*GlobalContext) Dir

func (g *GlobalContext) Dir() string

Dir returns the directory where the secrets should be stored

func (*GlobalContext) DirExists

func (g *GlobalContext) DirExists() bool

DirExists does the secret directory exist?

func (*GlobalContext) Init

func (g *GlobalContext) Init()

Init Initializes the secrets app

func (*GlobalContext) LogError

func (g *GlobalContext) LogError(err error)

type ImportOptions

type ImportOptions struct {
	Format string
	// contains filtered or unexported fields
}

ImportOptions is a set of options for importing secrets

type Importer

type Importer interface {
	Parse(data string) (map[string]interface{}, error)
}

type ImporterJSON

type ImporterJSON struct {
	Options ImportOptions
}

ParserJSON parse's data from json

func NewImporterJSON

func NewImporterJSON(options ImportOptions) *ImporterJSON

func (*ImporterJSON) Parse

func (f *ImporterJSON) Parse(data string) (map[string]interface{}, error)

Parse converts the raw json to a structured data

type ImporterYAML

type ImporterYAML struct {
	Options ImportOptions
}

ParserJSON parse's data from json

func NewImporterYAML

func NewImporterYAML(options ImportOptions) *ImporterYAML

func (*ImporterYAML) Parse

func (f *ImporterYAML) Parse(data string) (map[string]interface{}, error)

Parse converts the raw yaml to a structured data

type Member

type Member struct {
	Identifier string
	Type       string
	KeybaseUid keybase1.UID
	AddedBy    string
	DateAdded  time.Time
}

Member is a secret member

func NewKeybaseMember

func NewKeybaseMember(username string, uid keybase1.UID) *Member

NewMember instantiate a scope struct

func NewMemberFromKeybaseUser

func NewMemberFromKeybaseUser(user *keybase1.User) *Member

NewMemberFromKeybaseUser Creates a member from a Keybase User type

type SaltpackUI

type SaltpackUI struct {
	libkb.Contextified
	// contains filtered or unexported fields
}

func (*SaltpackUI) SaltpackPromptForDecrypt

func (s *SaltpackUI) SaltpackPromptForDecrypt(_ context.Context, arg keybase1.SaltpackPromptForDecryptArg) (err error)

func (*SaltpackUI) SaltpackVerifySuccess

func (s *SaltpackUI) SaltpackVerifySuccess(_ context.Context, arg keybase1.SaltpackVerifySuccessArg) error

type Scope

type Scope struct {
	Name    string
	Members []Member
	Data    map[string]string
}

Scope encapsulates a logical set of secrets

func CreateScope

func CreateScope(name string) (scope *Scope, err error)

CreateScope creates a new Scope and saves it to disk.

func GetScope

func GetScope(name string) (scope *Scope, err error)

GetScope returns an existing Scope

func NewScope

func NewScope(name string) (scope *Scope)

NewScope instantiates a Scope struct. If the Scope already exists then creation will fail. In that case use `GetScope`.

func (*Scope) AddMembers

func (s *Scope) AddMembers(members []*Member, adder *Member) []*Member

AddMembers adds a list of members to the Scope

func (*Scope) Del

func (s *Scope) Del(key string)

Del deletes a secret from a Scope

func (*Scope) Exists

func (s *Scope) Exists() bool

Exists returns whether a Scope exists on disk

func (*Scope) Export

func (s *Scope) Export(format string) (string, error)

Export returns this Scope's data in the requested format

func (*Scope) Get

func (s *Scope) Get(key string) string

Get returns a secret from a Scope

func (*Scope) Import

func (s *Scope) Import(contents string, options ImportOptions) error

Import adds `contents` to the Scope with the given options

func (*Scope) KeybaseSinkPath

func (s *Scope) KeybaseSinkPath() string

KeybaseSinkPath is the location of the keybase encryption

func (*Scope) Load

func (s *Scope) Load() error

Load reads the secret scope from disk

func (*Scope) MemberExists

func (s *Scope) MemberExists(identifier string) bool

MemberExists tests if a member already exists in this scope

func (*Scope) MemberPointers

func (s *Scope) MemberPointers() (members []*Member)

MemberPointers returns a list with pointers to the members in this scope

func (*Scope) Path

func (s *Scope) Path() string

Path returns the file path of the secret file

func (*Scope) RemoveMembersByIdentifiers

func (s *Scope) RemoveMembersByIdentifiers(members []string) []*Member

RemoveMembersByIdentifiers removes members from a Scope

func (*Scope) Save

func (s *Scope) Save() error

Save writes the secret scope to disk

func (*Scope) Set

func (s *Scope) Set(key string, value string)

Set returns a secret from a Scope

func (*Scope) ToJSON

func (s *Scope) ToJSON() ([]byte, error)

ToJSON converts this scope to json

type StreamFilter

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

StreamFilter manages the input and output streams.

func NewStreamFilter

func NewStreamFilter(source client.Source, sink client.Sink) *StreamFilter

NewStreamFilter creates a new StreamFilter

func (*StreamFilter) ClientOpen

func (s *StreamFilter) ClientOpen() (snk, src keybase1.Stream, err error)

ClientOpen Connect the input and output streams with the Keybase client

func (*StreamFilter) Close

func (s *StreamFilter) Close(inerr error) error

Close the streams

func (*StreamFilter) Open

func (s *StreamFilter) Open() error

Open the streams for read and write

Jump to

Keyboard shortcuts

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