I hate commit messages
This commit is contained in:
1 parent
209af0d820
commit
8654c45e35
11 files changed
+278
-35
No files matched your search
@@ -5,19 +5,19 @@ import (
|
||||
"os"
|
||||
|
||||
"github.com/codegangsta/cli"
|
||||
"github.com/didiercrunch/filou/keygenerator"
|
||||
"github.com/didiercrunch/filou/contract"
|
||||
)
|
||||
|
||||
var createKeyCommand = cli.Command{
|
||||
Name: "createkey",
|
||||
Usage: "create a pair of public/private key",
|
||||
Name: "create-contracts",
|
||||
Usage: "create a pair of public/private key encapsulated in contracts",
|
||||
Flags: []cli.Flag{
|
||||
cli.IntFlag{Name: "size, s", Value: 2048, Usage: "key size in bits"},
|
||||
},
|
||||
Action: func(c *cli.Context) {
|
||||
keyGenerator := new(keygenerator.KeyGenerator)
|
||||
fmt.Println("creating key")
|
||||
if err := keyGenerator.CreateNewKey(c.Int("size")); err != nil {
|
||||
keyGenerator := new(contract.ContractsGenerator)
|
||||
fmt.Println("creating key ...")
|
||||
if err := keyGenerator.CreateContracts(c.Int("size")); err != nil {
|
||||
fmt.Println("error while creating the key\n", err)
|
||||
}
|
||||
},
|
||||
@@ -28,14 +28,14 @@ var encryptFileCommand = cli.Command{
|
||||
Usage: "encrypt file or directory",
|
||||
Flags: []cli.Flag{
|
||||
cli.StringFlag{Name: "file, s", Value: "", Usage: "the file or directory to encrypt."},
|
||||
cli.StringFlag{Name: "publicKey, k", Value: "", Usage: "the public key to use to encrypt"},
|
||||
cli.StringFlag{Name: "publicContract, c", Value: "", Usage: "the public contract to use to encrypt"},
|
||||
},
|
||||
Action: func(c *cli.Context) {
|
||||
keyGenerator := new(keygenerator.KeyGenerator)
|
||||
fmt.Println("creating key")
|
||||
if err := keyGenerator.CreateNewKey(c.Int("size")); err != nil {
|
||||
fmt.Println("error while creating the key\n", err)
|
||||
if _, err := GetContract(c.String("publicContract")); err != nil {
|
||||
fmt.Println("error getting the public contract", err)
|
||||
return
|
||||
}
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user