Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct { PublicKey paseto.V4AsymmetricPublicKey // The (shareable) public key used for public tokens. SecretKey paseto.V4AsymmetricSecretKey // the (secret) private key used for public tokens. LocalKey paseto.V4SymmetricKey // The key used for local tokens. Purpose string // Must be either local or public. Issuer string // Who issued this token (i.e. example.com). Audience string // Who is the token issued for (i.e. example.com). Identifier string // A private identifier for this token. }
Options holds the options for our Pasty type.
type Pasty ¶
type Pasty struct {
Options Options
}
Pasty is the main type for this module. Create a variable of this type by calling the New function.
func (*Pasty) GenerateToken ¶
func (p *Pasty) GenerateToken(expires time.Time, claims map[string]any, footer string) (string, error)
GenerateToken will create and send back a token, with claims. If the receiver's Purpose parameter is public, it will create a token signed with the paseto.V4AsymmetricSecretKey stored in the receiver as SecretKey. If it is local, it will return a token encrypted with the paseto.V4SymmetricKey stored in the receiver as LocalKey.
func (*Pasty) ValidateLocalToken ¶
ValidateLocalToken validates token with the purpose local. It will also check issuer, audience and identifier (if supplied),
Click to show internal directories.
Click to hide internal directories.