Skip to Content
PortcullisDocs
Integrate (product engineers)

Entitlements and limits

Read feature flags and numeric limits from the license claims.

Entitlements arrive in the signed claims:

"entitlements": { "module.trips": true, "limit.vehicles": 500, "edition": "enterprise" }

Conventions

PrefixTypeMeaning
module.*booleanSwitches a feature on or off. A missing boolean is false.
limit.*integerA cap. -1 means unlimited.
anything elseanyInformational (for example edition).

Ignore feature codes your build doesn't know. Digicom can add features without breaking older builds.

Helpers to write

  • isEnabled(code): entitlements[code] === true, and the state is valid or valid_grace.
  • limit(code): a number, where -1 means unlimited. Returns 0 when the state is not valid.
type State = 'valid' | 'valid_grace' | 'expired' | 'suspended' | 'revoked'
  | 'not_activated' | 'invalid' | 'clock_tampered';

const usable = (s: State) => s === 'valid' || s === 'valid_grace';

export function isEnabled(claims: Claims, state: State, code: string): boolean {
  return usable(state) && claims.entitlements[code] === true;
}

export function limit(claims: Claims, state: State, code: string): number {
  if (!usable(state)) return 0;
  const value = claims.entitlements[code];
  return typeof value === 'number' ? value : 0;
}

Enforcing limits

Your product enforces limits locally, because only it knows its own usage. When a limit is reached, block creating more items; never disable existing ones.

Report actual usage at each check-in in the usage map, keyed by feature code:

"usage": { "limit.vehicles": 412, "limit.users": 37 }

Digicom uses this only to see compliance; Portcullis does not enforce it.

Maintenance coverage

A build is covered when productBuildDate ≤ claims.license.maintenanceExpiresAt, or when that field is null. If a new build is not covered, refuse to migrate to it and keep the old version running.

On this page