onepass

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2017 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt added in v0.3.0

func Decrypt(key []byte, iv []byte, ciphertext []byte) ([]byte, error)

func Encrypt added in v0.3.0

func Encrypt(key []byte, iv []byte, plaintext []byte) ([]byte, error)

func EnsureDir added in v0.3.0

func EnsureDir(ensurePath string) error

func Exists added in v0.3.0

func Exists(testPath string) (bool, error)

func GenerateRandomBytes added in v0.3.0

func GenerateRandomBytes(n int) ([]byte, error)

GenerateRandomBytes returns securely generated random bytes. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.

func HmacSha256 added in v0.3.0

func HmacSha256(key []byte, dataToSign ...[]byte) []byte

func Pkcs7Pad added in v0.3.0

func Pkcs7Pad(data []byte, blocklen int) ([]byte, error)

Pkcs7Pad Appends padding.

func Pkcs7Unpad added in v0.3.0

func Pkcs7Unpad(data []byte, blocklen int) ([]byte, error)

Pkcs7Unpad Returns slice of the original data without padding.

Types

type Command

type Command struct {
	Action   string  `json:"action"`
	Number   int     `json:"number,omitempty"`
	Version  string  `json:"version,omitempty"`
	BundleID string  `json:"bundleId,omitempty"`
	Payload  Payload `json:"payload"`
}

type Configuration

type Configuration struct {
	WebsocketURI      string `json:"websocketUri"`
	WebsocketProtocol string `json:"websocketProtocol"`
	WebsocketOrigin   string `json:"websocketOrigin"`
	DefaultHost       string `json:"defaultHost"`
	StateDirectory    string `json:"stateDirectory"`
}

Configuration struct

type Item added in v0.3.0

type Item interface {
	GetPassword() (string, error)
}

type LoginItem added in v0.3.0

type LoginItem struct {
	UUID           string                  `json:"uuid"`
	NakedDomains   []string                `json:"nakedDomains"`
	Overview       map[string]interface{}  `json:"overview"`
	SecureContents LoginItemSecureContents `json:"secureContents"`
}

func (LoginItem) GetPassword added in v0.3.0

func (item LoginItem) GetPassword() (string, error)

type LoginItemSecureContents added in v0.3.0

type LoginItemSecureContents struct {
	HTMLForm map[string]interface{} `json:"htmlForm"`
	Fields   []map[string]string    `json:"fields"`
}

type OnePasswordClient

type OnePasswordClient struct {
	DefaultHost string

	StateDirectory string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(websocketURI string, websocketProtocol string, websocketOrigin string, defaultHost string, stateDirectory string) (*OnePasswordClient, error)

func NewClientWithConfig

func NewClientWithConfig(configuration *Configuration) (*OnePasswordClient, error)

func NewCustomClient

func NewCustomClient(websocketClient WebsocketClient, defaultHost string, stateDirectory string) (*OnePasswordClient, error)

func (*OnePasswordClient) Authenticate added in v0.3.0

func (client *OnePasswordClient) Authenticate(register bool) (*Response, error)

func (*OnePasswordClient) Connect

func (client *OnePasswordClient) Connect() error

func (*OnePasswordClient) Debug added in v0.3.0

func (client *OnePasswordClient) Debug(secretB64 string, csB64 string, ccB64 string, m3B64 string, m4B64 string, encKB64 string, hmacKB64 string, ivB64 string, plaintext string, adata string, ciphertextB64 string, hmacB64 string)

func (*OnePasswordClient) LoadOrSetupState added in v0.3.0

func (client *OnePasswordClient) LoadOrSetupState() error

func (*OnePasswordClient) ReceiveJSON added in v0.3.0

func (client *OnePasswordClient) ReceiveJSON() (*Response, error)

func (*OnePasswordClient) Register added in v0.3.0

func (client *OnePasswordClient) Register(code string) (*Response, error)

func (*OnePasswordClient) SendCommand

func (client *OnePasswordClient) SendCommand(command *Command) (*Response, error)

func (*OnePasswordClient) SendEncryptedCommand added in v0.3.0

func (client *OnePasswordClient) SendEncryptedCommand(command *Command) (*Response, error)

func (*OnePasswordClient) SendHelloCommand

func (client *OnePasswordClient) SendHelloCommand() (*Response, error)

func (*OnePasswordClient) SendJSON added in v0.3.0

func (client *OnePasswordClient) SendJSON(jsonStr []byte) error

func (*OnePasswordClient) SendShowPopupCommand

func (client *OnePasswordClient) SendShowPopupCommand() (*Response, error)

type PasswordItem added in v0.3.0

type PasswordItem struct {
	UUID           string                     `json:"uuid"`
	Overview       map[string]interface{}     `json:"overview"`
	SecureContents PasswordItemSecureContents `json:"secureContents"`
}

func (PasswordItem) GetPassword added in v0.3.0

func (item PasswordItem) GetPassword() (string, error)

type PasswordItemSecureContents added in v0.3.0

type PasswordItemSecureContents struct {
	Password string `json:"password"`
}

type Payload

type Payload struct {
	Version      string            `json:"version,omitempty"`
	ExtID        string            `json:"extId,omitempty"`
	Method       string            `json:"method,omitempty"`
	Secret       string            `json:"secret,omitempty"`
	Capabilities []string          `json:"capabilities,omitempty"`
	URL          string            `json:"url,omitempty"`
	Options      map[string]string `json:"options,omitempty"`
	CC           string            `json:"cc,omitempty"`
	CS           string            `json:"cs,omitempty"`
	M4           string            `json:"M4,omitempty"`
	M3           string            `json:"M3,omitempty"`
	Algorithm    string            `json:"alg,omitempty"`
	Iv           string            `json:"iv,omitempty"`
	Data         string            `json:"data,omitempty"`
	Hmac         string            `json:"hmac,omitempty"`
}

type Response

type Response struct {
	Action  string          `json:"action"`
	Version string          `json:"version"`
	Payload ResponsePayload `json:"payload"`
}

func LoadResponse

func LoadResponse(rawResponseStr string) (*Response, error)

func (*Response) GetPassword

func (response *Response) GetPassword() (string, error)

type ResponsePayload

type ResponsePayload struct {
	Item           *json.RawMessage       `json:"item"`
	Algorithm      string                 `json:"alg"`
	Method         string                 `json:"method"`
	Code           string                 `json:"code"`
	Data           string                 `json:"data"`
	Hmac           string                 `json:"hmac"`
	Iv             string                 `json:"iv"`
	M3             string                 `json:"m3"`
	CS             string                 `json:"cs"`
	AssociatedData string                 `json:"adata"`
	Options        map[string]interface{} `json:"options"`
	OpenInTabMode  string                 `json:"openInTabMode"`
	Action         string                 `json:"action"`
}

type StateFileConfig added in v0.3.0

type StateFileConfig struct {
	Secret string `json:"secret"`
	ExtID  string `json:"extID"`
}

type WebsocketClient

type WebsocketClient interface {
	Connect() error
	Receive(v interface{}) error
	Send(v interface{}) error
}

Jump to

Keyboard shortcuts

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