Implement offline license verification (T-502)

This commit is contained in:
ila
2026-07-20 01:29:40 +08:00
parent c51ff30c54
commit cd76f7f900
12 changed files with 887 additions and 239 deletions
+25
View File
@@ -0,0 +1,25 @@
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
}