Skip to content

Example E · License

Activate a license → send encrypted content → handle expired/missing license errors.


Overview

Operation License needed?
GET /health, get_config, get_info No
send_msg (plain text) No
privitty_send_file, privitty_revoke_file_access, Privitty handshakes Yes

Step 1 — Check license status (before activation)

docker exec privitty-edged \
  privitty-edge --accounts /var/lib/privitty license status

Expected without a license:

Status : no_license

The daemon logs a warning at startup but continues running so you can activate.


Pass the delivery URL in a single docker run:

docker run -d \
  --name privitty-edged \
  -e PRIVITTY_PROFILE=factory-gw-01 \
  -e PRIVITTY_LICENSE_URL="https://license.privitty.com/v1/license/YOUR_TOKEN" \
  -p 127.0.0.1:7200:7200 \
  -v privitty-data:/var/lib/privitty \
  privitty/edge:latest

Verify after start:

docker exec privitty-edged \
  privitty-edge --accounts /var/lib/privitty license status

The license file is stored at /var/lib/privitty/privitty.lic inside the volume.


Step 2b — Activate on a running container

docker exec privitty-edged \
  privitty-edge --accounts /var/lib/privitty \
  license activate "https://license.privitty.com/v1/license/YOUR_TOKEN"

docker restart privitty-edged

Step 3 — Send with active license

curl -s -X POST http://127.0.0.1:7200/rpc \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc":"2.0",
    "method":"privitty_send_file",
    "params":[1,7,12,"/data/report.csv",true,false,60],
    "id":1
  }' | jq .

With an active license, this returns a PrivittySendFileResult. Without one, see Step 4.


Step 4 — Handle license error

Attempt a gated operation without a license:

curl -s -X POST http://127.0.0.1:7200/rpc \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc":"2.0",
    "method":"privitty_send_file",
    "params":[1,7,12,"/data/report.csv",true,false,60],
    "id":1
  }' | jq .
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32001,
    "message": "Privitty license required: status is 'no_license'. Run `privitty-edge license activate <url>` to install or renew."
  },
  "id": 1
}

Application handling:

result = rpc("privitty_send_file", [...])
if "error" in result and result["error"]["code"] == -32001:
    alert_ops("License expired or missing — renew at admin portal")
    raise LicenseError(result["error"]["message"])

Keep the local license fresh and report usage:

docker exec privitty-edged \
  privitty-edge --accounts /var/lib/privitty license sync

Schedule via cron on the host:

0 3 * * * docker exec privitty-edged privitty-edge --accounts /var/lib/privitty license sync

Step 6 — Deactivate (device replacement)

When decommissioning a gateway:

docker exec privitty-edged \
  privitty-edge --accounts /var/lib/privitty license deactivate

This releases the device seat on the license server. Activate again on the replacement gateway.


License status reference

Status Send operations
active Allowed
grace_period Allowed (renew soon)
expired Blocked (-32001)
no_license Blocked (-32001)

Full reference: License Management