Commit graph

51 commits

Author SHA1 Message Date
Evgenii Stratonikov
94f068e462 *: remove error from StableMarshal return values
We marshal only in-memory structures, no error is expected.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-04-21 15:07:57 +03:00
Evgenii Stratonikov
84d981e88e util/proto: do not return error from primitive marshalers
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-04-21 15:07:57 +03:00
Evgenii Stratonikov
732dd51b1b [#388] *: Remove nil check from setters
I knew one day `sed` would save me an hour of manual work:
```
sed -i -n -e '
s/) Set/) Set/
p
t setter
b end
:setter
    n
    s/nil/nil/
    t hasif
    p
    b end
    :hasif
        n
        :loop
        p
        n
        s/}/}/
        t end
        b loop
        :end
' $@
goimports -w $@
```

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-03-31 11:32:04 +03:00
Evgenii Stratonikov
e21a7823c5 [#376] session: Make XHeader slice non-pointer
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-03-15 12:19:49 +03:00
Leonard Lyubich
fd3bf4a56b Fix linter remarks
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-25 11:12:57 +03:00
Leonard Lyubich
99370889d1 [#371] Support recent changes in NeoFS API protocol
Support:
  * new status codes (object, container, session);
  * object `Lock` message;
  * different signature schemes.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-25 10:24:07 +03:00
Leonard Lyubich
227a871a04 [#367] session: Support magic_number field of RequestMetaHeader
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-01-14 13:17:21 +03:00
Leonard Lyubich
e9a8451fb7 [#367] *: Re-compile proto files of NeoFS API protocol
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-01-14 13:17:21 +03:00
Leonard Lyubich
0f09f0dfc6 Re-compile NeoFS API proto files using updated script
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-11-17 15:29:33 +03:00
Leonard Lyubich
25da5d2e13 Add v2 version to go module name
Replace all elements from `v2` to root directory.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-11-17 15:29:33 +03:00
Alex Vanin
1f143e54bd Move api-v2 files into v2 subdir
This subdir contains generated proto files
and small wrappers.
2020-09-18 10:40:17 +03:00
Leonard Lyubich
0ee1c3653d Implement field setters on all protobuf messages
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-09-18 10:40:17 +03:00
Alex Vanin
fabdd78d63 Add pre-release jindo branch 2020-09-18 10:39:50 +03:00
Alex Vanin
0a5d0ff1a2 Remove v1 code 2020-09-18 10:39:45 +03:00
Leonard Lyubich
74e917810a service: support broken apart signable payload of the requests
In previous implementation service package provided types and functions
that wrapped signing/verification of data with session token.
This allowed us to use these functions for signing / verification of
service requests of other packages. To support the expansion of messages
with additional parts that need to be signed, you must be able to easily
expand the signed data with new parts.

To achieve the described goal, this commit makes the following changes:

  * adds GroupSignedPayloads and GroupVerifyPayloads functions;

  * renames SignedDataWithToken to RequestData, DataWithTokenSignAccumulator
    to RequestSignedData, DataWithTokenSignSource to RequestVerifyData;

  * renames SignDataWithSessionToken/VerifyAccumulatedSignaturesWithToken
    function to SignRequestData/VerifyRequestData and makes it to use
    GroupSignedPayloads/GroupVerifyPayloads internally.
2020-06-10 20:37:10 +03:00
Leonard Lyubich
291d512840 session: implement function for receiving session public key bytes
After recent changes PrivateToken cannot directly return public key
bytes. In order to provide this ability, this commit implements
a function over PrivateToken interface.
2020-05-18 16:47:15 +03:00
Leonard Lyubich
af28735ca6 session: change PrivateToken interface methods
This commit replaces PublicKey() and SignData() methods of PrivateToken
with PrivateKey() in order to have the ability to sign data with
session key using service package functions.
2020-05-18 16:47:15 +03:00
Leonard Lyubich
e01fb0cc62 Implement signed data calculating function from SignedDataReader 2020-05-11 17:28:44 +03:00
Leonard Lyubich
af73d958a1 session: add OwnerID to a private token storage key 2020-05-08 13:23:30 +03:00
Leonard Lyubich
15a55d54a2 fix comments 2020-05-08 12:45:16 +03:00
Leonard Lyubich
2c2150b101 session: move errors to a separate file 2020-05-08 12:37:56 +03:00
Leonard Lyubich
b079a7604f session: implement gRPC session creator 2020-05-08 12:34:16 +03:00
Leonard Lyubich
6d71ea239b session: implement SignedDataSource on CreateRequest 2020-05-08 11:55:19 +03:00
Leonard Lyubich
1932658a7d session: implement getters and setters on messages 2020-05-08 11:53:49 +03:00
Leonard Lyubich
d8cc00b54c Update to neofs-api v0.7.4 2020-05-08 10:49:23 +03:00
Leonard Lyubich
4fa7360cd1 session: support the expiration of private tokens
All sessions in NeoFS has limited in epochs lifetime. There is a need
to limit the lifetime of private session tokens.

This commmit:

  * extends PrivateToken interface with Expired method;

  * defines EpochLifetimeStore interface with RemoveExpired method
    and embeds it to PrivateTokenStore interface;

  * adds epoch value parameter to private token constructor.
2020-04-29 14:11:19 +03:00
Leonard Lyubich
ffd4338eb3 session: fix NewPrivateToken function doc 2020-04-29 12:59:58 +03:00
Leonard Lyubich
608f578105 session: removes unused errors 2020-04-29 12:50:52 +03:00
Leonard Lyubich
79142ada04 session: replace used type aliases to separate file 2020-04-29 12:49:27 +03:00
Leonard Lyubich
f0867036fb session: remove trivial defaultCurve function 2020-04-29 12:46:05 +03:00
Leonard Lyubich
701bbafcf1 session: change KeyStore documentation 2020-04-29 12:44:35 +03:00
Leonard Lyubich
22265a9f03 session: refactor token store
This commit:

  * changes the set and signatures of TokenStore interface methods;

  * adds unit test for map storage.
2020-04-29 12:39:41 +03:00
Leonard Lyubich
dfc2dd8a78 session: replace PToken structure with PrivateToken interface
In previous implementation PToken contained the full Token structure.
Since private token is used for data signature only, storing unused
fields of a user token is impractical. To emphasize the purpose of
the private part of the session, it makes sense to provide the user
of the session package with its interface. The interface will only provide
the functionality of data signing with private session key.

This commit:

  * removes PToken structure from session package;

  * defines PrivateToken interface of private session part;

  * adds the implementation of PrivateToken on unexported struct;

  * provides the constructor that generates session key internally.
2020-04-29 11:52:05 +03:00
Leonard Lyubich
c6971d2004 service: access Token message fields through getters and setters 2020-04-28 18:40:21 +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
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
alexvanin
01b910fd31 session: Add public key to the constructor of new private token
Private token based on the token with private key. Therefore
it must inherit public key field through constructor parameter.
2020-01-17 14:56:51 +03:00
alexvanin
b556d54f16 session: Modify verify routine to check owner id connection with public keys 2020-01-17 13:18:36 +03:00
alexvanin
e88a6ee028 session: Add owner's public key into session token
We want to remove all innner ring queries to authenticate
owner by public keys. Therefore we put public keys into
session token. Later public keys could be gathered with NeoID
or other centre of authority.
2020-01-17 13:18:36 +03:00
Evgeniy Kulikov
1a9a840d17
proto: regenerate proto files 2019-11-21 16:16:39 +03:00
Evgeniy Kulikov
c35eefec3b
docs: add doc comments for session and state requests 2019-11-21 16:16:34 +03:00
Evgeniy Kulikov
24e5497b1d
Update develop branch 2019-11-21 13:10:57 +03:00
Evgeniy Kulikov
165dc9abd7
linter: fix doc comments issues 2019-11-21 13:01:08 +03:00
Evgeniy Kulikov
e333a13557
docs: regenerate proto files 2019-11-21 10:34:38 +03:00
Evgeniy Kulikov
15b997bdb5
docs: update proto doc comments to satisfy go-doc comment 2019-11-21 10:26:01 +03:00
alexvanin
0af63c42cc docs: regenerate proto files 2019-11-20 21:43:04 +03:00
Leonard Lyubich
04f1cbca48 docs: add session proto documentation 2019-11-20 21:43:04 +03:00