log and stub of identity gen
This commit is contained in:
parent
42a2cba547
commit
cf200dcfe4
|
@ -37,6 +37,7 @@ func CreateIdentity(core *Ricochet) (*Identity, error) {
|
||||||
log.Printf("Failed loading identity: %v", err)
|
log.Printf("Failed loading identity: %v", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
log.Println("me: ", me)
|
||||||
|
|
||||||
contactList, err := LoadContactList(core)
|
contactList, err := LoadContactList(core)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -46,6 +47,7 @@ func CreateIdentity(core *Ricochet) (*Identity, error) {
|
||||||
me.contactList = contactList
|
me.contactList = contactList
|
||||||
|
|
||||||
contactList.StartConnections()
|
contactList.StartConnections()
|
||||||
|
log.Println("me: ", me)
|
||||||
go me.publishService(me.privateKey)
|
go me.publishService(me.privateKey)
|
||||||
return me, nil
|
return me, nil
|
||||||
}
|
}
|
||||||
|
@ -53,7 +55,14 @@ func CreateIdentity(core *Ricochet) (*Identity, error) {
|
||||||
func (me *Identity) loadIdentity() error {
|
func (me *Identity) loadIdentity() error {
|
||||||
config := me.core.Config.Read()
|
config := me.core.Config.Read()
|
||||||
|
|
||||||
if keyData := config.Secrets.GetServicePrivateKey(); keyData != nil {
|
keyData := config.Secrets.GetServicePrivateKey();
|
||||||
|
|
||||||
|
if keyData != nil {
|
||||||
|
log.Printf("Initializing new identity")
|
||||||
|
|
||||||
|
privateKey, err := utils.GeneratePrivateKey()
|
||||||
|
}
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
me.privateKey, _, err = pkcs1.DecodePrivateKeyDER(keyData)
|
me.privateKey, _, err = pkcs1.DecodePrivateKeyDER(keyData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -65,9 +74,7 @@ func (me *Identity) loadIdentity() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("Loaded identity %s", me.address)
|
log.Printf("Loaded identity %s", me.address)
|
||||||
} else {
|
|
||||||
log.Printf("Initializing new identity")
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -105,6 +112,7 @@ func (me *Identity) setPrivateKey(key *rsa.PrivateKey) error {
|
||||||
|
|
||||||
// BUG(special): No error handling for failures under publishService
|
// BUG(special): No error handling for failures under publishService
|
||||||
func (me *Identity) publishService(key *rsa.PrivateKey) {
|
func (me *Identity) publishService(key *rsa.PrivateKey) {
|
||||||
|
log.Println("publishService(", key, ")")
|
||||||
// This call will block until a control connection is available and the
|
// This call will block until a control connection is available and the
|
||||||
// ADD_ONION command has returned. After creating the listener, it will
|
// ADD_ONION command has returned. After creating the listener, it will
|
||||||
// be automatically re-published if the control connection is lost and
|
// be automatically re-published if the control connection is lost and
|
||||||
|
|
Loading…
Reference in New Issue