|
@@ -4,7 +4,7 @@
|
|
|
package pro
|
|
|
|
|
|
import (
|
|
|
- "fmt"
|
|
|
+ "errors"
|
|
|
)
|
|
|
|
|
|
// constants for accounts api hosts
|
|
@@ -23,7 +23,7 @@ const (
|
|
|
server_id_key = "nm-server-id"
|
|
|
)
|
|
|
|
|
|
-var errValidation = fmt.Errorf(license_validation_err_msg)
|
|
|
+var errValidation = errors.New(license_validation_err_msg)
|
|
|
|
|
|
// LicenseKey - the license key struct representation with associated data
|
|
|
type LicenseKey struct {
|
|
@@ -42,14 +42,14 @@ type LicenseKey struct {
|
|
|
|
|
|
// ValidatedLicense - the validated license struct
|
|
|
type ValidatedLicense struct {
|
|
|
- LicenseValue string `json:"license_value" binding:"required"` // license that validation is being requested for
|
|
|
+ LicenseValue string `json:"license_value" binding:"required"` // license that validation is being requested for
|
|
|
EncryptedLicense string `json:"encrypted_license" binding:"required"` // to be decrypted by Netmaker using Netmaker server's private key
|
|
|
}
|
|
|
|
|
|
// LicenseSecret - the encrypted struct for sending user-id
|
|
|
type LicenseSecret struct {
|
|
|
AssociatedID string `json:"associated_id" binding:"required"` // UUID for user foreign key to User table
|
|
|
- Usage Usage `json:"limits" binding:"required"`
|
|
|
+ Usage Usage `json:"limits" binding:"required"`
|
|
|
}
|
|
|
|
|
|
// Usage - struct for license usage
|
|
@@ -81,9 +81,9 @@ func (l *Usage) SetDefaults() {
|
|
|
|
|
|
// ValidateLicenseRequest - used for request to validate license endpoint
|
|
|
type ValidateLicenseRequest struct {
|
|
|
- LicenseKey string `json:"license_key" binding:"required"`
|
|
|
+ LicenseKey string `json:"license_key" binding:"required"`
|
|
|
NmServerPubKey string `json:"nm_server_pub_key" binding:"required"` // Netmaker server public key used to send data back to Netmaker for the Netmaker server to decrypt (eg output from validating license)
|
|
|
- EncryptedPart string `json:"secret" binding:"required"`
|
|
|
+ EncryptedPart string `json:"secret" binding:"required"`
|
|
|
}
|
|
|
|
|
|
type licenseResponseCache struct {
|