[#137] Add exp to ResSessionCreate
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
parent
11a25bb413
commit
7df00fb0eb
2 changed files with 13 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue