Example #1
0
func (k kademliaservice) PostKey(p *objects.PrivateKey) (err error) {
	values := url.Values{}
	values.Add("type", "key")
	values.Add("hkid", p.Hkid().Hex())
	data, err := k.postobject(values, p.Bytes())
	if err != nil {
		log.Println(err)
		log.Printf("%s", data)
		return err
	}
	return err
}
Example #2
0
func (lfs localfileservice) PostKey(p *objects.PrivateKey) (err error) {
	err = os.MkdirAll("bin/keys", 0700)
	filepath := fmt.Sprintf("bin/keys/%s", p.Hkid().Hex())
	err = ioutil.WriteFile(filepath, objects.PrivateKey(*p).Bytes(), 0600)
	return
}