Skip to content

Commit 15d0c70

Browse files
committed
Merge branch 'feature/use_standard_project_layout' into develop
2 parents 7ff8299 + 9db58b8 commit 15d0c70

36 files changed

+47
-28
lines changed

cmd/trousseau/before.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package main
22

33
import (
4-
"github.com/oleiade/trousseau"
4+
"github.com/oleiade/trousseau/internal/trousseau"
55
"github.com/urfave/cli"
66
)
77

cmd/trousseau/commands.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"os"
77
"path/filepath"
88

9-
"github.com/oleiade/trousseau"
9+
"github.com/oleiade/trousseau/internal/trousseau"
1010
"github.com/urfave/cli"
1111
)
1212

cmd/trousseau/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package main
33
import (
44
"os"
55

6-
"github.com/oleiade/trousseau"
6+
"github.com/oleiade/trousseau/internal/trousseau"
77
"github.com/urfave/cli"
88
)
99

go.mod

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ require (
99
github.com/google/go-querystring v0.0.0-20160401233042-9235644dd9e5
1010
github.com/guelfey/go.dbus v0.0.0-20131113121618-f6a3a2366cc3
1111
github.com/howeyc/gopass v0.0.0-20160803164817-b63a7d07e65d
12+
github.com/kr/pretty v0.1.0 // indirect
1213
github.com/oleiade/reflections v0.0.0-20131121131850-632977f98cd3
1314
github.com/oleiade/serrure v0.0.0-20160812094227-28794589ac9b
1415
github.com/oleiade/tempura v0.0.0-20140528162001-1e4f5790d506
@@ -19,4 +20,5 @@ require (
1920
golang.org/x/crypto v0.0.0-20160812214243-6c932297e160
2021
golang.org/x/net v0.0.0-20160811235142-07b51741c1d6
2122
golang.org/x/oauth2 v0.0.0-20160810173516-4784bb855e56
23+
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
2224
)

go.sum

+11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
github.com/crowdmob/goamz v0.0.0-20150128194925-3a06871fe9fc h1:Gn/roShKxUNtNYEEH+ZeGxMJ+RsCBZdIdb8pKOesTaA=
22
github.com/crowdmob/goamz v0.0.0-20150128194925-3a06871fe9fc/go.mod h1:4zrXGiIhmCfgVUO6nJpSa9QVXylPKBYkLa179m59HzE=
3+
github.com/davecgh/go-spew v0.0.0-20151105211317-5215b55f46b2 h1:5zdDAMuB3gvbHB1m2BZT9+t9w+xaBmK3ehb7skDXcwM=
34
github.com/davecgh/go-spew v0.0.0-20151105211317-5215b55f46b2/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
45
github.com/google/go-github v0.0.0-20160802180827-56add9d4071b h1:RqHoi09dHniK/7ZOXEgPoXGQDxteuNCMD09OEgOJllQ=
56
github.com/google/go-github v0.0.0-20160802180827-56add9d4071b/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ=
@@ -8,12 +9,20 @@ github.com/google/go-querystring v0.0.0-20160401233042-9235644dd9e5/go.mod h1:od
89
github.com/guelfey/go.dbus v0.0.0-20131113121618-f6a3a2366cc3/go.mod h1:0CNX5Cvi77WEH8llpfZ/ieuqyceb1cnO5//b5zzsnF8=
910
github.com/howeyc/gopass v0.0.0-20160803164817-b63a7d07e65d h1:QSXZhkCwA1j3WbSVEnxB+9sPsuthBgvpi4BUTaYPc6E=
1011
github.com/howeyc/gopass v0.0.0-20160803164817-b63a7d07e65d/go.mod h1:lADxMC39cJJqL93Duh1xhAs4I2Zs8mKS89XWXFGp9cs=
12+
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
13+
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
14+
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
15+
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
16+
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
1117
github.com/oleiade/reflections v0.0.0-20131121131850-632977f98cd3 h1:shfb0dwW+oUvt8GjdLeitj0PpE4hw9mN6WXZ4OAf9DY=
1218
github.com/oleiade/reflections v0.0.0-20131121131850-632977f98cd3/go.mod h1:RbATFBbKYkVdqmSFtx13Bb/tVhR0lgOBXunWTZKeL4w=
1319
github.com/oleiade/serrure v0.0.0-20160812094227-28794589ac9b h1:3D0HyVLogm3spti98Jp9tRAEkgLq0dzLVVNcTD6/DxA=
1420
github.com/oleiade/serrure v0.0.0-20160812094227-28794589ac9b/go.mod h1:mPec4DPLMKWSD0cuiTXUDLe6W96ERayhfXz8QAVq2Sc=
21+
github.com/oleiade/tempura v0.0.0-20140528162001-1e4f5790d506 h1:M7Y+MexyOaIR9jhUJ0L0Ubi1hvyl1Zf/HNj2MCluegQ=
1522
github.com/oleiade/tempura v0.0.0-20140528162001-1e4f5790d506/go.mod h1:ntxgn8lHBBO3Id3152amVvKq3HdvNRIOX3IT6AxMHZc=
23+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
1624
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
25+
github.com/stretchr/testify v0.0.0-20160615092844-d77da356e56a h1:VxiXq5jE8Z1dkOLZxIb+6JaOOok04E8ZWos4rsRSlzw=
1726
github.com/stretchr/testify v0.0.0-20160615092844-d77da356e56a/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
1827
github.com/tmc/keyring v0.0.0-20160307194037-adec3bef79f7 h1:WhLeVc9Ces9elO8LWkwY4eI8WLE2yc1uDZ2WW2RJsbU=
1928
github.com/tmc/keyring v0.0.0-20160307194037-adec3bef79f7/go.mod h1:gsa3jftQ3xia55nzIN4lXLYzDcWdxjojdKoz+N0St2Y=
@@ -25,3 +34,5 @@ golang.org/x/net v0.0.0-20160811235142-07b51741c1d6 h1:A/+8dHDavelB1CB3VF5cdxIxp
2534
golang.org/x/net v0.0.0-20160811235142-07b51741c1d6/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
2635
golang.org/x/oauth2 v0.0.0-20160810173516-4784bb855e56 h1:HiiJye4gG8Fcv2Y07oKLC/LLoWZ2DWq9d/hBK0B+aSY=
2736
golang.org/x/oauth2 v0.0.0-20160810173516-4784bb855e56/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
37+
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
38+
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

kv.go internal/store/kv.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package trousseau
1+
package store
22

33
import (
44
"errors"

kv_test.go internal/store/kv_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package trousseau
1+
package store
22

33
import (
44
"testing"

meta.go internal/store/meta.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package trousseau
1+
package store
22

33
import (
44
"errors"

store.go internal/store/store.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package trousseau
1+
package store
22

33
type Store struct {
44
Meta Meta `json:"meta"`

actions.go internal/trousseau/actions.go

+6-4
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,19 @@ import (
1010
"os"
1111
"strings"
1212

13-
"github.com/oleiade/trousseau/dsn"
13+
"github.com/oleiade/trousseau/internal/store"
14+
15+
"github.com/oleiade/trousseau/pkg/dsn"
1416
)
1517

1618
func CreateAction(ct CryptoType, ca CryptoAlgorithm, recipients []string) error {
17-
meta := Meta{
19+
meta := store.Meta{
1820
CreatedAt: time.Now().String(),
1921
LastModifiedAt: time.Now().String(),
2022
Recipients: recipients,
2123
TrousseauVersion: TROUSSEAU_VERSION,
2224
}
23-
store := NewStore(meta)
25+
store := store.NewStore(meta)
2426

2527
tr := Trousseau{
2628
CryptoType: ct,
@@ -182,7 +184,7 @@ func ExportAction(destination io.Writer, plain bool) error {
182184
func ImportAction(source io.Reader, strategy ImportStrategy, plain bool) error {
183185
var data []byte
184186
var err error
185-
var importedStore *Store = &Store{}
187+
var importedStore *store.Store = &store.Store{}
186188
var localFilePath string = InferStorePath()
187189

188190
localTr, err := OpenTrousseau(localFilePath)
File renamed without changes.
File renamed without changes.

context.go internal/trousseau/context.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"os"
66
"path/filepath"
77

8+
"github.com/oleiade/trousseau/pkg/gpgagent"
89
"github.com/tmc/keyring"
910
)
1011

@@ -102,12 +103,12 @@ func GetPassphrase() (passphrase string, err error) {
102103
}
103104

104105
func getGpgPassphrase(gpgId string) (string, error) {
105-
conn, err := NewGpgAgentConn()
106+
conn, err := gpgagent.NewGpgAgentConn()
106107
if err != nil {
107108
return "", err
108109
}
109110

110-
passphraseRequest := &PassphraseRequest{CacheKey: gpgId}
111+
passphraseRequest := &gpgagent.PassphraseRequest{CacheKey: gpgId}
111112
passphrase, err := conn.GetPassphrase(passphraseRequest)
112113
if err != nil {
113114
return "", err
File renamed without changes.

download.go internal/trousseau/download.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import (
44
"fmt"
55

66
"github.com/crowdmob/goamz/aws"
7-
"github.com/oleiade/trousseau/dsn"
8-
"github.com/oleiade/trousseau/remote/gist"
9-
"github.com/oleiade/trousseau/remote/s3"
10-
"github.com/oleiade/trousseau/remote/ssh"
7+
"github.com/oleiade/trousseau/pkg/dsn"
8+
"github.com/oleiade/trousseau/pkg/remote/gist"
9+
"github.com/oleiade/trousseau/pkg/remote/s3"
10+
"github.com/oleiade/trousseau/pkg/remote/ssh"
1111
)
1212

1313
// downloadUsingS3 executes the whole process of pulling

import.go internal/trousseau/import.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ package trousseau
33
import (
44
"fmt"
55

6+
"github.com/oleiade/trousseau/internal/store"
67
"github.com/urfave/cli"
78
)
89

910
type ImportStrategy uint32
1011

1112
// ImportStore imports the src encrypted data store content
1213
// into dest data store, respecting the provided import strategy.
13-
func ImportStore(src, dest *Store, strategy ImportStrategy) error {
14+
func ImportStore(src, dest *store.Store, strategy ImportStrategy) error {
1415
switch strategy {
1516
case IMPORT_YOURS:
1617
for key, value := range src.Data {
File renamed without changes.
File renamed without changes.

trousseau.go internal/trousseau/trousseau.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88

99
"github.com/oleiade/serrure/aes"
1010
"github.com/oleiade/serrure/openpgp"
11+
"github.com/oleiade/trousseau/internal/store"
1112
)
1213

1314
type Trousseau struct {
@@ -70,8 +71,8 @@ func FromBytes(d []byte) (*Trousseau, error) {
7071
return trousseau, err
7172
}
7273

73-
func (t *Trousseau) Decrypt() (*Store, error) {
74-
var store Store
74+
func (t *Trousseau) Decrypt() (*store.Store, error) {
75+
var store store.Store
7576

7677
switch t.CryptoAlgorithm {
7778
case GPG_ENCRYPTION:
@@ -118,7 +119,7 @@ func (t *Trousseau) Decrypt() (*Store, error) {
118119
return &store, nil
119120
}
120121

121-
func (t *Trousseau) Encrypt(store *Store) error {
122+
func (t *Trousseau) Encrypt(store *store.Store) error {
122123
switch t.CryptoAlgorithm {
123124
case GPG_ENCRYPTION:
124125
pd, err := json.Marshal(*store)
File renamed without changes.
File renamed without changes.

upgrade_test.go internal/trousseau/upgrade_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ package trousseau
22

33
import (
44
"encoding/json"
5-
"github.com/oleiade/serrure/openpgp"
65
"testing"
6+
7+
"github.com/oleiade/serrure/openpgp"
78
)
89

910
func TestIsVersionZeroDotThree(t *testing.T) {

upload.go internal/trousseau/upload.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import (
44
"fmt"
55

66
"github.com/crowdmob/goamz/aws"
7-
"github.com/oleiade/trousseau/dsn"
8-
"github.com/oleiade/trousseau/remote/gist"
9-
"github.com/oleiade/trousseau/remote/s3"
10-
"github.com/oleiade/trousseau/remote/ssh"
7+
"github.com/oleiade/trousseau/pkg/dsn"
8+
"github.com/oleiade/trousseau/pkg/remote/gist"
9+
"github.com/oleiade/trousseau/pkg/remote/s3"
10+
"github.com/oleiade/trousseau/pkg/remote/ssh"
1111
)
1212

1313
// uploadUsingS3 executes the whole process of pushing
File renamed without changes.

dsn/dsn.go pkg/dsn/dsn.go

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

gpgagent.go pkg/gpgagent/gpgagent.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ limitations under the License.
1515
*/
1616

1717
// Package gpgagent interacts with the local GPG Agent.
18-
package trousseau
18+
package gpgagent
1919

2020
import (
2121
"bufio"

gpgagent_test.go pkg/gpgagent/gpgagent_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
package trousseau
17+
package gpgagent
1818

1919
import (
2020
"fmt"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)