From ca3596dd0575e9407a64afd28a9d7b75973e2038 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Fri, 25 Nov 2022 14:31:36 +0300 Subject: [PATCH] [#2104] cli: OID signature in output OID signature should always be present in an object; it does not relate to the object split. Signed-off-by: Pavel Karpy --- CHANGELOG.md | 1 + cmd/neofs-cli/modules/object/head.go | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d602b0e6..2c64c930 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ Changelog for NeoFS Node - Panic in IR when performing HEAD requests (#2069) - Write-cache flush duplication (#2074) - Ignore error if a transaction already exists in a morph client (#2075) +- ObjectID signature output in the CLI (#2104) ### Removed ### Updated diff --git a/cmd/neofs-cli/modules/object/head.go b/cmd/neofs-cli/modules/object/head.go index 41736285..81ac42cd 100644 --- a/cmd/neofs-cli/modules/object/head.go +++ b/cmd/neofs-cli/modules/object/head.go @@ -160,6 +160,17 @@ func printHeader(cmd *cobra.Command, obj *object.Object) error { cmd.Printf(" %s=%s\n", attr.Key(), attr.Value()) } + if signature := obj.Signature(); signature != nil { + cmd.Print("ID signature:\n") + + // TODO(@carpawell): #1387 implement and use another approach to avoid conversion + var sigV2 refs.Signature + signature.WriteToV2(&sigV2) + + cmd.Printf(" public key: %s\n", hex.EncodeToString(sigV2.GetKey())) + cmd.Printf(" signature: %s\n", hex.EncodeToString(sigV2.GetSign())) + } + return printSplitHeader(cmd, obj) } @@ -180,17 +191,6 @@ func printSplitHeader(cmd *cobra.Command, obj *object.Object) error { cmd.Printf("Split ChildID: %s\n", child.String()) } - if signature := obj.Signature(); signature != nil { - cmd.Print("Split Header Signature:\n") - - // TODO(@cthulhu-rider): #1387 implement and use another approach to avoid conversion - var sigV2 refs.Signature - signature.WriteToV2(&sigV2) - - cmd.Printf(" public key: %s\n", hex.EncodeToString(sigV2.GetKey())) - cmd.Printf(" signature: %s\n", hex.EncodeToString(sigV2.GetSign())) - } - parent := obj.Parent() if parent != nil { cmd.Print("\nSplit Parent Header:\n")