diff --git a/client/session.go b/client/session.go index ca490eb..d6051be 100644 --- a/client/session.go +++ b/client/session.go @@ -28,6 +28,8 @@ type ResSessionCreate struct { id []byte sessionKey []byte + + exp uint64 } func (x *ResSessionCreate) setID(id []byte) { @@ -50,6 +52,15 @@ func (x ResSessionCreate) PublicKey() []byte { return x.sessionKey } +func (x *ResSessionCreate) setExp(exp uint64) { + x.exp = exp +} + +// Expiration returns epoch number of the token expiration. +func (x ResSessionCreate) Expiration() uint64 { + return x.exp +} + // SessionCreate opens a session with the node server on the remote endpoint. // The session lifetime coincides with the server lifetime. Results can be written // to session token which can be later attached to the requests. @@ -104,6 +115,7 @@ func (c *Client) SessionCreate(ctx context.Context, prm PrmSessionCreate) (*ResS res.setID(body.GetID()) res.setSessionKey(body.GetSessionKey()) + res.setExp(reqBody.GetExpiration()) } // process call diff --git a/pool/pool.go b/pool/pool.go index 51c88ee..372566f 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -1671,6 +1671,7 @@ func sessionTokenForOwner(id *owner.ID, cliRes *sdkClient.ResSessionCreate) *ses st.SetOwnerID(id) st.SetID(cliRes.ID()) st.SetSessionKey(cliRes.PublicKey()) + st.SetExp(cliRes.Expiration()) return st }