mirror of
https://github.com/ipfs/kubo.git
synced 2026-03-07 01:08:08 +08:00
assert private key available in online mode
License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>
This commit is contained in:
parent
2eafa3f3ca
commit
58292f75ff
@ -159,6 +159,10 @@ func (n *IpfsNode) startOnlineServices(ctx context.Context, routingOption Routin
|
||||
return errors.New("node already online")
|
||||
}
|
||||
|
||||
if n.PrivateKey == nil {
|
||||
return fmt.Errorf("private key not available")
|
||||
}
|
||||
|
||||
// get undialable addrs from config
|
||||
cfg, err := n.Repo.Config()
|
||||
if err != nil {
|
||||
@ -767,6 +771,9 @@ func (n *IpfsNode) loadID() error {
|
||||
// GetKey will return a key from the Keystore with name `name`.
|
||||
func (n *IpfsNode) GetKey(name string) (ic.PrivKey, error) {
|
||||
if name == "self" {
|
||||
if n.PrivateKey == nil {
|
||||
return nil, fmt.Errorf("private key not available")
|
||||
}
|
||||
return n.PrivateKey, nil
|
||||
} else {
|
||||
return n.Repo.Keystore().Get(name)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user