> For the complete documentation index, see [llms.txt](https://docs.licensespring.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.licensespring.com/sdks/go-sdk/v2/samples/local-license.md).

# Local License

The SDK provides the ability to perform a **local license check**, which validates the locally stored license file without communicating with the LicenseSpring server.

This function is especially useful in offline or air-gapped environments where no internet connection is available, or when you want to ensure the local license is still valid after restarting your application.

## What Does It Check?

When you call the local license check, the SDK performs several validations:

* Whether the license is **active** and **enabled**
* Whether the license is **expired**
* If the **device is authorized** to use the license
* If **system time manipulation** is detected (clock tampering)
* If the **product code matches**
* If the license is **floating**, whether its floating usage has expired
* (Optional) It verifies the **license signature**

{% code title="example.go" %}

```go
license_data, check_resp, err := lh.LocalCheck(true)
if err != nil {
    return err
}
```

{% endcode %}

The `true` flag enables signature verification. You can set it to `false` if signature validation is not needed.

## Response Structure

The function returns a LocalCheckResponse:

{% code title="local\_check\_response.go" %}

```go
type LocalCheckResponse struct {
    LicenseResponse

    LicenseActive  bool `json:"license_active"`
    LicenseEnabled bool `json:"license_enabled"`
    IsExpired      bool `json:"is_expired"`

    DeviceLicensed  bool `json:"is_device_licensed"`
    IsClockTampered bool `json:"is_clock_tampered"`
    ProductMismatch bool `json:"product_mismatch"`
    FloatingExpired bool `json:"floating_expired"`
}
```

{% endcode %}

Use this response to determine whether the local license should be trusted.

## Get Current License

If your application restarts or you want to resume from the last known license state, you can load the locally stored license file using:

{% code title="get\_current\_license.go" %}

```go
ld, err = lh.GetCurrentLicense()
if err != nil {
    return err
}
```

{% endcode %}

This retrieves the in-memory license data previously saved by the SDK.

{% hint style="info" %}
Notes:

* Local checks do **not** validate or sync with the cloud.
* Use `LocalCheck` to determine license validity before performing actions that depend on license state.
  {% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.licensespring.com/sdks/go-sdk/v2/samples/local-license.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
