[#1255] node/session: Add persistent session storage

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2022-03-20 22:55:47 +03:00 committed by Alex Vanin
parent 929c9851a6
commit 455b9fb325
7 changed files with 331 additions and 20 deletions

View file

@ -0,0 +1,23 @@
package storage
import (
"fmt"
"github.com/google/uuid"
)
// NewTokenID generates new ID for a token
// based on UUID.
func NewTokenID() ([]byte, error) {
uid, err := uuid.NewRandom()
if err != nil {
return nil, fmt.Errorf("could not generate UUID: %w", err)
}
uidBytes, err := uid.MarshalBinary()
if err != nil {
return nil, fmt.Errorf("could not marshal marshal UUID: %w", err)
}
return uidBytes, nil
}