Skip to content

Commit

Permalink
Small fix to licenseKey encoding (#769)
Browse files Browse the repository at this point in the history
So that it's not base64 re-encoded
  • Loading branch information
mieciu authored Sep 16, 2024
1 parent 1e0eb3e commit 4352fca
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions quesma/licensing/license_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type InstallationIDPayload struct {
}

type LicensePayload struct {
LicenseKey []byte `json:"license_key"`
LicenseKey string `json:"license_key"`
}

// obtainLicenseKey presents an InstallationId to the license server and receives a LicenseKey in return
Expand All @@ -46,7 +46,7 @@ func (l *LicenseModule) obtainLicenseKey() (err error) {
if err = json.Unmarshal(body, &licenseResponse); err != nil {
return err
}
l.LicenseKey = licenseResponse.LicenseKey
l.LicenseKey = []byte(licenseResponse.LicenseKey)
fmt.Printf("License key obtained and set successfully, key=[%s.....%s]\n", string(l.LicenseKey[:8]), string(l.LicenseKey[len(l.LicenseKey)-8:]))
return nil
}
Expand All @@ -68,7 +68,7 @@ func (l *LicenseModule) processLicense() error {

func (l *LicenseModule) fetchLicense() (a *License, err error) {
var payloadBytes []byte
if payloadBytes, err = json.Marshal(LicensePayload{LicenseKey: l.LicenseKey}); err != nil {
if payloadBytes, err = json.Marshal(LicensePayload{LicenseKey: string(l.LicenseKey)}); err != nil {
return nil, err
}
resp, err := http.Post(verifyLicenseEndpoint, "application/json", bytes.NewReader(payloadBytes))
Expand Down

0 comments on commit 4352fca

Please sign in to comment.