Skip to content
PolyPack
Docs: Clients and Grants

Clients and Grants

Give each of your customers only the Packs they paid for.

A Client is one of your Team's customers: say Hopper Digital builds for Knuth Press and Liskov Systems. Clients never sign in to PolyPack. Admins manage them under Clients.

Grants

A Grant lets one Client install one private Pack, every version of it. Grant hopper/widgets to Knuth Press and only Knuth Press's Tokens can install it. To everyone else's Client Tokens, every Pack not granted to them is a 404: they cannot tell it exists. Withdrawing a Grant takes effect on the next install.

Terms

A Grant can carry terms, set when granting or later, one Grant at a time or for all of a Client's Grants at once:

  • Access ends on a date: the Grant works through that day, then the Pack disappears for that Client.
  • Updates until a date: only versions released on or before it. For Composer, a version's release date is the date of its Git commit.
  • Versions: a constraint such as ^1.0 or >=1.0 <2.0, for "1.x is licensed, 2.0 is a new licence".

With an updates or version limit, branches such as dev-main are hidden. On npm, the Client's latest becomes the newest version it may install, so npm install @hopper/ui keeps working.

Products

If you sell tiers rather than single Packs, define each as a Product under Access → Products: say Widgets Pro is hopper/widgets and @hopper/ui, with 12 months of access and updates to ^2.0. Give it to a Client from the Client's page, with those terms filled in for you to change, and the Client gets every Pack in it at once. Add a Pack to the Product later and every Client that has it gets that Pack too; remove one and it goes. See Products.

The Grants a Product gives are marked with its name on the Client's page, and are changed through the Product: its terms, or withdrawing it. A Pack you grant the Client directly keeps your own terms, whatever its Products say. If two of a Client's Products cover the same Pack, the one that lasts longer applies. A Product ending sends one reminder, not one per Pack.

Which versions they are on

A Pack's page shows its Adoption: for each Client, the newest and oldest version it installed and every version in between, over the last 30, 90 or 365 days, and how many Clients are on each major line ("2.x: 5 Clients · 1.x: 2 Clients"). A Client's page shows the versions it is on for each Pack. It all comes from downloads with the Client's Tokens, so a Client that installs only from a cache shows up when the cache misses: 90 days is the default for that reason. The Team API has it too, at GET /packs/{pack}/adoption.

Support windows

On a Pack's Support section, Admins name its Version lines, such as 1.x for 1.*, and when each reaches end of life, with a message such as "Upgrade to 2.x". The section shows how many Clients are on each line. Before a line ends, 30 days and one day before and the day after, your notification channels hear about it with the Clients still on it, and the dashboard lists it while they are. Each Client's setup instructions carry the date for the lines it is on, and npm warns on install once a line has ended. Nothing is ever refused: an ended line installs as before. To stop a Client installing a line, use Grant terms instead.

Handing over

  1. Create the Client and grant it its Packs, or give it a Product.
  2. Issue it a Client Token. Its window shows the Client's setup instructions with the Token already filled in: send that over a channel you trust.
  3. Later, the Client's page shows the same Setup instructions without the secret, covering exactly the Packs the Client has.

Download links

For a Client with no package manager, such as a buyer of a plugin or an agency picking up a build, make a download link: on the Client's page, Download links → Make a download link, or Download link… on a Version's row. Choose the Version and how long it works, from an hour to 30 days, and at most how many downloads if you like. The link opens a page on your registry host with the Version's files, each with its SHA-256, and downloads them with no Token. Copy it when it is made: it is shown once.

A link never gives more than the Client's Grant. Every download checks it again, with its terms and the Client's allowed IP addresses, so a link to a Version the Grant stops covering stops working, and says why. Revoke a link from the Client's page; downloads through it count for the Client, like its Tokens' do. A licensing system can make them through the Team API: POST /clients/{client}/download-links. Container images have no download links.

Where its Tokens work

Set Allowed IP addresses on a Client, such as its office or its build servers, and every Token it holds, now or later, works only from there. From anywhere else an install is refused with a message that names the address. Change the list whenever the Client moves; the Team API can set it too.

When the relationship ends

Revoke the Client's Tokens, or delete the Client, which revokes them and removes its Grants. Their next install is refused.