diff --git a/client/session.go b/client/session.go index 3e1180e3..b3ec7229 100644 --- a/client/session.go +++ b/client/session.go @@ -16,30 +16,32 @@ import ( // PrmSessionCreate groups parameters of SessionCreate operation. type PrmSessionCreate struct { - prmCommonMeta + XHeaders []string - exp uint64 + Expiration uint64 - keySet bool - key ecdsa.PrivateKey + Key *ecdsa.PrivateKey } // SetExp sets number of the last NepFS epoch in the lifetime of the session after which it will be expired. +// +// Deprecated: Use PrmSessionCreate.Expiration instead. func (x *PrmSessionCreate) SetExp(exp uint64) { - x.exp = exp + x.Expiration = exp } // UseKey specifies private key to sign the requests and compute token owner. // If key is not provided, then Client default key is used. +// +// Deprecated: Use PrmSessionCreate.Key instead. func (x *PrmSessionCreate) UseKey(key ecdsa.PrivateKey) { - x.keySet = true - x.key = key + x.Key = &key } func (x *PrmSessionCreate) buildRequest(c *Client) (*v2session.CreateRequest, error) { ownerKey := c.prm.key.PublicKey - if x.keySet { - ownerKey = x.key.PublicKey + if x.Key != nil { + ownerKey = x.Key.PublicKey } var ownerID user.ID user.IDFromKey(&ownerID, ownerKey) @@ -49,10 +51,10 @@ func (x *PrmSessionCreate) buildRequest(c *Client) (*v2session.CreateRequest, er reqBody := new(v2session.CreateRequestBody) reqBody.SetOwnerID(&ownerIDV2) - reqBody.SetExpiration(x.exp) + reqBody.SetExpiration(x.Expiration) var meta v2session.RequestMetaHeader - writeXHeadersToMeta(x.xHeaders, &meta) + writeXHeadersToMeta(x.XHeaders, &meta) var req v2session.CreateRequest req.SetBody(reqBody)