Commit graph

17 commits

Author SHA1 Message Date
Leonard Lyubich
e887368be6 [#340] owner: Prevent potential NPE in NEO3WalletFromPublicKey
Copy `Curve` field of `ecdsa.PublicKey` arg to `keys.PublicKey` instance in
`NEO3WalletFromPublicKey` function.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-09-20 14:41:29 +03:00
Pavel Karpy
c00cdd407d [#302] pkg/owner: Document default values set in NewID
Document field values of instance constructed via `NewID`.
Assert the values in corresponding unit test.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
12574469e5 [#302] pkg/owner: Convert nil ID to nil message
Document that `ID.ToV2` method return `nil`
when called on `nil`. Document that `NewIDFromV2`
function return `nil` when called on `nil`. Write
corresponding unit tests.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Leonard Lyubich
65080c8b69 [#295] pkg: Remove usage of deprecated elements
Remove usage of deprecated of `container.ID` and `token.SessionToken` code
elements. Replace using of custom message generators with the ones provided
by packages. Replace string comparison with `Equal` method call.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-06-01 08:04:12 +03:00
Leonard Lyubich
5fe5af5bf9 [#283] pkg/owner: Implement Equal method of ID type
Implement `owner.ID.Equal` method which defines a comparison relationship
between two identifiers.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-28 16:32:02 +03:00
Leonard Lyubich
4f286f5175 [#283] pkg/owner: Implement generators of ID's for testing
Create `ownertest` package with functions which generate random `owner.ID`
instances. These functions is going to be used for testing.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-28 16:32:02 +03:00
Evgenii Stratonikov
9ddfcdfbba [#277] go.mod: remove pkg/errors
Use stdlib `errors` instead.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-05-19 11:14:56 +03:00
Leonard Lyubich
c0de2bf9e5 [#199] sdk/owner: Correct linter's remarks
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-16 18:51:14 +03:00
Leonard Lyubich
79f72e10c9 [#199] sdk: Refactor string parse errors
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-16 18:51:14 +03:00
Leonard Lyubich
9ec57ee9f8 [#168] refs: Implement binary/JSON encoders/decoders on OwnerID
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-13 18:07:26 +03:00
Evgeniy Kulikov
4e6350f6d4 [#147] Work around owner package
- implement Stringer interface and Parse method for owner.ID
- increase test coverage

closes #147

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-10-15 11:05:37 +03:00
Evgeniy Kulikov
e2d8f408d8 [#147] Work around owner package
Add NEO3WalletSize as constant value.

closes #147

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-10-15 11:05:37 +03:00
Alex Vanin
fa18f5ede7 [#165] pkg/owner: Add ID constructor from wallet
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-10-07 10:16:36 +03:00
Leonard Lyubich
524280a5e8 [#140] sdk: Refactor reference types
Refactor v2-compatible reference types to be wrappers over corresponding
types from v2.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-09-18 10:45:11 +03:00
Alex Vanin
9cba1e233d [#131] sdk: Add owner stringer and script hash converter
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-09-18 10:45:11 +03:00
Leonard Lyubich
63c8d6e9ea [#128] sdk: Use owner ID instead of NEO3Wallet
Replace owner.NEO3Wallet usage with owner.ID usage. Functions that process
the wallet address convert it to the owner identifier through the public
method.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-09-18 10:45:11 +03:00
Leonard Lyubich
c9d38aa2e1 [#128] sdk: Implement owner ID type
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-09-18 10:45:11 +03:00