# Licence

The offline licence: what it allows, its limits, and installing a new one. Aegis Core API, `LicenceService`: 2 operations, generated from the OpenAPI document of Aegis Core 0.13.0.

## Get licence

`GET /v1/sys/licence`

The licence, where it stands, the modules open for new protection, the limits with their use and what no licence state ever blocks.

- Role: `auditor` or higher
- gRPC: `/aegis.v1.LicenceService/GetLicence`

Response `200` (`application/json`): [LicenceStatus](#schema-licencestatus)

Errors: `400` · `401` · `403` · `404` · `409` · `413` · `500` · `503` ([what each means](https://docs.qblackbit.com/api/core/index.md#errors)).

## Install licence

`POST /v1/sys/licence`

Installs a licence file as issued, if it verifies against a trusted issuer and is not older than the one in force. Allowed sealed or unsealed; audited when unsealed.

- Role: `admin` or higher
- gRPC: `/aegis.v1.LicenceService/InstallLicence`

Request body, required (`application/octet-stream`): string

Response `200` (`application/json`): [LicenceStatus](#schema-licencestatus)

Errors: `400` · `401` · `403` · `404` · `409` · `413` · `500` · `503` ([what each means](https://docs.qblackbit.com/api/core/index.md#errors)).

## Schemas

### LicenceStatus

The licence and where it stands.

| Field | Type | Description |
| --- | --- | --- |
| `days_left` | integer (int64), nullable | Days until it expires, or until its grace ends. |
| `detail` | string, nullable | Why, for a development build. |
| `installed` | [LicenceInstalled](#schema-licenceinstalled), nullable | Who installed it, and when. |
| `licence` | [LicenceDetail](#schema-licencedetail), nullable | The licence in force, if any. |
| `limits_in_force` | [LicenceLimitsInForce](#schema-licencelimitsinforce), nullable | The limits in force, overage included; absent when unlimited. |
| `mode` | string | `development` (a build that pins no issuer and gates nothing), `community` or `licensed`. |
| `modules` | array of string | The modules open for new protection; absent when every module is. |
| `never_gated` | array of [NeverGated](#schema-nevergated) | What no licence state ever blocks. |
| `refused` | string, nullable | Why the licence file on disk was refused, if it was. |
| `standing` | string, nullable | `none`, `not-yet-valid`, `valid`, `grace` or `expired`. |
| `trusted_issuers` | array of string | The SHA2-256 of each trusted issuer. |
| `used` | [LicenceUse](#schema-licenceuse), nullable | Keys and tenants in use, when the vault is unsealed. |
| `warning` | integer (int64), nullable | The warning threshold reached (90, 60, 30, 7, or 0 in grace). |

### LicenceDetail

A verified licence.

| Field | Type | Description |
| --- | --- | --- |
| `customer` | [LicenceCustomer](#schema-licencecustomer), nullable | The customer. |
| `digest` | string | The SHA2-256 of the file. |
| `edition` | string | `community`, `professional`, `enterprise` or `sovereign`. |
| `expires` | integer (int64) | When it expires. |
| `grace_ends` | integer (int64) | When its grace ends. |
| `id` | string | Its identifier. |
| `issued` | integer (int64) | When it was issued, in seconds since the Unix epoch. |
| `issuer` | string | The SHA2-256 of its issuer. |
| `limits` | [LicenceLimits](#schema-licencelimits), nullable | Its limits. |
| `modules` | array of string | The modules it opens. |
| `not_before` | integer (int64) | When it starts. |
| `serial` | integer (int64) | Its serial; a newer licence has a higher one. |

### LicenceInstalled

Who installed the licence.

| Field | Type | Description |
| --- | --- | --- |
| `at` | integer (int64) | When, in seconds since the Unix epoch. |
| `by` | string | The caller. |

### LicenceLimitsInForce

The ceilings enforced; absent means unlimited.

| Field | Type | Description |
| --- | --- | --- |
| `keys` | integer (int64), nullable | Live keys. |
| `tenants` | integer (int64), nullable | Tenants. |

### LicenceUse

What is in use.

| Field | Type | Description |
| --- | --- | --- |
| `keys` | integer (int64) | Live keys. |
| `tenants` | integer (int64) | Tenants. |

### NeverGated

Something no licence state blocks.

| Field | Type | Description |
| --- | --- | --- |
| `detail` | string | Why. |
| `name` | string | What it is. |

### LicenceCustomer

Who a licence is for.

| Field | Type | Description |
| --- | --- | --- |
| `id` | string | The identifier. |
| `name` | string | The name. |

### LicenceLimits

A licence's limits; absent means unlimited.

| Field | Type | Description |
| --- | --- | --- |
| `keys` | integer (int64), nullable | Live keys. |
| `overage_percent` | integer (int64) | How far over a limit new keys or tenants may still go, in percent. |
| `tenants` | integer (int64), nullable | Tenants. |
