From bc413f628071b1ff529da97a1ce959e7632d1c04 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 15 May 2020 16:03:47 +0300 Subject: [PATCH] service: defined OwnerKeyContainer and embed it to SessionInfo interface --- service/token.go | 5 +++++ service/types.go | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/service/token.go b/service/token.go index cce10592..2497718a 100644 --- a/service/token.go +++ b/service/token.go @@ -103,6 +103,11 @@ func (m *Token_Info) SetSessionKey(key []byte) { 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. func (m *Token) SetSignature(sig []byte) { m.Signature = sig diff --git a/service/types.go b/service/types.go index 31f45070..66582f56 100644 --- a/service/types.go +++ b/service/types.go @@ -158,6 +158,17 @@ type SignatureContainer interface { 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. type SessionTokenSource interface { GetSessionToken() SessionToken @@ -170,7 +181,8 @@ type SessionTokenSource interface { // - verb of the session; // - address of the session object; // - token lifetime; -// - public session key bytes. +// - public session key bytes; +// - owner's public key bytes. type SessionTokenInfo interface { TokenIDContainer OwnerIDContainer @@ -178,6 +190,7 @@ type SessionTokenInfo interface { AddressContainer LifetimeContainer SessionKeyContainer + OwnerKeyContainer } // SessionToken is an interface of token information and signature pair.