Use account service in secureservice instead of config
This commit is contained in:
parent
257a4d8e13
commit
3ec34e84bc
@ -5,7 +5,6 @@ import (
|
||||
commonaccount "github.com/anytypeio/any-sync/accountservice"
|
||||
"github.com/anytypeio/any-sync/app"
|
||||
"github.com/anytypeio/any-sync/app/logger"
|
||||
"github.com/anytypeio/any-sync/util/keys"
|
||||
"github.com/libp2p/go-libp2p/core/crypto"
|
||||
"github.com/libp2p/go-libp2p/core/sec"
|
||||
libp2ptls "github.com/libp2p/go-libp2p/p2p/security/tls"
|
||||
@ -35,16 +34,16 @@ type secureService struct {
|
||||
}
|
||||
|
||||
func (s *secureService) Init(a *app.App) (err error) {
|
||||
account := a.MustComponent("config").(commonaccount.ConfigGetter).GetAccount()
|
||||
pkb, err := keys.DecodeBytesFromString(account.PeerKey)
|
||||
account := a.MustComponent(commonaccount.CName).(commonaccount.Service)
|
||||
peerKey, err := account.Account().PeerKey.Raw()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if s.key, err = crypto.UnmarshalEd25519PrivateKey(pkb); err != nil {
|
||||
if s.key, err = crypto.UnmarshalEd25519PrivateKey(peerKey); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
log.Info("secure service init", zap.String("peerId", account.PeerId))
|
||||
log.Info("secure service init", zap.String("peerId", account.Account().PeerId))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user