mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-25 20:37:53 +08:00
coreapi key: error on self if ident not loaded
License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
This commit is contained in:
parent
181c39993a
commit
7807f575f1
@ -3,6 +3,7 @@ package coreapi
|
||||
import (
|
||||
"context"
|
||||
"crypto/rand"
|
||||
"errors"
|
||||
"fmt"
|
||||
"sort"
|
||||
|
||||
@ -218,5 +219,9 @@ func (api *KeyAPI) Remove(ctx context.Context, name string) (coreiface.Key, erro
|
||||
}
|
||||
|
||||
func (api *KeyAPI) Self(ctx context.Context) (coreiface.Key, error) {
|
||||
if api.node.Identity == "" {
|
||||
return nil, errors.New("identity not loaded")
|
||||
}
|
||||
|
||||
return &key{"self", api.node.Identity}, nil
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user