@@ -12,7 +12,7 @@ import (
12
12
13
13
// Cat retrieves encrypted data from store
14
14
func (client * Client ) Cat (cmd * cli.Cmd ) {
15
- address := addOpt (cmd , "address" , addrOpt , "" ).( * string )
15
+ address := addStringOpt (cmd , "address" , addrOpt )
16
16
17
17
cmd .Action = func () {
18
18
ref := readReference (address )
@@ -27,9 +27,9 @@ func (client *Client) Cat(cmd *cli.Cmd) {
27
27
28
28
// Get retrieves and decrypts data from store
29
29
func (client * Client ) Get (cmd * cli.Cmd ) {
30
- address := addOpt (cmd , "address" , addrOpt , "" ).( * string )
31
- secretKey := addOpt (cmd , "key" , secretOpt , "" ).( * string )
32
- salt := addOpt (cmd , "salt" , saltOpt , "" ).( * string )
30
+ address := addStringOpt (cmd , "address" , addrOpt )
31
+ secretKey := addStringOpt (cmd , "key" , secretOpt )
32
+ salt := addStringOpt (cmd , "salt" , saltOpt )
33
33
34
34
cmd .Action = func () {
35
35
// If given address then try to read reference from arguments and option
@@ -39,9 +39,9 @@ func (client *Client) Get(cmd *cli.Cmd) {
39
39
fatalf ("A secret key must be provided in order to decrypt" )
40
40
}
41
41
ref = & reference.Ref {
42
- Address : readBase64 (* address ),
43
- SecretKey : readBase64 (* secretKey ),
44
- Salt : parseSalt (* salt ),
42
+ Address : readBase64 (address ),
43
+ SecretKey : readBase64 (secretKey ),
44
+ Salt : parseSalt (salt ),
45
45
}
46
46
}
47
47
plaintext , err := client .cleartext .Get (context .Background (), ref )
@@ -68,14 +68,14 @@ func (client *Client) Insert(cmd *cli.Cmd) {
68
68
69
69
// Put encrypts data and stores it
70
70
func (client * Client ) Put (cmd * cli.Cmd ) {
71
- salt := addOpt (cmd , "salt" , saltOpt , "" ).( * string )
71
+ salt := addStringOpt (cmd , "salt" , saltOpt )
72
72
73
73
cmd .Action = func () {
74
74
data := readData ()
75
75
ref , err := client .cleartext .Put (context .Background (),
76
76
& hoard.Plaintext {
77
77
Data : data ,
78
- Salt : parseSalt (* salt ),
78
+ Salt : parseSalt (salt ),
79
79
})
80
80
if err != nil {
81
81
fatalf ("Error storing data: %v" , err )
@@ -86,7 +86,7 @@ func (client *Client) Put(cmd *cli.Cmd) {
86
86
87
87
// Stat retrieves info about the stored data
88
88
func (client * Client ) Stat (cmd * cli.Cmd ) {
89
- address := addOpt (cmd , "address" , addrOpt , "" ).( * string )
89
+ address := addStringOpt (cmd , "address" , addrOpt )
90
90
91
91
cmd .Action = func () {
92
92
ref := readReference (address )
0 commit comments