Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CLI ¶
type CLI struct {
Genkey GenKey `kong:"cmd,help='Generate new keys.'"`
Encrypt Encrypt `kong:"cmd,help='Generate a new encrypted token.'"`
Sign Sign `kong:"cmd,help='Generate a new signed token.'"`
Parse Parse `kong:"cmd,help='Parse and optionally validate a token.'"`
Log struct {
Level slog.Level `enum:"DEBUG,INFO,WARN,ERROR" default:"INFO" help:"Set the app logging level."`
} `embed:"" prefix:"log-"`
Version kong.VersionFlag `env:"-" help:"Output version and exit."`
// contains filtered or unexported fields
}
CLI is the command line interface of PASETO.
type ClaimsMapper ¶
type ClaimsMapper struct {
// contains filtered or unexported fields
}
ClaimsMapper parses token claims from CLI arguments and stdin.
func (ClaimsMapper) Decode ¶
func (cm ClaimsMapper) Decode(kctx *kong.DecodeContext, target reflect.Value) error
Decode implements the kong.Mapper interface.
type ClaimsOption ¶
type ClaimsOption struct {
// contains filtered or unexported fields
}
ClaimsOption contains token claims passed via CLI arguments and stdin.
type Encrypt ¶
type Encrypt struct {
ProtocolVersion ProtocolVersionOption `default:"4" env:"PASETO_VERSION" short:"v" help:"Version of the PASETO protocol. Valid values: 2,3,4"`
KeyFile string `required:"" short:"k" help:"Path to a symmetric key file to encrypt the token."`
Expiration time.Time `` /* 197-byte string literal not displayed */
Claims ClaimsOption `` /* 192-byte string literal not displayed */
}
Encrypt generates a new encrypted token.
type ExpirationMapper ¶
type ExpirationMapper struct {
// contains filtered or unexported fields
}
ExpirationMapper parses the token expiration duration or timestamp.
func (ExpirationMapper) Decode ¶
func (em ExpirationMapper) Decode(kctx *kong.DecodeContext, target reflect.Value) error
Decode implements the kong.Mapper interface.
type GenKey ¶
type GenKey struct {
ProtocolVersion ProtocolVersionOption `default:"4" env:"PASETO_VERSION" short:"v" help:"Version of the PASETO protocol. Valid values: 2,3,4"`
ProtocolPurpose paseto.Purpose `` /* 169-byte string literal not displayed */
OutFile string `env:"PASETO_KEY_OUT_FILE" short:"o" help:"Base file path to write the key(s) to; stdout will be used if not specified."`
Encoding xpaseto.KeyEncoding `env:"PASETO_KEY_ENCODING" enum:"hex,pem" default:"hex" short:"e" help:"Encoding type. Valid values: ${enum}"`
}
GenKey generates new keys.
type Parse ¶
type Parse struct {
KeyFile string `` /* 143-byte string literal not displayed */
OutputFormat xpaseto.TokenFormat `enum:"text,json" env:"PASETO_TOKEN_OUTPUT_FORMAT" default:"text" short:"o" help:"Token output format. Valid values: ${enum}"`
Validate bool `default:"true" negatable:"" help:"Whether to validate the token."`
TimeSkewTolerance time.Duration `` /* 166-byte string literal not displayed */
Token string `arg:"" help:"the token"`
}
Parse parses and optionally validates a token.
type ProtocolVersionOption ¶
ProtocolVersionOption is a custom option that parses the protocol version.
func (*ProtocolVersionOption) UnmarshalText ¶
func (o *ProtocolVersionOption) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
func (*ProtocolVersionOption) Validate ¶
func (o *ProtocolVersionOption) Validate() error
Validate implements kong's Validatable interface.
type Sign ¶
type Sign struct {
ProtocolVersion ProtocolVersionOption `default:"4" env:"PASETO_VERSION" short:"v" help:"Version of the PASETO protocol. Valid values: 2,3,4"`
KeyFile string `required:"" short:"k" help:"Path to a private key file to sign the token."`
Expiration time.Time `` /* 197-byte string literal not displayed */
Claims ClaimsOption `` /* 192-byte string literal not displayed */
}
Sign generates a new signed token.