Skip to content

Commit

Permalink
go fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
while-loop committed Oct 12, 2017
1 parent 1a51cdd commit 529721f
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions account.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package lastpass

import (
"fmt"
"github.com/pkg/errors"
lcrypt "github.com/while-loop/lastpass-go/internal/crypt"
"net/url"
"github.com/pkg/errors"
)

type Account struct {
Expand All @@ -21,7 +21,7 @@ func (a Account) String() string {
return fmt.Sprintf("Id: %s, Name: %s, Username: %s", a.Id, a.Name, a.Username)
}

func (a Account) encrypt(key []byte) (*url.Values ,error){
func (a Account) encrypt(key []byte) (*url.Values, error) {
//Id plain
//Name aes & b64
//Username aes & b64
Expand Down
4 changes: 2 additions & 2 deletions internal/crypt/aes.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package crypt

import (
"bytes"
"crypto/aes"
"crypto/cipher"
"io"
"crypto/rand"
"bytes"
"github.com/pkg/errors"
"io"
)

func Decrypt_aes256_cbc_plain(data []byte, encryptionKey []byte) ([]byte, error) {
Expand Down
6 changes: 3 additions & 3 deletions internal/crypt/aes_test.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package crypt

import (
"testing"
"crypto/aes"
"crypto/sha256"
"github.com/stretchr/testify/assert"
"crypto/aes"
"testing"
)

func TestEncrypt_aes256_cbc(t *testing.T) {
key, err := DecodeHex([]byte("05d49692b755f99c45012310418efeeeebfd466892540f27acf9a31a326d6123"))
assert.NoError(t, err)
assert.Equal(t, sha256.Size, len(key))

iv, err:= DecodeHex([]byte("a07c8d27359fdf50c66675c3e07bd5e1"))
iv, err := DecodeHex([]byte("a07c8d27359fdf50c66675c3e07bd5e1"))
assert.NoError(t, err)
assert.Equal(t, len(iv), aes.BlockSize)

Expand Down
4 changes: 2 additions & 2 deletions internal/crypt/ecb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package crypt

import (
"crypto/aes"
"testing"
"github.com/stretchr/testify/assert"
"testing"
)

func TestNewECBEncryptor(t *testing.T) {
Expand Down Expand Up @@ -31,7 +31,7 @@ func TestNewECBDecryptor(t *testing.T) {
test := make([]byte, len(ciphertext))

//when
dec:= NewECBDecrypter(block)
dec := NewECBDecrypter(block)
dec.CryptBlocks(test, ciphertext)

assert.Equal(t, block.BlockSize(), dec.BlockSize())
Expand Down
6 changes: 3 additions & 3 deletions internal/crypt/encoding.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package crypt

import (
"encoding/base64"
"bytes"
"encoding/hex"
"crypto/aes"
"encoding/base64"
"encoding/hex"
"fmt"
"github.com/pkg/errors"
)
Expand All @@ -28,7 +28,7 @@ func intBase64Encode(data []byte) []byte {

if dLen >= 33 && data[0] == '!' && dLen%16 == 1 {
// "!%s|%s"
iv := Base64Encode(data[1:aes.BlockSize+1])
iv := Base64Encode(data[1 : aes.BlockSize+1])
d := Base64Encode(data[1+aes.BlockSize:])
return []byte(fmt.Sprintf("!%s|%s", iv, d))
}
Expand Down
2 changes: 1 addition & 1 deletion internal/crypt/encoding_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package crypt

import (
"testing"
"bytes"
"github.com/stretchr/testify/assert"
"testing"
)

func TestIntBase64Encode(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"crypto/sha256"
"encoding/binary"
"fmt"
"github.com/pkg/errors"
lcrypt "github.com/while-loop/lastpass-go/internal/crypt"
"io"
"github.com/pkg/errors"
)

func chunkIdFromBytes(b [4]byte) uint32 {
Expand Down
4 changes: 2 additions & 2 deletions vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"bytes"
"encoding/xml"
"fmt"
"github.com/pkg/errors"
"io"
"net/url"
"strings"
"github.com/pkg/errors"
)

var (
Expand Down Expand Up @@ -160,7 +160,7 @@ func (lp *Vault) upsertAccount(account *Account) (string, error) {
if err != nil {
return "", errors.Wrap(err, "failed to encrypt account")
}
return post(bUrl, lp.sesh,vals)
return post(bUrl, lp.sesh, vals)
}

// DeleteAccount removes an account from the LastPass vault
Expand Down
4 changes: 2 additions & 2 deletions vault_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package lastpass

import (
"github.com/stretchr/testify/assert"
"testing"
"os"
"testing"
)

const (
Expand Down Expand Up @@ -40,7 +40,7 @@ func TestCRUD(t *testing.T) {
"site1": {Name: "site1", Username: "[email protected]", Password: "site1", Url: "site1.com"},
"site2": {Name: "site2", Username: "[email protected]", Password: "site2", Url: "site2.com"},
"site3": {Name: "site3", Username: "[email protected]", Password: "site3", Url: "site2.com"},
}
}

lp, err := New(config.email, config.password)
assert.NoError(t, err)
Expand Down

0 comments on commit 529721f

Please sign in to comment.