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

bearer: Improvements and test coverage #626

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from
Draft

bearer: Improvements and test coverage #626

wants to merge 13 commits into from

Conversation

cthulhu-rider
Copy link
Contributor

Previously, any token w/o lifetime field was always considered as
invalid (expired in particular). In the protocol, the lifetime field's
absence is equivalent to all zero claims. Thus, `InvalidAt` and
`ExpiredAt` methods behaved correctly for all cases except default one.
At the same time, if user explicitly set all lifetime claims to zero -
token was not invalid at the epoch #0.

From now skipping a lifetime field in a token message is equivalent to a
field with all zeros. This change will only affect epoch #0 and will be
invisible in practice since the NeoFS network starts from epoch #1. In
addition, the internal structure of the type has been simplified.

Signed-off-by: Leonard Lyubich <[email protected]>
Previously they could not be obtained directly. It's natural need to get
what was set, e.g. in unit tests, logging, etc. So, it's better to
provide way to receive such an open info.

Signed-off-by: Leonard Lyubich <[email protected]>
Similar to 091a279.

Signed-off-by: Leonard Lyubich <[email protected]>
Cryptographic signatures of digital data of the system are transmitted
in the form of a simple tuple: scheme, binary public key and the
signature itself. The library provides `Calculate` method which, on the
one hand, facilitates calculation, on the other - deprives the ability
to work with pre-calculated values. As a patch, the so-called
`StaticSigner` was provided for signing simulation.

This commit adds new approach: now the signature structure can be
flexibly created by newly added constructors (or modified by new field
setters). In some practical cases, like WalletConnect remote signing,
working with pre-computed signature structure is the only way.

For the same reason, the interface of signed data structures (e.g.
tokens) is also extended: now a structured signature setter+getter are
provided.

Signed-off-by: Leonard Lyubich <[email protected]>
Previously, container and object verb types were `int8` enums which is
much narrower than the protocol definition. Also, corresponding token
were converted from derived uint32 type w/o overflow check.

Now types are `int32` and any bigger value is denied.

Signed-off-by: Leonard Lyubich <[email protected]>
Same as XXXXXXXXXXXXXXX (after session PR merge).

Signed-off-by: Leonard Lyubich <[email protected]>
Same as XXXXXXXXXXXXXXX (after session PR merge).

Signed-off-by: Leonard Lyubich <[email protected]>
Has been forgotten in 2cca6c7.

Signed-off-by: Leonard Lyubich <[email protected]>
Previously, the only way to receive eACL in the `Token` was field getter.
It states that if the table is unset, zero instance is returned. The
problem is that `eacl.Table` type does not implement `comparable`
constraint. So, there is no way to check whether eACL instance is zero
or not. Therefore, there was no way to find out whether the token
contained a table.

This adds `GetEACLTable` method returning boolean flag of eACL presence.

Signed-off-by: Leonard Lyubich <[email protected]>
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.

1 participant