cmd/api: generate an RSA key with requests

This commit is contained in:
Cadey Ratio 2017-01-19 17:14:45 -08:00
parent cb6e57b670
commit 43535b44c3
1 changed files with 8 additions and 1 deletions

View File

@ -1,6 +1,8 @@
package main package main
import ( import (
"crypto/rand"
"crypto/rsa"
"log" "log"
"net/rpc" "net/rpc"
@ -13,9 +15,14 @@ func main() {
log.Fatal(err) log.Fatal(err)
} }
pKey, err := rsa.GenerateKey(rand.Reader, 1024)
if err != nil {
log.Fatal(err)
}
req := routerpc.AddHostRequest{ req := routerpc.AddHostRequest{
APIKey: "hunter2", APIKey: "hunter2",
PrivKey: nil, PrivKey: pKey,
} }
resp := &routerpc.AddHostResponse{} resp := &routerpc.AddHostResponse{}