MediaGrabber Pro

Activation

Activate a license on an install and generate a stable fingerprint.

Activation ties a license key to one install (a device or site), identified by a fingerprint. Do it once on first run, then persist the returned connectionId.

Activate

const result = await client.activate({
  licenseKey: 'LK-2025-XXXX-YYYY', // from the customer's dashboard
  fingerprint: generateFingerprint(), // stable id for this install
  domain: 'acmecorp.com',            // optional — shown in the portal
  label: 'Production server',        // optional — human label
})
 
if (!result.ok) {
  // Most likely an invalid/expired key or activation limit reached
  console.error(result.code, result.error)
  process.exit(1)
}
 
const connectionId = result.data.connectionId
// Persist connectionId so restarts don't re-activate

Don't activate on every boot. Activate once, store the connectionId, and use validate() thereafter. Re-activating repeatedly can burn through the activation limit.

Generating a stable fingerprint

A fingerprint must be:

  • Stable — identical across restarts of the same install
  • Unique per install — different for each device/site/deployment
import { createHash } from 'node:crypto'
import { hostname, networkInterfaces } from 'node:os'
 
function generateFingerprint(): string {
  const seed = hostname() + JSON.stringify(networkInterfaces())
  return createHash('sha256').update(seed).digest('hex').slice(0, 32)
}

Pick a seed that fits your environment:

EnvironmentGood fingerprint seed
WordPressmd5(get_site_url())
Single serverhostname + primary MAC
Serverless/edgeA provisioned INSTANCE_ID env var
Vercelprocess.env.VERCEL_DEPLOYMENT_ID

Activation limits

A license caps how many installs can be active at once (maxActivations). When the cap is reached, activate() returns an ACTIVATION_LIMIT error.

if (!result.ok && result.code === 'ACTIVATION_LIMIT') {
  // Tell the user to remove a site from their portal Licenses page
}

Deactivating an install

To free a slot, deactivate the install. The customer can do this from the portal Connections page, or your plugin can call it directly:

await client.deactivate({
  licenseKey: 'LK-2025-XXXX-YYYY',
  fingerprint: storedFingerprint,
})

This hits POST /public/deactivate and frees one activation immediately.

Next

On this page

Activation | MediaGrabber Pro