Skip to content
This repository has been archived by the owner on Jun 6, 2022. It is now read-only.

Commit

Permalink
Make golint happy
Browse files Browse the repository at this point in the history
  • Loading branch information
brycekahle committed Aug 30, 2017
1 parent d76be63 commit dad4575
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
10 changes: 5 additions & 5 deletions onepass/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ func NewClientWithConfig(configuration *Configuration) (*OnePasswordClient, erro
return NewClient(configuration.WebsocketURI, configuration.WebsocketProtocol, configuration.WebsocketOrigin, configuration.DefaultHost, configuration.StateDirectory)
}

func NewClient(websocketUri string, websocketProtocol string, websocketOrigin string, defaultHost string, stateDirectory string) (*OnePasswordClient, error) {
websocketClient := websocketclient.NewClient(websocketUri, websocketProtocol, websocketOrigin)
func NewClient(websocketURI string, websocketProtocol string, websocketOrigin string, defaultHost string, stateDirectory string) (*OnePasswordClient, error) {
websocketClient := websocketclient.NewClient(websocketURI, websocketProtocol, websocketOrigin)

return NewCustomClient(websocketClient, defaultHost, stateDirectory)
}
Expand Down Expand Up @@ -223,7 +223,7 @@ func (client *OnePasswordClient) createCommand(action string, payload Payload) *

// Increment the number (it's a 1password thing that I saw whilst listening
// to their commands
client.number += 1
client.number++
return &command
}

Expand Down Expand Up @@ -544,14 +544,14 @@ func (client *OnePasswordClient) encryptPayload(payload *Payload) (*Payload, err
}

// Encrypt the payload
payloadJsonStr, err := json.Marshal(payload)
payloadJSONStr, err := json.Marshal(payload)

if err != nil {
return nil, err
}

// Encrypt the payload
encryptedPayload, err := Encrypt(client.sessionEncK, iv, payloadJsonStr)
encryptedPayload, err := Encrypt(client.sessionEncK, iv, payloadJSONStr)

encryptedPayloadB64 := client.base64urlWithoutPadding.EncodeToString(encryptedPayload)

Expand Down
14 changes: 7 additions & 7 deletions onepass/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,29 +65,29 @@ type Item interface {
}

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

func (item LoginItem) GetPassword() (string, error) {
for _, field_obj := range item.SecureContents.Fields {
if field_obj["designation"] == "password" {
return field_obj["value"], nil
for _, fieldObj := range item.SecureContents.Fields {
if fieldObj["designation"] == "password" {
return fieldObj["value"], nil
}
}

return "", errors.New("No password found in the item.")
return "", errors.New("no password found in the item")
}

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

type PasswordItem struct {
Uuid string `json:"uuid"`
UUID string `json:"uuid"`
Overview map[string]interface{} `json:"overview"`
SecureContents PasswordItemSecureContents `json:"secureContents"`
}
Expand Down
4 changes: 2 additions & 2 deletions onepass/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func GenerateRandomBytes(n int) ([]byte, error) {
return b, nil
}

// Appends padding.
// Pkcs7Pad Appends padding.
func Pkcs7Pad(data []byte, blocklen int) ([]byte, error) {
if blocklen <= 0 {
return nil, fmt.Errorf("invalid blocklen %d", blocklen)
Expand All @@ -65,7 +65,7 @@ func Pkcs7Pad(data []byte, blocklen int) ([]byte, error) {
return append(data, pad...), nil
}

// Returns slice of the original data without padding.
// Pkcs7Unpad Returns slice of the original data without padding.
func Pkcs7Unpad(data []byte, blocklen int) ([]byte, error) {
if blocklen <= 0 {
return nil, fmt.Errorf("invalid blocklen %d", blocklen)
Expand Down
14 changes: 7 additions & 7 deletions websocketclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,25 @@ type Codec interface {
Send(*ws.Conn, interface{}) error
}

// A websocket client meant to be used with the 1password
// Client is a websocket client meant to be used with the 1password
type Client struct {
WebsocketUri string
WebsocketURI string
WebsocketProtocol string
WebsocketOrigin string
conn *ws.Conn
dial func(string, string, string) (*ws.Conn, error)
codec Codec
}

func NewClient(websocketUri string, websocketProtocol string, websocketOrigin string) *Client {
return NewCustomClient(websocketUri, websocketProtocol, websocketOrigin, ws.Dial, ws.Message)
func NewClient(websocketURI string, websocketProtocol string, websocketOrigin string) *Client {
return NewCustomClient(websocketURI, websocketProtocol, websocketOrigin, ws.Dial, ws.Message)
}

func NewCustomClient(websocketUri string, websocketProtocol string, websocketOrigin string,
func NewCustomClient(websocketURI string, websocketProtocol string, websocketOrigin string,
dial func(string, string, string) (*ws.Conn, error), codec Codec) *Client {

client := Client{
WebsocketUri: websocketUri,
WebsocketURI: websocketURI,
WebsocketProtocol: websocketProtocol,
WebsocketOrigin: websocketOrigin,
dial: dial,
Expand All @@ -38,7 +38,7 @@ func NewCustomClient(websocketUri string, websocketProtocol string, websocketOri
}

func (client *Client) Connect() error {
conn, err := client.dial(client.WebsocketUri, client.WebsocketProtocol, client.WebsocketOrigin)
conn, err := client.dial(client.WebsocketURI, client.WebsocketProtocol, client.WebsocketOrigin)

if err != nil {
return err
Expand Down

0 comments on commit dad4575

Please sign in to comment.