forked from TrueCloudLab/frostfs-node
929c9851a6
Move in-memory session storage to the separate directory of `storage`. It is done for future support of different kind of session storages. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
32 lines
676 B
Go
32 lines
676 B
Go
package storage
|
|
|
|
import (
|
|
"crypto/ecdsa"
|
|
)
|
|
|
|
// PrivateToken represents private session info.
|
|
type PrivateToken struct {
|
|
sessionKey *ecdsa.PrivateKey
|
|
|
|
exp uint64
|
|
}
|
|
|
|
// SetSessionKey sets a private session key.
|
|
func (t *PrivateToken) SetSessionKey(sessionKey *ecdsa.PrivateKey) {
|
|
t.sessionKey = sessionKey
|
|
}
|
|
|
|
// SetExpiredAt sets epoch number until token is valid.
|
|
func (t *PrivateToken) SetExpiredAt(exp uint64) {
|
|
t.exp = exp
|
|
}
|
|
|
|
// SessionKey returns the private session key.
|
|
func (t *PrivateToken) SessionKey() *ecdsa.PrivateKey {
|
|
return t.sessionKey
|
|
}
|
|
|
|
// ExpiredAt returns epoch number until token is valid.
|
|
func (t *PrivateToken) ExpiredAt() uint64 {
|
|
return t.exp
|
|
}
|