Categorygithub.com/IgorPidik/go-jwt-licence
modulepackage
0.1.3
Repository: https://github.com/igorpidik/go-jwt-licence.git
Documentation: pkg.go.dev

# README

Simple JWT based licence

Installing

$ go get github.com/IgorPidik/go-jwt-licence

Importing

import licence "github.com/IgorPidik/go-jwt-licence"

Generating key pair

Private key:

$ openssl genrsa -out keys/id_rsa 4096

Public key:

$ openssl rsa -in keys/id_rsa -pubout -out keys/id_rsa.pub

Generating licence

generator, generatorErr := licence.NewLicenceGenerator("keys/id_rsa")
check(generatorErr)

expiresAt, parsingErr := time.Parse("2006-01-02", "2022-12-31")
check(parsingErr)

licenceData := &licence.LicenceData{
    ExpiresAt: expiresAt,
    Subject:   "Licence subject",
    Issuer:    "Licence issuer",
}

licence, licenceErr := generator.CreateLicence(licenceData)
check(licenceErr)

Validating licence

validator, validatorErr := licence.NewLicenceValidator("keys/id_rsa.pub")
check(validatorErr)
licenceData, licenceErr := validator.ValidateLicence(licence)
check(licenceErr)

# Packages

No description provided by the author

# Functions

No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author