Revoke license

You can revoke or unrevoke a license using the SDK. Here is an example of how to revoke and then unrevoke a license:

import { Keyforge } from 'keyforge-js';
 
const keyforge = new Keyforge('sk_1234');
 
const revoked = await keyforge.licenses.revoke('ABCDE-ABCDE-ABCDE-ABCDE-ABCDE');
 
const unrevoked = await keyforge.licenses.unrevoke(
  'ABCDE-ABCDE-ABCDE-ABCDE-ABCDE'
);

You can also revoke and unrevoke licenses with the licenses.update() function.

Parameters

PropTypeDefault
key
string
-

Returns

Here is an example of the revoked license object:

{
  "key": "ABCDE-ABCDE-ABCDE-ABCDE-ABCDE",
  "userId": "05d27bfb-61c7-45f7-9d07-09a41defc88a",
  "productId": "p_123456",
  "type": "perpetual",
  "expiresAt": null,
  "revoked": true,
  "email": "[email protected]",
  "maxDevices": 2,
  "activeDevices": [],
  "createdAt": "2024-05-19T18:39:33.000Z"
}

On this page