Merge pull request #81 from nspcc-dev/service-token-owner-key

Update to neofs-api v0.7.5
This commit is contained in:
Alex Vanin 2020-05-15 16:48:08 +03:00 committed by GitHub
commit a82a2e1f57
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 149 additions and 43 deletions

View file

@ -1,4 +1,4 @@
PROTO_VERSION=v0.7.4 PROTO_VERSION=v0.7.5
PROTO_URL=https://github.com/nspcc-dev/neofs-api/archive/$(PROTO_VERSION).tar.gz PROTO_URL=https://github.com/nspcc-dev/neofs-api/archive/$(PROTO_VERSION).tar.gz
B=\033[0;1m B=\033[0;1m

View file

@ -132,6 +132,7 @@ User token granting rights for object manipulation
| Address | [refs.Address](#refs.Address) | | Address is an object address for which token is issued | | Address | [refs.Address](#refs.Address) | | Address is an object address for which token is issued |
| Lifetime | [TokenLifetime](#service.TokenLifetime) | | Lifetime is a lifetime of the session | | Lifetime | [TokenLifetime](#service.TokenLifetime) | | Lifetime is a lifetime of the session |
| SessionKey | [bytes](#bytes) | | SessionKey is a public key of session key | | SessionKey | [bytes](#bytes) | | SessionKey is a public key of session key |
| OwnerKey | [bytes](#bytes) | | OwnerKey is a public key of the token owner |
<a name="service.TokenLifetime"></a> <a name="service.TokenLifetime"></a>

View file

@ -103,6 +103,11 @@ func (m *Token_Info) SetSessionKey(key []byte) {
m.SessionKey = key m.SessionKey = key
} }
// SetOwnerKey is an OwnerKey field setter.
func (m *Token_Info) SetOwnerKey(key []byte) {
m.OwnerKey = key
}
// SetSignature is a Signature field setter. // SetSignature is a Signature field setter.
func (m *Token) SetSignature(sig []byte) { func (m *Token) SetSignature(sig []byte) {
m.Signature = sig m.Signature = sig
@ -169,11 +174,11 @@ func NewVerifiedSessionToken(token SessionToken) DataWithSignature {
} }
} }
func tokenInfoSize(v SessionKeySource) int { func tokenInfoSize(v SessionTokenInfo) int {
if v == nil { if v == nil {
return 0 return 0
} }
return fixedTokenDataSize + len(v.GetSessionKey()) return fixedTokenDataSize + len(v.GetSessionKey()) + len(v.GetOwnerKey())
} }
// Fills passed buffer with signing token information bytes. // Fills passed buffer with signing token information bytes.
@ -203,7 +208,9 @@ func copyTokenSignedData(buf []byte, token SessionTokenInfo) {
tokenEndianness.PutUint64(buf[off:], token.ExpirationEpoch()) tokenEndianness.PutUint64(buf[off:], token.ExpirationEpoch())
off += 8 off += 8
copy(buf[off:], token.GetSessionKey()) off += copy(buf[off:], token.GetSessionKey())
copy(buf[off:], token.GetOwnerKey())
} }
// SignedData concatenates signed data with session token information. Returns concatenation result. // SignedData concatenates signed data with session token information. Returns concatenation result.

View file

@ -77,6 +77,16 @@ func TestTokenGettersSetters(t *testing.T) {
require.Equal(t, key, tok.GetSessionKey()) require.Equal(t, key, tok.GetSessionKey())
} }
{
key := make([]byte, 10)
_, err := rand.Read(key)
require.NoError(t, err)
tok.SetOwnerKey(key)
require.Equal(t, key, tok.GetOwnerKey())
}
{ // Signature { // Signature
sig := make([]byte, 10) sig := make([]byte, 10)
_, err := rand.Read(sig) _, err := rand.Read(sig)
@ -126,6 +136,11 @@ func TestSignToken(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
token.SetSessionKey(sessionKey) token.SetSessionKey(sessionKey)
ownerKey := make([]byte, 10)
_, err = rand.Read(ownerKey[:])
require.NoError(t, err)
token.SetOwnerKey(ownerKey)
signedToken := NewSignedSessionToken(token) signedToken := NewSignedSessionToken(token)
verifiedToken := NewVerifiedSessionToken(token) verifiedToken := NewVerifiedSessionToken(token)
@ -211,6 +226,18 @@ func TestSignToken(t *testing.T) {
token.SetSessionKey(sessionKey) token.SetSessionKey(sessionKey)
}, },
}, },
{ // Owner key
corrupt: func() {
ownerKey := token.GetOwnerKey()
ownerKey[0]++
token.SetOwnerKey(ownerKey)
},
restore: func() {
ownerKey := token.GetOwnerKey()
ownerKey[0]--
token.SetOwnerKey(ownerKey)
},
},
} }
for _, v := range items { for _, v := range items {

View file

@ -158,6 +158,17 @@ type SignatureContainer interface {
SetSignature([]byte) SetSignature([]byte)
} }
// OwnerKeySource is an interface of the container of owner key bytes with read access.
type OwnerKeySource interface {
GetOwnerKey() []byte
}
// OwnerKeyContainer is an interface of the container of owner key bytes.
type OwnerKeyContainer interface {
OwnerKeySource
SetOwnerKey([]byte)
}
// SessionTokenSource is an interface of the container of a SessionToken with read access. // SessionTokenSource is an interface of the container of a SessionToken with read access.
type SessionTokenSource interface { type SessionTokenSource interface {
GetSessionToken() SessionToken GetSessionToken() SessionToken
@ -170,7 +181,8 @@ type SessionTokenSource interface {
// - verb of the session; // - verb of the session;
// - address of the session object; // - address of the session object;
// - token lifetime; // - token lifetime;
// - public session key bytes. // - public session key bytes;
// - owner's public key bytes.
type SessionTokenInfo interface { type SessionTokenInfo interface {
TokenIDContainer TokenIDContainer
OwnerIDContainer OwnerIDContainer
@ -178,6 +190,7 @@ type SessionTokenInfo interface {
AddressContainer AddressContainer
LifetimeContainer LifetimeContainer
SessionKeyContainer SessionKeyContainer
OwnerKeyContainer
} }
// SessionToken is an interface of token information and signature pair. // SessionToken is an interface of token information and signature pair.

View file

@ -240,6 +240,8 @@ type Token_Info struct {
TokenLifetime `protobuf:"bytes,5,opt,name=Lifetime,proto3,embedded=Lifetime" json:"Lifetime"` TokenLifetime `protobuf:"bytes,5,opt,name=Lifetime,proto3,embedded=Lifetime" json:"Lifetime"`
// SessionKey is a public key of session key // SessionKey is a public key of session key
SessionKey []byte `protobuf:"bytes,6,opt,name=SessionKey,proto3" json:"SessionKey,omitempty"` SessionKey []byte `protobuf:"bytes,6,opt,name=SessionKey,proto3" json:"SessionKey,omitempty"`
// OwnerKey is a public key of the token owner
OwnerKey []byte `protobuf:"bytes,7,opt,name=OwnerKey,proto3" json:"OwnerKey,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
@ -288,6 +290,13 @@ func (m *Token_Info) GetSessionKey() []byte {
return nil return nil
} }
func (m *Token_Info) GetOwnerKey() []byte {
if m != nil {
return m.OwnerKey
}
return nil
}
// TokenLifetime carries a group of lifetime parameters of the token // TokenLifetime carries a group of lifetime parameters of the token
type TokenLifetime struct { type TokenLifetime struct {
// Created carries an initial epoch of token lifetime // Created carries an initial epoch of token lifetime
@ -354,43 +363,44 @@ func init() {
func init() { proto.RegisterFile("service/verify.proto", fileDescriptor_4bdd5bc50ec96238) } func init() { proto.RegisterFile("service/verify.proto", fileDescriptor_4bdd5bc50ec96238) }
var fileDescriptor_4bdd5bc50ec96238 = []byte{ var fileDescriptor_4bdd5bc50ec96238 = []byte{
// 567 bytes of a gzipped FileDescriptorProto // 579 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x53, 0x4d, 0x6f, 0xd3, 0x40, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x53, 0x4f, 0x6f, 0x12, 0x41,
0x10, 0xed, 0x26, 0xce, 0xd7, 0xf4, 0x03, 0xb3, 0x20, 0x64, 0x22, 0x94, 0x44, 0x11, 0x87, 0x54, 0x14, 0xef, 0xc0, 0xc2, 0xc2, 0xeb, 0x1f, 0xd7, 0xd1, 0x98, 0x95, 0x18, 0x20, 0xc4, 0x03, 0x4d,
0x22, 0x8e, 0x94, 0x4a, 0x08, 0x09, 0x2e, 0x0d, 0x11, 0x34, 0xa2, 0x82, 0x6a, 0x53, 0x7a, 0xe0, 0x64, 0x49, 0x68, 0x62, 0x4c, 0xf4, 0x52, 0x24, 0x5a, 0x62, 0xa3, 0xcd, 0x50, 0x7b, 0xf0, 0xb6,
0xe6, 0xd8, 0x63, 0x77, 0x45, 0xeb, 0x0d, 0xbb, 0x9b, 0xa0, 0xfe, 0x13, 0x7e, 0x03, 0xbf, 0x83, 0xc0, 0x63, 0x3b, 0xb1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f, 0x46, 0x11, 0xaa, 0xae, 0x37, 0xcb, 0x2a, 0xf9, 0xb5, 0xac, 0x92, 0xaf, 0xbf, 0xab, 0x5b, 0x1f, 0xf6, 0x33, 0x5f, 0x2a, 0x56,
0xe5, 0xdd, 0x48, 0xf4, 0xb2, 0x1b, 0x7d, 0x2d, 0xdc, 0x7d, 0x8b, 0xe2, 0xd5, 0xd8, 0x3d, 0x3c, 0xd3, 0xd1, 0xa8, 0x35, 0xc6, 0x79, 0x3b, 0x46, 0x31, 0x51, 0xad, 0x70, 0xca, 0x5b, 0x91, 0x68,
0x19, 0xb9, 0xe3, 0x94, 0x9b, 0x94, 0xcd, 0x6b, 0x3a, 0xf8, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x13, 0xa7, 0xfb, 0xfb, 0x96, 0xbb, 0xfb, 0x16, 0xc5, 0xab, 0x41, 0x70, 0x78, 0xd2, 0x0f, 0x06, 0x09,
0xf0, 0xba, 0xcc, 0xaf, 0x03, 0x00, 0x00, 0x37, 0x2c, 0xda, 0x9f, 0x76, 0xf0, 0x37, 0x00, 0x00, 0xff, 0xff, 0xcb, 0xab, 0x17, 0xd9, 0xcb,
0x03, 0x00, 0x00,
} }
func (m *RequestVerificationHeader) Marshal() (dAtA []byte, err error) { func (m *RequestVerificationHeader) Marshal() (dAtA []byte, err error) {
@ -555,6 +565,13 @@ func (m *Token_Info) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i -= len(m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized)
} }
if len(m.OwnerKey) > 0 {
i -= len(m.OwnerKey)
copy(dAtA[i:], m.OwnerKey)
i = encodeVarintVerify(dAtA, i, uint64(len(m.OwnerKey)))
i--
dAtA[i] = 0x3a
}
if len(m.SessionKey) > 0 { if len(m.SessionKey) > 0 {
i -= len(m.SessionKey) i -= len(m.SessionKey)
copy(dAtA[i:], m.SessionKey) copy(dAtA[i:], m.SessionKey)
@ -739,6 +756,10 @@ func (m *Token_Info) Size() (n int) {
if l > 0 { if l > 0 {
n += 1 + l + sovVerify(uint64(l)) n += 1 + l + sovVerify(uint64(l))
} }
l = len(m.OwnerKey)
if l > 0 {
n += 1 + l + sovVerify(uint64(l))
}
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized) n += len(m.XXX_unrecognized)
} }
@ -1350,6 +1371,40 @@ func (m *Token_Info) Unmarshal(dAtA []byte) error {
m.SessionKey = []byte{} m.SessionKey = []byte{}
} }
iNdEx = postIndex iNdEx = postIndex
case 7:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field OwnerKey", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowVerify
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthVerify
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthVerify
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.OwnerKey = append(m.OwnerKey[:0], dAtA[iNdEx:postIndex]...)
if m.OwnerKey == nil {
m.OwnerKey = []byte{}
}
iNdEx = postIndex
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipVerify(dAtA[iNdEx:]) skippy, err := skipVerify(dAtA[iNdEx:])

View file

@ -63,6 +63,9 @@ message Token {
// SessionKey is a public key of session key // SessionKey is a public key of session key
bytes SessionKey = 6; bytes SessionKey = 6;
// OwnerKey is a public key of the token owner
bytes OwnerKey = 7;
} }
// TokenInfo is a grouped information about token // TokenInfo is a grouped information about token