Skip to content

Commit

Permalink
Merge branch 'master' of github.com:eoscanada/eosc
Browse files Browse the repository at this point in the history
  • Loading branch information
dix975 committed Jun 7, 2018
2 parents 598398c + ec51572 commit 567a35f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
5 changes: 2 additions & 3 deletions eosc/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@ It contains a Vault (or a wallet), a tool for voting, tools for end
users and tools for Block Producers.
It is developed by EOS Canada, a (candidate) Block Producer for the EOS
network.
network. Source code is available at: https://github.com/eoscanada/eosc
The 'vault' acts as a keosd-compatible wallet (the one developed by
Block.one), while allowing you to manage your keys, and unlock it from
the command line.
The EOS Canada team
https://www.eoscanada.com
Version ` + Version,
}

Expand Down
6 changes: 2 additions & 4 deletions eosc/cmd/vote.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ var voteCmd = &cobra.Command{
}
var voteProducersCmd = &cobra.Command{
Use: "producers [voter name] [producer list]",
Short: "Command to vote for block producers",
Long: `Command to vote for block producers`,
Short: "Cast your vote for 1 to 30 producers. View them with 'list'",
Args: cobra.MinimumNArgs(2),
Run: func(cmd *cobra.Command, args []string) {
var producerNames = make([]eos.AccountName, 0, 0)
Expand Down Expand Up @@ -62,8 +61,7 @@ var voteProducersCmd = &cobra.Command{

var voteProxyCmd = &cobra.Command{
Use: "proxy [voter name] [proxy name]",
Short: "Command to vote for a proxy",
Long: `Command to vote for a proxy`,
Short: "Cast your vote for a proxy voter",
Args: cobra.ExactArgs(2),
Run: func(cmd *cobra.Command, args []string) {

Expand Down
17 changes: 13 additions & 4 deletions vault/kmsgcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,6 @@ func NewKMSGCPManager(keyPath string) (*KMSGCPManager, error) {
keyPath: keyPath,
}

if err := manager.setupEncryption(); err != nil {
return nil, err
}

return manager, nil
}

Expand All @@ -117,6 +113,10 @@ type KMSGCPManager struct {
}

func (k *KMSGCPManager) setupEncryption() error {
if k.dekCache != nil {
return nil
}

_, err := rand.Read(k.localDEK[:])
if err != nil {
return err
Expand Down Expand Up @@ -160,6 +160,12 @@ func (k *KMSGCPManager) fetchPlainDEK(wrappedDEK string) (out [32]byte, err erro

copy(out[:], plainKey)

if k.dekCache == nil {
k.dekCache = map[string][32]byte{}
}
if k.localWrappedDEK == "" {
k.localWrappedDEK = wrappedDEK
}
k.dekCache[wrappedDEK] = out

return
Expand All @@ -173,6 +179,9 @@ type BlobV1 struct {
}

func (k *KMSGCPManager) Encrypt(in []byte) ([]byte, error) {
if err := k.setupEncryption(); err != nil {
return nil, err
}

var nonce [24]byte
if _, err := io.ReadFull(rand.Reader, nonce[:]); err != nil {
Expand Down

0 comments on commit 567a35f

Please sign in to comment.