package token
import "git.sr.ht/~pingoo/stdx/token"
Index ¶
- Constants
- Variables
- type Token
- func FromIdAndHash(prefix string, id guid.GUID, hash []byte) (token Token, err error)
- func New(prefix string) (token Token, err error)
- func NewWithID(prefix string, id guid.GUID) (token Token, err error)
- func Parse(prefix, input string) (token Token, err error)
- func (token *Token) Hash() []byte
- func (token *Token) ID() guid.GUID
- func (token *Token) Refresh() (err error)
- func (token *Token) Secret() []byte
- func (token *Token) String() string
- func (token *Token) Verify(hash []byte) (err error)
Constants ¶
const ( SecretSize = crypto.KeySize256 HashSize = crypto.KeySize256 )
Variables ¶
var ( ErrTokenIsNotValid = errors.New("token is not valid") ErrDataIsTooLong = errors.New("data is too long") )
Types ¶
type Token ¶
type Token struct {
// contains filtered or unexported fields
}
func FromIdAndHash ¶
FromIdAndHash creates a new token from an ID and a Hash it means that the token needs to be refreshed with `Refresh` before being able to use it as we din't have the secret, and thus cannot convert it to a valid string
func New ¶
func NewWithID ¶
func Parse ¶
func (*Token) Hash ¶
func (*Token) ID ¶
func (*Token) Refresh ¶
func (*Token) Secret ¶
func (*Token) String ¶
func (*Token) Verify ¶
Source Files ¶
token.go
- Version
- v0.0.0-20240218134121-094174641f6e (latest)
- Published
- Feb 18, 2024
- Platform
- linux/amd64
- Imports
- 7 packages
- Last checked
- 4 months ago –
Tools for package owners.