@pagedip/lib-license-tools
Version:
40 lines (39 loc) • 1.84 kB
TypeScript
/** Main file path for the pdlicense file. Depends on platform. */
export declare const installPath: string;
export interface LicenseData {
original: string;
id: string;
user: string;
payload: Record<string, any>;
revoked: boolean;
expired: boolean;
ttl: Date;
issued: Date;
}
export declare namespace LicenseData {
function is(v: any): v is LicenseData;
}
/**
* Attempts to locate the raw license string on the system. First, it directly returns any license passed as an
* argument. Next, it checks the `pagedip_license` environment variable. Lastly, it checks known file paths for a
* pdlicense file.
*/
export declare function findLicenseString(license?: string): string | undefined;
/**
* Checks a license string against the license server and returns the results.
*/
export declare function verify(license: string): Promise<LicenseData>;
/** Find and verifies the license in one step. */
export declare function findAndVerify(license?: string | undefined): Promise<LicenseData>;
/** Install a license string onto the file system and setup NPM to use the license server registry. */
export declare function install(license: string): Promise<void>;
/** Inverse of install(), this will remove the license file and remove license server NPM configuration. */
export declare function uninstall(): Promise<void>;
/** Similar to verify(), but does the verification without network requests using known license server public keys. */
export declare function verifyOffline(license: string): LicenseData;
/** Find and verifies the license offline in one step. */
export declare function findAndVerifyOffline(license?: string | undefined): LicenseData;
/** Print license data in a human friendly format. */
export declare function print(data?: LicenseData, opts?: {
colors?: boolean;
}): string;