-
Notifications
You must be signed in to change notification settings - Fork 14
Provide API to work with session key binary #704
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
base: master
Are you sure you want to change the base?
Conversation
`Container.SetAuthKey` was tested by mistake. Signed-off-by: Leonard Lyubich <[email protected]>
Zero (undefined overall) session token is returned from the cache on miss, so it makes no sense to access its fields. Signed-off-by: Leonard Lyubich <[email protected]>
For the sake of transparency and flexibility: struct field is of []byte type. Also, field can be extended within nspcc-dev/neofs-api#305. New methods will allow to adapt variadic format in the app without lib changes. Signed-off-by: Leonard Lyubich <[email protected]>
API added in e0c7bdb allows it. Signed-off-by: Leonard Lyubich <[email protected]>
API added in e0c7bdb allows it. Signed-off-by: Leonard Lyubich <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #704 +/- ##
==========================================
+ Coverage 55.22% 55.25% +0.03%
==========================================
Files 166 166
Lines 22803 22803
==========================================
+ Hits 12593 12600 +7
+ Misses 9937 9931 -6
+ Partials 273 272 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
One of the differences of proto/* and "normal" types to me is to avoid the possibility of creating an incorrect instance. This makes it easier to create an invalid token.
|
||
// SetAuthKeyBytes sets binary-encoded public key corresponding to the private key | ||
// bound to the session. | ||
func (x *commonData) SetAuthKeyBytes(b []byte) { |
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.
This makes the API ambiguous to me. If you want raw bytes --- proto/session is here for you.
} | ||
|
||
var key neofsecdsa.PublicKey | ||
if err = key.Decode(res.PublicKey()); err != nil { |
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.
Actually this suggests another inconsistency (SDK-level), sometimes keys are proper keys and sometimes they are bytes. Depends on type.
according to nspcc-dev/neofs-api#305 (comment), this is not needed for now, meaning redundant. So i'll leave this PR as a reminder. If we'll need to support smth other than keys, changes may become relevant |
not critical extension for now (nspcc-dev/neofs-api#305 (comment)), but useful in general