26 lines
616 B
Go
26 lines
616 B
Go
package licensing
|
|
|
|
import "time"
|
|
|
|
// License is a verified License v1 document. It never contains the source
|
|
// document, signature, public key, or raw machine identifiers.
|
|
type License struct {
|
|
LicenseID string
|
|
MachineHash string
|
|
Products []string
|
|
IssuedAt time.Time
|
|
Perpetual bool
|
|
UpdatePolicy string
|
|
RebindPolicy string
|
|
}
|
|
|
|
// AuthorizesProduct reports whether this verified license lists productID.
|
|
func (license License) AuthorizesProduct(productID string) bool {
|
|
for _, licensedProduct := range license.Products {
|
|
if licensedProduct == productID {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|