-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path.notes
More file actions
67 lines (54 loc) · 1.96 KB
/
.notes
File metadata and controls
67 lines (54 loc) · 1.96 KB
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
64
65
66
67
// Get value from boltDB
value, _ := b.D.GetVal([]byte(kF.FilePointer()))
newKy, _ := keys.NewECDSABlank(*b.C)
newKy, _ = newKy.Unmarshall(string(value))
b.L.Infof("Boltdb keyB64['GID']: '%s'", h.MagentaFgD(newKy.FilePointer()))
// Count keys from boltDB
keysCnt, _ := b.D.AllKeys()
numKeys := len(keysCnt)
b.L.Infof("Boltdb keys in 'keys' bucket: %d", numKeys)
// Get all keys from boltDB
keys, _ := b.D.AllKeys()
for _, v := range keys {
b.L.Infof("%s='%s'", h.MagentaFgD("Key"), h.GreenFgB(string(v)))
}
// Insert data into boltDB
objB64, _ := kF.Marshall()
// Insert value to boltDB
if err := b.D.InsertKey([]byte(kF.FilePointer()), []byte(objB64)); err != nil {
panic(err)
}
// Grabing key signatures from ssh-keygen
// ssh-keygen -l -E md5 -f ~/.ssh/id_rsa.pub
// 2048 MD5:44:91:e0:e3:64:1e:38:6e:24:7e:40:09:a3:42:2f:84 shaman@shaman.local (RSA)
// ssh-keygen -l -v -f ~/.ssh/id_rsa.pub
// 2048 SHA256:JCBJ8wQkMsKMxbtAWGeUgXydoo7JCiVOv+gG2luFt54 shaman@shaman.local
//
// awk '{print $2}' ~/.ssh/id_rsa.pub | base64 -D | sha256sum -b | sed 's/ .*$//' | xxd -r -p | base64
// JCBJ8wQkMsKMxbtAWGeUgXydoo7JCiVOv+gG2luFt54=
// Multisignature scheme
https://github.com/bford/golang-x-crypto/blob/master/ed25519/cosi/example_test.go
// cmd/root.go
// if cfgFile != "" {
// // Use config file from the flag.
// viper.SetConfigFile(cfgFile)
// } else {
// // Find home directory.
// home, err := homedir.Dir()
// if err != nil {
// panic(err)
// }
//
// // Search config in home directory with name ".cobra" (without extension).
// viper.AddConfigPath(home)
// viper.SetConfigName(".cobra")
// }
//
// viper.AutomaticEnv()
//
// if err := viper.ReadInConfig(); err == nil {
// fmt.Println("Using config file:", viper.ConfigFileUsed())
// }
Good code examples for ETH sign/verify
https://github.com/miguelmota/ethereum-development-with-go-book/blob/master/code/signature_generate.go
https://github.com/miguelmota/ethereum-development-with-go-book/blob/master/code/signature_verify.go