diff --git a/eosc/cmd/root.go b/eosc/cmd/root.go index 23fd156b..a50b6ee4 100644 --- a/eosc/cmd/root.go +++ b/eosc/cmd/root.go @@ -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, } diff --git a/eosc/cmd/vote.go b/eosc/cmd/vote.go index e698f56f..169ef520 100644 --- a/eosc/cmd/vote.go +++ b/eosc/cmd/vote.go @@ -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) @@ -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) { diff --git a/vault/kmsgcp.go b/vault/kmsgcp.go index a75bd595..e5a9d176 100644 --- a/vault/kmsgcp.go +++ b/vault/kmsgcp.go @@ -100,10 +100,6 @@ func NewKMSGCPManager(keyPath string) (*KMSGCPManager, error) { keyPath: keyPath, } - if err := manager.setupEncryption(); err != nil { - return nil, err - } - return manager, nil } @@ -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 @@ -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 @@ -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 {