Skip to content
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

Simpilfy user id derivation from key #475

Merged
merged 4 commits into from
Jul 27, 2023

Conversation

smallhive
Copy link
Contributor

closes #428

@smallhive smallhive marked this pull request as ready for review July 25, 2023 12:30
user/signer.go Outdated Show resolved Hide resolved
user/signer.go Outdated Show resolved Hide resolved
user/signer.go Outdated Show resolved Hide resolved
user/signer.go Outdated Show resolved Hide resolved
user/signer.go Outdated Show resolved Hide resolved
client/object_search.go Show resolved Hide resolved
object/slicer/slicer.go Show resolved Hide resolved
session/object.go Show resolved Hide resolved
@@ -354,7 +354,8 @@ func (b Token) SigningKeyBytes() []byte {
// Returns zero user.ID if Token is unsigned or key has incorrect format.
//
// See also SigningKeyBytes.
func ResolveIssuer(b Token) (usr user.ID) {
func (b Token) ResolveIssuer() user.ID {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's where neofsid or anything like that fails miserably, btw.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I drop this commit?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about keeping user.IDFromKey. We can try moving its code to bearer thus removing it from public API. If anyone's got a keys.PublicKey, he can do id.SetScriptHash(pk.GetScriptHash()). If he's got bytes, then pk.DecodeBytes(key) (and associated error handling) is not that hard as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved IDFromKey to bearer

bearer/bearer.go Outdated Show resolved Hide resolved
@smallhive smallhive force-pushed the 428-simpilfy-user-id-derivation-from-key branch 2 times, most recently from 7afb608 to ecef897 Compare July 26, 2023 05:52
// ECDSA with SHA-256 hashing (RFC 6979). Provides [Signer] interface.
//
// Instances SHOULD be initialized with [NewSignerRFC6979] or [NewSignerRFC6979WithID].
type SignerRFC6979 struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they are literally named the same (user.SignerRFC6979 and neofsecdsa.SignerRFC6979). was it discussed too? @cthulhu-rider, @roman-khimov

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it a problem?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, one is the "original" while the other one is a wrapper over the first one. also user.Signer* confuses me (but *ecdsa.Signer* is clear). also, it reminds me of the problem of reading some neofs-node code when it is not clear what struct is here: sdk or api-go

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any alternative?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as i understand, you have already discussed it so i am only able to suggest naming with User, Wrapper, WithID. all of them are bad if the whole concept is taken as the only way

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

user.UserSmth is not a good thing. SignerRFC6979WithID seems to be longer than most people would like it to be. Wrapper is meaningless. If we don't have any better options then we can go with the current one.

Copy link
Member

@roman-khimov roman-khimov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK otherwise.

@roman-khimov
Copy link
Member

Conflict.

Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
@smallhive smallhive force-pushed the 428-simpilfy-user-id-derivation-from-key branch from c74f989 to 8be458e Compare July 27, 2023 03:43
@smallhive
Copy link
Contributor Author

Conflict.

Rebased

@roman-khimov roman-khimov merged commit d675d85 into master Jul 27, 2023
5 checks passed
@roman-khimov roman-khimov deleted the 428-simpilfy-user-id-derivation-from-key branch July 27, 2023 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Simpilfy user ID derivation from key
4 participants