From 4e1390763a94661b531a534ad52bd2dffc61b1b4 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Fri, 19 May 2023 22:10:55 +0300 Subject: [PATCH] *: specify RFC6979 signer as mandatory where appropriate Refs. #209. Signed-off-by: Roman Khimov --- client/client.go | 5 ++++- container/container.go | 4 +++- pool/pool.go | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/client/client.go b/client/client.go index aa873e55..135fcd52 100644 --- a/client/client.go +++ b/client/client.go @@ -159,7 +159,10 @@ type PrmInit struct { // SetDefaultSigner sets Client private signer to be used for the protocol // communication by default. // -// Required for operations without custom signer parametrization (see corresponding Prm* docs). +// Optional if you intend to sign every request separately (see Prm* docs), but +// required if you'd like to use this signer for all operations implicitly. +// If specified, MUST be of [neofscrypto.ECDSA_DETERMINISTIC_SHA256] scheme, +// for example, [neofsecdsa.SignerRFC6979] can be used. func (x *PrmInit) SetDefaultSigner(signer neofscrypto.Signer) { x.signer = signer } diff --git a/container/container.go b/container/container.go index d72ca317..5c58fade 100644 --- a/container/container.go +++ b/container/container.go @@ -476,7 +476,9 @@ func ReadDomain(cnr Container) (res Domain) { // and writes it into dst. Signature instance MUST NOT be nil. CalculateSignature // is expected to be called after all the Container data is filled and before // saving the Container in the NeoFS network. Note that мany subsequent change -// will most likely break the signature. +// will most likely break the signature. signer MUST be of +// [neofscrypto.ECDSA_DETERMINISTIC_SHA256] scheme, for example, [neofsecdsa.SignerRFC6979] +// can be used. // // See also VerifySignature. func CalculateSignature(dst *neofscrypto.Signature, cnr Container, signer neofscrypto.Signer) error { diff --git a/pool/pool.go b/pool/pool.go index cf6be085..ac5783c5 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -998,6 +998,8 @@ type InitParameters struct { } // SetSigner specifies default signer to be used for the protocol communication by default. +// MUST be of [neofscrypto.ECDSA_DETERMINISTIC_SHA256] scheme, for example, +// [neofsecdsa.SignerRFC6979] can be used. func (x *InitParameters) SetSigner(signer neofscrypto.Signer) { x.signer = signer }