cmd/tools/convert-node-id: show node id for an id.cert
Change-Id: Iae392398dac3d4f45ef829b25b27a2a7a69b0932
This commit is contained in:
parent
b776382f18
commit
8a42cad6a1
@ -4,10 +4,12 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"storj.io/common/identity"
|
||||
"storj.io/common/storj"
|
||||
)
|
||||
|
||||
@ -48,6 +50,17 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
if chain, err := os.ReadFile(os.Args[1]); err == nil {
|
||||
if id, err := identity.PeerIdentityFromPEM(chain); err == nil {
|
||||
output(id.ID)
|
||||
return
|
||||
}
|
||||
if id, err := identity.DecodePeerIdentity(context.Background(), chain); err == nil {
|
||||
output(id.ID)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Fprintf(os.Stderr, "unknown argument: %q", os.Args[1])
|
||||
usage()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user