Skip to content

Recipient npm download portal

Invite one person at a recipient to manage their own download keys. A delegation key that you choose sets the packages and the expiry date of each key.

Overview

The recipient portal is a small web page where one person at a recipient manages their own download keys. You invite that person, the portal admin, with a link. The portal admin creates, rotates and revokes download keys for their CI systems and developers. You do not send each secret yourself.

You keep control of the access. Each key that the portal admin creates gets its packages and its expiry date from a download key that you choose. That key is the delegation key. The portal admin cannot give a key more access or a later expiry date than the delegation key has.

This guide is for publishers who deliver packages to customers, partners or other teams. It explains how the portal works, how to invite a portal admin, what the portal admin can do, and how revocation removes access. The portal works with download keys for every registry format: npm, PyPI and Files.

Before you start

  • Your role must include the registry:download_key:manage permission. The Admin role has it. The Member and Viewer roles do not have it.
  • You must have a registry that contains the packages that the recipient installs.
  • You must know the email address of the portal admin. The address identifies the invitation in your lists.
  • You must have a secure channel to send the invitation link, for example your support system or an encrypted message.

NOTE: Keys that the portal admin creates count toward the download key limit of your plan. Starter allows 50 active download keys and Growth allows 500. Scale and Platform have no download key limit. See the plans.

How it works

Recipients

A recipient is a record that groups download keys for one person, team or organization. The recipient page shows the keys of the recipient, its download activity and its rejected requests. You can suspend a recipient to stop all of its keys at the same time. A portal invitation always belongs to one recipient.

A download key that you create with the option No recipient — label only has no recipient record. You cannot use that key for a portal invitation until you link it to a recipient.

The delegation key sets the limit

When you create an invitation, you select a download key in the Maximum access list. That key is the delegation key. It must be active, it must be linked to the same recipient, and it must not be a key that a portal created.

When the portal admin creates a key, the registry copies these values from the delegation key:

  • The registry. The new key works only with the registry of the delegation key.
  • The access rule: all packages in the registry, one npm scope, or the selected packages.
  • The expiry date. If the delegation key has no expiry date, the new key also has no expiry date.
  • The recipient. The new key appears on the recipient page with your other keys for that recipient.

The delegation key is also an ordinary download key with its own secret. You do not have to give that secret to anyone. You can create one delegation key for each recipient only to set the limit of the portal.

The invitation link

The invitation link has the form https://privatenpm.com/recipient/activate?token=rpi_…. The registry shows the link one time, when you create the invitation. The registry keeps only a SHA-256 hash of the token, so nobody can show the link again.

The link works one time. The first browser that opens the link gets portal access, and the registry records the invitation as used. The registry then gives that browser a new portal session in a cookie for the /recipient path. The cookie does not contain the token of the link.

The portal session is valid until the invitation expires, 30 days after you create it. Revocation of the invitation also stops the portal session. If the same browser opens the link again, the portal opens.

If a different browser opens the link, the registry shows the page Invitation already used. That page does not show the recipient, the email address or the keys. After 30 days, or after you revoke the invitation, the link and the portal session do not work. The browser then shows the page Invitation unavailable.

WARNING: Keep the invitation link secret until the portal admin opens it. The first person who opens the link gets the portal and can create download keys for your packages.

NOTE: The portal session works only in the browser that opened the link first. A different computer or browser cannot use that portal session. Access in a different browser needs a new invitation.

NOTE: PrivateNPM.com does not send the invitation email. The registry does not verify the email address. The portal shows the address only as a label.

What a portal admin can and cannot do

The portal admin canThe portal admin cannot
Create a download key with a key name, for example "Production CI".Select packages, a scope or a registry for a key.
Copy the secret of a new key one time.Give a key a later expiry date than the delegation key.
Rotate a key that this invitation created. Rotation gives a new secret and stops the old secret.See or change keys that you created, or keys from other invitations.
Revoke a key that this invitation created.Publish packages, or see your organization, members, usage or audit log.
Sign out of the portal. After sign-out, the portal admin needs a new invitation to open the portal again.Invite other people, extend the invitation or open the link in a second browser.

Revocation cascades

Some changes that you make also revoke the keys that a portal created. The registry applies each change in the same database transaction as the cause. This table shows the effect of each change on the portal keys.

Your changeEffect on keys that the portal created
Revoke the invitationThe registry revokes all keys that this invitation created. The portal stops.
The invitation expires after 30 daysThe portal stops. The keys continue to work until their expiry date. You manage them on the recipient page.
Revoke the delegation keyThe registry revokes all keys that the portal created from this delegation key.
Change the package access of the delegation keyThe registry revokes all keys that the portal created from this delegation key. The portal admin creates new keys with the new access.
The delegation key expiresThe keys stop at the same time, because they have the same expiry date. The portal cannot create more keys.
Rotate the delegation keyNo effect. Rotation changes only the secret of the delegation key.
Suspend the recipientAll keys of the recipient stop, but the registry does not revoke them. The portal cannot create keys.
Resume the recipientThe keys of the recipient work again.

NOTE: Registry servers can keep a positive authorization result for some seconds. A revoked key can therefore work for a short time after the change.

Audit entries and webhooks

The registry writes an audit entry for each invitation and for each key that the portal creates, rotates or revokes. The registry also writes an audit entry when a browser opens the invitation link the first time. That entry is not a webhook event. Portal actions show the member who created the invitation as the actor. The entry also records the email address of the invitation.

These events are available as webhook events from the Growth plan:

  • registry_recipient_portal.created and registry_recipient_portal.revoked when you create or revoke an invitation.
  • registry_download_key.created, registry_download_key.updated and registry_download_key.revoked when the portal admin creates, rotates or revokes a key.

A cascade writes one audit entry for the change that caused it, for example the revoked invitation. The registry does not write a separate entry for each key that the cascade revokes.

Invite a portal admin

Create the recipient

Do this procedure if the recipient does not have a record. If the record exists, go to the next procedure.

  1. Open Registry → Recipients.
  2. Click New recipient. The form opens below the list.
  3. In Recipient name, type the name of the recipient, for example "Example Ltd".
  4. Optional: in External reference (optional), type the ID of the recipient in your own system.
  5. Click Create recipient. The recipient page opens and shows "Recipient created."

Create the delegation key

Before you start this procedure, decide which packages the recipient can install and when the access ends.

  1. On the recipient page, in the Download keys section, click Create download key.
  2. In 2. Choose a registry, click the registry. The form Create download key opens.
  3. Make sure that An existing recipient is selected and that the recipient is correct.
  4. In Key name, type a name such as "Portal limit".
  5. In Access rule, select the packages that the portal keys can install.
  6. Optional: in Expires, select the last date of the access.
  7. Click Create download key. The page shows the secret one time.

You do not have to copy or send this secret. Admins can show it again later from the key page with Reveal key.

Create the invitation

  1. On the recipient page, find the Recipient portal section.
  2. In Admin email, type the email address of the portal admin.
  3. In Maximum access, select the delegation key.
  4. Click Create invitation. A page with the title "Invitation for" and the email address opens. It shows the Invitation link.
  5. Copy the link. The registry shows it only one time.
  6. Send the link to the portal admin through your secure channel.
  7. Tell the portal admin to open the link in the browser that they will use for the portal.
  8. Click Back to recipient. The Recipient portal section shows the email address and the status "Link not opened yet".

When the portal admin opens the link, the status changes to "Link used".

NOTE: The Maximum access list shows only active keys that are linked to this recipient and that a portal did not create.

Send a new invitation

Do this procedure if the portal admin opened the link in the wrong browser, signed out or lost the portal session. Also do this procedure if the link did not arrive.

  1. On the recipient page, find the old invitation in the Recipient portal section.
  2. If the old browser is not secure, click Revoke on the old invitation. The registry revokes the keys of that invitation.
  3. Do the procedure "Create the invitation" again with the same email address. The page shows a new Invitation link.
  4. Send the new link to the portal admin through your secure channel.

NOTE: The new portal does not show the keys of the old invitation. You manage those keys on the recipient page.

What the portal admin does

Send these steps to the portal admin with the link. The link works one time, in one browser. If you sign out, you need a new invitation.

  1. Open the invitation link in the browser that you will use for the portal. The portal opens and shows the recipient name and the word "downloads".
  2. In Key name, type a name for the system that uses the key, for example "Production CI".
  3. Click Create download key. The page shows the secret of the new key.
  4. Copy the secret into a secret manager. The portal shows the secret only one time.
  5. Click Back to your keys. The key appears in Your keys with the status "Active".
  6. To replace a secret, click Rotate on the key. The page shows a new secret.
  7. To stop a key, click Revoke on the key. The status changes to "Revoked".

A key from the portal is an ordinary download key (pdk_…). The recipient configures it like any other key. For npm, see the .npmrc configuration guide. For PyPI and Files, see the PyPI guide and the Files guide.

Choose the portal or API issuance

You can also issue download keys from your own systems with the management API. The key automation guide shows that method. You can use both methods for the same recipient.

Use the recipient portal whenUse API issuance when
The recipient has many CI systems or developers and wants to manage their keys.Your checkout system must create exactly one key for each order.
You do not want to send secrets by email or by your support team.You send the key in your own email or show it in your own product.
You do not have an organization API key. The portal works on every plan.Your plan includes API access. API access starts on the Growth plan.
The recipient must rotate secrets on their own schedule.You must control the name and external reference of each key.

Verify the result

Do this test with a test invitation before you invite the portal admin. The test uses the link of the test invitation, so you cannot send that link to the portal admin. Use a private browser window and a clean shell with no saved registry credentials.

  1. Do the procedure "Create the invitation" with your own email address. The page shows the Invitation link.
  2. Open the invitation link in a private browser window. The portal opens.
  3. Create a key with the name "Test".
  4. Install one allowed package with the new key in a clean directory. The install succeeds.
  5. Install a package that the delegation key does not allow. The registry refuses the request.
  6. On the recipient page, find the key "Test" in Download keys. The status is "Active".
  7. Open the invitation link in a different browser. The page shows Invitation already used.
  8. In the portal, click Revoke on the key "Test".
  9. Install the allowed package again. After some seconds, the registry answers 401 Unauthorized.
  10. On the recipient page, click Revoke on the test invitation. The status changes to "Inactive".

For an npm registry, this command reads metadata with the test key and does not change a project. Replace the scope, the host and the package with your values.

export ACME_NPM_TOKEN=pdk_...
printf '%s\n' '@acme:registry=https://registry.privatenpm.com/' '//registry.privatenpm.com/:_authToken=${ACME_NPM_TOKEN}' > /tmp/portal-test.npmrc
npm view @acme/sdk version --userconfig /tmp/portal-test.npmrc

Troubleshoot

SymptomCauseCorrection
The link opens Invitation unavailable.The invitation expired after 30 days, you revoked it, or the link is incomplete.Create a new invitation and send the new link.
The link opens Invitation already used.A different browser opened the link before. The link works one time.If the portal admin did not open the link, revoke the invitation immediately. Then send a new invitation.
The portal admin signed out or uses a different browser.The portal session works only in the browser that opened the link.Send a new invitation.
The Maximum access list is empty.The recipient has no active key that you created. Expired, revoked and portal keys do not appear.Create a delegation key for the recipient. For an older key, use Link to a recipient on the key page.
Create invitation fails and the recipient is suspended.The registry does not create invitations for a suspended recipient.If access must start again, click Resume recipient. Then create the invitation again.
The portal shows "The publisher has paused access for this recipient."You suspended the recipient.Click Resume recipient on the recipient page when access must start again.
A portal key returns 401 Unauthorized.A cascade revoked the key, the key expired, or the recipient is suspended.Examine the key status on the recipient page. Ask the portal admin to create a new key.
A portal key cannot install one package.The package is outside the access rule of the delegation key.Change the access of the delegation key. This revokes the old portal keys.
The portal cannot create a key.The organization reached the download key limit of its plan, or the delegation key is not active.Revoke unused keys, change the plan, or select a new delegation key in a new invitation.
The portal admin cannot see older keys.The keys belong to an expired invitation. Each portal shows only the keys of its own invitation.Manage the older keys on the recipient page.

Security and maintenance

  • Create one invitation for each person. Do not share one link in a team chat.
  • Revoke an invitation that keeps the status "Link not opened yet" for many days. Until a browser opens the link, anyone who has the link can open the portal.
  • Do not use the secret of the delegation key for installs. If that secret leaks, rotate the delegation key. A rotation does not revoke the portal keys.
  • Give the delegation key an expiry date that matches the contract or subscription of the recipient.
  • Revoke the invitation when the portal admin leaves the recipient. This also revokes the keys of that invitation.
  • Suspend the recipient for a refund, a chargeback or a security incident. Suspension stops all keys and keeps them for later.
  • Examine Delivery activity and Rejected requests on the recipient page. A key with no downloads for a long time is a candidate for revocation.
  • Use the organization audit log or webhooks to follow invitations and key changes.

READY WHEN YOU ARE

Put private packages to work.