Help us shape the future of Go! Take the 2026 Go Developer Survey

licverifier

package
v3.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2026 License: AGPL-3.0 Imports: 10 Imported by: 9

Documentation

Overview

Package licverifier implements a simple library to verify MinIO Subnet license keys.

Example

Example creates a LicenseVerifier using the ECDSA public key in pemBytes. It uses the Verify method of the LicenseVerifier to verify and extract the claims present in the license key.

pemBytes := []byte(`-----BEGIN PUBLIC KEY-----
MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEbo+e1wpBY4tBq9AONKww3Kq7m6QP/TBQ
mr/cKCUyBL7rcAvg0zNq1vcSrUSGlAmY3SEDCu3GOKnjG/U4E7+p957ocWSV+mQU
9NKlTdQFGF3+aO6jbQ4hX/S5qPyF+a3z
-----END PUBLIC KEY-----`)

lv, err := NewLicenseVerifier(pemBytes)
if err != nil {
	fmt.Println("Failed to create license verifier", err)
}

licenseKey := "eyJhbGciOiJFUzM4NCIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJrYW5hZ2FyYWorYzFAbWluaW8uaW8iLCJjYXAiOjUwLCJvcmciOiJHcmluZ290dHMgSW5jLiIsImV4cCI6MS42NDE0NDYxNjkwMDExOTg4OTRlOSwicGxhbiI6IlNUQU5EQVJEIiwiaXNzIjoic3VibmV0QG1pbi5pbyIsImFpZCI6MSwiaWF0IjoxLjYwOTkxMDE2OTAwMTE5ODg5NGU5fQ.EhTL2xwMHnUoLQF4UR-5bjUCja3whseLU5mb9XEj7PvAae6HEIDCOMEF8Hhh20DN_v_LRE283j2ZlA5zulcXSZXS0CLcrKqbVy6QLvZfvvLuerOjJI-NBa9dSJWJ0WoN"
licInfo, err := lv.Verify(licenseKey)
if err != nil {
	fmt.Println("Failed to verify license key", err)
}

fmt.Println("License metadata", licInfo)

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LicenseInfo

type LicenseInfo struct {
	LicenseToken    string    // License token
	LicenseID       string    // Unique id of the license
	Email           string    // Email of the license key requestor
	Organization    string    // Subnet organization name
	AccountID       int64     // Subnet account id
	DeploymentID    string    // Cluster deployment ID
	StorageCapacity int64     // Storage capacity used in TB
	Plan            string    // Subnet plan
	IssuedAt        time.Time // Time of license issue
	ExpiresAt       time.Time // Time of license expiry
	APIKey          string    // Subnet account API Key
	IsTrial         bool      // Is this a TRIAL license?
}

LicenseInfo holds customer metadata present in the license key.

type LicenseVerifier

type LicenseVerifier struct {
	// contains filtered or unexported fields
}

LicenseVerifier needs an ECDSA public key in PEM format for initialization.

func NewLicenseVerifier

func NewLicenseVerifier(pemBytes []byte) (*LicenseVerifier, error)

NewLicenseVerifier returns an initialized license verifier with the given ECDSA public key in PEM format.

func (*LicenseVerifier) Verify

func (lv *LicenseVerifier) Verify(license string, options ...jwt.ParseOption) (LicenseInfo, error)

Verify verifies the license key and validates the claims present in it.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL