Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrorsPayload = errorx.NewNamespace("Payload") ErrorPayloadNotValid = errorx.NewType(ErrorsPayload, "NotValid") )
View Source
var ( ErrorsToken = errorx.NewNamespace("Token") ErrorTokenNotValid = errorx.NewType(ErrorsToken, "NotValid") ErrorTokenSigning = errorx.NewType(ErrorsToken, "ISigning") )
Functions ¶
func DefaultEncryption ¶
func DefaultEncryption(option *LicenseGenerator)
Default IEncryption Method
Types ¶
type License ¶
type License struct { Key string Secret secret.Secret Encryption encryption.IEncryption }
func (License) GetPayload ¶
Returns the Payload if valid
func (License) GetPayloadWithoutValidation ¶
Returns the Payload, ignores validation errors
type LicenseGenerator ¶
type LicenseGenerator struct { Signing signing.ISigning Secret secret.ISecret Encryption encryption.IEncryption // optional }
func NewLicenseGenerator ¶
func NewLicenseGenerator(options ...Options) *LicenseGenerator
Creates a new LicenseGenerator
func (*LicenseGenerator) GenerateLicense ¶
func (l *LicenseGenerator) GenerateLicense(from string, to string, product string, end time.Time, sign interface{}) (License, error)
Generates a encrypted License with a Secret
func (*LicenseGenerator) GenerateLicenseFromPayload ¶
func (l *LicenseGenerator) GenerateLicenseFromPayload(payload Payload, sign interface{}) (License, error)
Generate a License from a Payload. Returns the License and a Secret needed to encrypt to License
type Options ¶
type Options func(option *LicenseGenerator)
type Payload ¶
type Payload struct { jwt.StandardClaims Data map[string]interface{} }
type Token ¶
type Token struct {
*jwt.Token
}
func (*Token) GetPayload ¶
Returns the tokens Payload
func (*Token) Sign ¶
func (t *Token) Sign(sign interface{}) (TokenString, error)
Signs the Token with a secret message
type TokenString ¶
type TokenString string
Click to show internal directories.
Click to hide internal directories.