(kontrolConf *Kontrol, publicKey, privateKey []byte)
| 105 | } |
| 106 | |
| 107 | func initialKey(kontrolConf *Kontrol, publicKey, privateKey []byte) { |
| 108 | conf := config.New() |
| 109 | |
| 110 | if kontrolConf.Username == "" { |
| 111 | log.Fatalln("empty username") |
| 112 | } |
| 113 | conf.Username = kontrolConf.Username |
| 114 | |
| 115 | _, err := url.Parse(kontrolConf.KontrolURL) |
| 116 | if err != nil { |
| 117 | log.Fatalln("cannot parse kontrol URL") |
| 118 | } |
| 119 | |
| 120 | conf.KontrolURL = kontrolConf.KontrolURL |
| 121 | |
| 122 | k := kontrol.New(conf, kontrolConf.Version) |
| 123 | k.AddKeyPair("", string(publicKey), string(privateKey)) |
| 124 | err = k.InitializeSelf() |
| 125 | if err != nil { |
| 126 | log.Fatal(err) |
| 127 | } |
| 128 | |
| 129 | fmt.Println("kite.key is written to ~/.kite/kite.key. You can see it with:\n\tkitectl showkey") |
| 130 | } |
no test coverage detected