Commit graph

32 commits

Author SHA1 Message Date
Leonard Lyubich
b785eb710a service: transfer TTL code to a separate file 2020-05-04 13:38:27 +03:00
Leonard Lyubich
fc177c4ce3 service: change constant errors
This commit:

  * moves defined errors to a separate file;

  * renames ErrEmptyToken to ErrNilToken;

  * merges ErrZeroTTL and ErrIncorrectTTL into single ErrInvalidTTL.
2020-05-04 13:06:36 +03:00
Leonard Lyubich
cce6566f1e service: prevent NPE in VerifyTokenSignature function
This commit adds next changes to VerifyTokenSignature:

  * returns ErrEmptyToken on nil token argument;

  * returns ErrEmptyPublicKey on nil public key argument.
2020-04-29 10:57:07 +03:00
Leonard Lyubich
82ffde253b service: implement Sign/Verify functions for SessionToken 2020-04-28 19:03:15 +03:00
Leonard Lyubich
c6971d2004 service: access Token message fields through getters and setters 2020-04-28 18:40:21 +03:00
Leonard Lyubich
d327d836c4 service: define and implement Token field composing interface
This commit:

  * defines SessionToken interface of Token field getters/setters group;

  * implements SessionToken on Token message.
2020-04-28 17:09:01 +03:00
Leonard Lyubich
942bedb8ed service: implement Token field setter on RequestVerificationHeader
After recent changes Token field is presented in RequestVerificationHeader.
There is a need to provide an interface of field getter/setter.

This commit:

  * defines TokenHeader interface of token value container;

  * implements Token field setter on RequestVerificationHeader.
2020-04-28 17:02:47 +03:00
Leonard Lyubich
09f8ee52d0 service: implement Raw field setter on RequestMetaHeader struct
After recent changes Raw field is presented in RequestMetaHeader.
There is a need to provide an interface of field getter/setter.

This commit:

  * defines RawHeader interface of raw value container;

  * embeds RawHeader into MetaHeader interface;

  * implements Raw field setter on RequestMetaHeader.
2020-04-28 17:02:47 +03:00
Leonard Lyubich
4ac17201b7 Resolve update conflicts 2020-04-28 13:33:43 +03:00
Leonard Lyubich
e63d112cb2 Update to neofs-api v0.7.2 2020-04-28 12:50:52 +03:00
Evgeniy Kulikov
b118f469d2
Migrate to new repo 2020-03-31 10:05:26 +03:00
Leonard Lyubich
a21e42ea4f Implement Epoch and Version setters on ResponseMetaHeader 2020-02-14 12:17:48 +03:00
Evgeniy Kulikov
de09878df1
Response meta header 2020-02-13 18:10:46 +03:00
Evgeniy Kulikov
49cc731c8d
update proto files, regenerate pb.go 2020-02-05 16:58:06 +03:00
Evgeniy Kulikov
53af48372f
prepare to rename neofs-proto to neofs-api 2020-01-30 16:35:30 +03:00
Evgeniy Kulikov
8d028100e9
service: Use sync pool for Sign/Verify request headers
```
// Before
BenchmarkSignRequestHeader-8   	     146	   8070375 ns/op	 4210607 B/op	      48 allocs/op
BenchmarkVerifyRequestHeader-8   	      14	  83058325 ns/op	42085955 B/op	    1601 allocs/op

// After
BenchmarkSignRequestHeader-8   	     156	   7709172 ns/op	   33902 B/op	      45 allocs/op
BenchmarkVerifyRequestHeader-8   	      15	  76910232 ns/op	   54368 B/op	    1563 allocs/op

// Summary:
benchmark                          old ns/op     new ns/op     delta
BenchmarkSignRequestHeader-8       8070375       7709172       -4.48%
BenchmarkVerifyRequestHeader-8     83058325      76910232      -7.40%

benchmark                          old allocs     new allocs     delta
BenchmarkSignRequestHeader-8       48             45             -6.25%
BenchmarkVerifyRequestHeader-8     1601           1563           -2.37%

benchmark                          old bytes     new bytes     delta
BenchmarkSignRequestHeader-8       4210607       33902         -99.19%
BenchmarkVerifyRequestHeader-8     42085955      54368         -99.87%
```
2019-12-20 17:14:51 +03:00
Evgeniy Kulikov
891ba27ede
service: get rid of proto.Message in Maintainable/Verifiable requests 2019-12-05 14:30:08 +03:00
Evgeniy Kulikov
ab70f84999
Merge pull request #21 from nspcc-dev/fix/get-status-error-even-if-it-is-wrapped
Get status error even if it is wrapped
2019-11-26 14:20:05 +03:00
Evgeniy Kulikov
a893e389b0
service: test coverage for wrapped status errors 2019-11-26 14:09:23 +03:00
Evgeniy Kulikov
d08f5a5811
service: get status error even if it is wrapped 2019-11-26 14:08:52 +03:00
Evgeniy Kulikov
20c10a2afd
service: rename EpochRequest to EpochHeader and merge with MetaHeader 2019-11-26 13:57:29 +03:00
Evgeniy Kulikov
40038cc860
service: test coverage for CheckOwner 2019-11-26 13:43:01 +03:00
Evgeniy Kulikov
eda9ea3829
service: add method to RequestVerificationHeader to validate owner 2019-11-26 13:43:01 +03:00
Evgeniy Kulikov
8967a0d1f5
service: remove SignRequest, VerifyRequest and accompanying code 2019-11-26 13:36:48 +03:00
Evgeniy Kulikov
5c031fc6b2
service: ProcessRequestTTL shouldn't change status errors 2019-11-25 15:47:57 +03:00
Evgeniy Kulikov
1a9a840d17
proto: regenerate proto files 2019-11-21 16:16:39 +03:00
Evgeniy Kulikov
e2842ae216
docs: add doc comments for meta and verify proto files 2019-11-21 16:16:34 +03:00
Evgeniy Kulikov
b8f3641b59
service: add SetVersion to satisfy MetaHeader interface 2019-11-21 16:16:34 +03:00
Evgeniy Kulikov
16101b7d84
proto: add version of protocol into meta header 2019-11-21 15:13:07 +03:00
Evgeniy Kulikov
5c344bfceb
Fix issue with Sign/VerifyRequestHeader proto.Clone
proto.Clone couldn't makes copy for custom fields.
We should reset and restore MetaHeader before/after Sign/Verify.
Add test coverage to check that all works like expected.
2019-11-21 13:10:57 +03:00
Evgeniy Kulikov
24e5497b1d
Update develop branch 2019-11-21 13:10:57 +03:00
Evgeniy Kulikov
1cf33e5ffd
initial 2019-11-18 16:34:06 +03:00