-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend package API with features usefule for existing apps #479
Extend package API with features usefule for existing apps #479
Conversation
cthulhu-rider
commented
Jul 29, 2023
•
edited
Loading
edited
- track adaptations in Upgrade NeoFS SDK module to the latest revision neofs-node#2449
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK otherwise.
3ba061e
to
b99e489
Compare
b99e489
to
b3187fe
Compare
user/signer.go
Outdated
return s.id | ||
// NewStaticSignerWithID creates new [Signer] with specified [ID]. | ||
func NewStaticSignerWithID(scheme neofscrypto.Scheme, sig []byte, pubKey neofscrypto.PublicKey, id ID) Signer { | ||
return NewSigner(neofscrypto.NewStaticSigner(scheme, sig, pubKey), id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@smallhive
having NewSigner
and neofscrypto.NewStaticSigner
: do we really need NewStaticSignerWithID
then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have both variants for the usual signer in case if someone wants to set a different user.ID
. I think we should save this flexibility here, as a minimum for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
save this flexibility here
to keep or not to keep NewStaticSignerWithID
?
it may be
s := user.NewStaticSignerWithID(scheme, sig, pub, id)
// or
s := user.NewSigner(neofscrypto.NewStaticSigner(scheme, sig, pub), id)
does first approach worth a separate function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The second option covers my requirements, you may remove NewStaticSignerWithID or mark it obsolete
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, lets try to ride w/o it (we can always add if that)
1e1ae8f
to
480b739
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of the other changes are perfectly fine.
Provide getters of signature scheme, public key and value. Make `WriteToV2` method to decode public key from binary to assert scheme format. New API will allow to avoid `WriteToV2` calls in user space. New unit test checks and shows client-to-server transport over NeoFS API V2 protocol. Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
Encoding methods of `PublicKey` interface require buffer pre-allocation. In cases where the user does not have a buffer prepared in advance, he has to explicitly create it and encode the key. Helper function `PublicKeyBytes` is added to make code easier. Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
Previously, package provided constructors for `Signer` instances with RFC 6979 signature scheme only. User may need to construct any `Signer` instance (other scheme or even custom implementation). Add generic constructor `NewSigner` accepting split `neofscrypto.Signer` and `user.ID`. Add two constructors from standard `ecdsa.PrivateKey` with an explanation that the user ID is resolved automatically. Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
Signature is used for user authentication so access to public key is required. Digital signature bytes may still be unexported because they are only useful for `VerifySignature` method. Add `IssuerPublicKeyBytes` method returning binary-encoded public key of the session issuer. Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
480b739
to
577b2d6
Compare