-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathset_param.go
63 lines (51 loc) · 1.48 KB
/
set_param.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package main
import (
// "fmt"
// "github.com/tvdburgt/passman/crypto"
// "time"
)
var cmdSetParam = &Command{
Run: runSetParam,
UsageLine: "set-param",
Short: "shows status information about the store file",
Long: `
get displays the content of a single passman entry. The identifier must be an
exact match. To search or display multiple entries, see passman list.
`,
}
func runSetParam(cmd *Command, args []string) {
// if len(args) < 2 {
// // TODO: show usage
// fatalf("passman set-param: missing identifier")
// }
// name, value := args[0], args[1]
// s, passphrase := openStore(true)
// defer crypto.Clear(passphrase)
// p := &s.Header.Params
// params := map[string]interface{}{
// "n": &p.LogN,
// "r": &p.R,
// "p": &p.P,
// }
// field, ok := params[name]
// if !ok {
// fatalf("passman set-param: unknown parameter name '%s'", name)
// }
// // TODO: type conversion from string to byte/uint32?
// field = value
// _ = field // Go complains about unused variable
// fmt.Println("Verifying parameter...")
// // Test new parameter before finalizing the change
// defer func() {
// if err := recover(); err != nil {
// fatalf("passman set-param:", err)
// }
// }()
// before := time.Now()
// crypto.DeriveKeys([]byte{}, []byte{}, int(p.LogN), int(p.R), int(p.P))
// after := time.Now()
// d := before.Sub(after)
// fmt.Println("Key derivation took", d)
// writeStore(s, passphrase)
// fmt.Printf("Changed '%s' to '%s'\n", name, value)
}