@gorilla-engine-sdk/ge-product-hub 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/License.md +64 -0
- package/README.md +202 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +19 -0
- package/dist/lib/clients.d.ts +1039 -0
- package/dist/lib/clients.js +2036 -0
- package/dist/lib/credentialStore.d.ts +8 -0
- package/dist/lib/credentialStore.js +80 -0
- package/dist/lib/errors.d.ts +48 -0
- package/dist/lib/errors.js +63 -0
- package/dist/lib/types.d.ts +406 -0
- package/dist/lib/types.js +58 -0
- package/package.json +48 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface CredentialLocation {
|
|
2
|
+
service: string;
|
|
3
|
+
account: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function createCredentialLocation(manufacturerId: string): CredentialLocation;
|
|
6
|
+
export declare function getCredential(service: string, account: string): Promise<string | null>;
|
|
7
|
+
export declare function setCredential(service: string, account: string, password: string): Promise<void>;
|
|
8
|
+
export declare function deleteCredential(service: string, account: string): Promise<void>;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createCredentialLocation = createCredentialLocation;
|
|
4
|
+
exports.getCredential = getCredential;
|
|
5
|
+
exports.setCredential = setCredential;
|
|
6
|
+
exports.deleteCredential = deleteCredential;
|
|
7
|
+
const cross_keychain_1 = require("cross-keychain");
|
|
8
|
+
const testCredentials = new Map();
|
|
9
|
+
const windowsCredentialManagerBackend = 'windows';
|
|
10
|
+
const audioPluginClientService = 'PH-Audio-Plugin-Client';
|
|
11
|
+
let keychainInitialization;
|
|
12
|
+
function createCredentialLocation(manufacturerId) {
|
|
13
|
+
return {
|
|
14
|
+
service: audioPluginClientService,
|
|
15
|
+
account: manufacturerId,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function credentialKey(service, account) {
|
|
19
|
+
return `${service}\0${account}`;
|
|
20
|
+
}
|
|
21
|
+
function credentialTarget(service, account) {
|
|
22
|
+
return process.platform === 'win32'
|
|
23
|
+
? `${service}:${account}`
|
|
24
|
+
: `service=${service}, account=${account}`;
|
|
25
|
+
}
|
|
26
|
+
async function ensureSecureKeychain() {
|
|
27
|
+
if (process.platform !== 'win32') {
|
|
28
|
+
return (0, cross_keychain_1.getKeyring)();
|
|
29
|
+
}
|
|
30
|
+
keychainInitialization ?? (keychainInitialization = (async () => {
|
|
31
|
+
await (0, cross_keychain_1.initBackend)((backend) => backend.id === windowsCredentialManagerBackend);
|
|
32
|
+
const backend = await (0, cross_keychain_1.getKeyring)();
|
|
33
|
+
if (backend.id !== windowsCredentialManagerBackend) {
|
|
34
|
+
throw new Error('The CLI-based Windows Credential Manager backend is required for Product Hub sessions');
|
|
35
|
+
}
|
|
36
|
+
return backend;
|
|
37
|
+
})());
|
|
38
|
+
return keychainInitialization;
|
|
39
|
+
}
|
|
40
|
+
async function getCredential(service, account) {
|
|
41
|
+
if (process.env.NODE_ENV === 'test') {
|
|
42
|
+
return testCredentials.get(credentialKey(service, account)) ?? null;
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
await ensureSecureKeychain();
|
|
46
|
+
return await (0, cross_keychain_1.getPassword)(service, account);
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
console.error(`[Product Hub credentials] read failed; target=${credentialTarget(service, account)}`, error);
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
async function setCredential(service, account, password) {
|
|
54
|
+
if (process.env.NODE_ENV === 'test') {
|
|
55
|
+
testCredentials.set(credentialKey(service, account), password);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
try {
|
|
59
|
+
await ensureSecureKeychain();
|
|
60
|
+
await (0, cross_keychain_1.setPassword)(service, account, password);
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
console.error(`[Product Hub credentials] write failed; target=${credentialTarget(service, account)}`, error);
|
|
64
|
+
throw error;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
async function deleteCredential(service, account) {
|
|
68
|
+
if (process.env.NODE_ENV === 'test') {
|
|
69
|
+
testCredentials.delete(credentialKey(service, account));
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
try {
|
|
73
|
+
await ensureSecureKeychain();
|
|
74
|
+
await (0, cross_keychain_1.deletePassword)(service, account);
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
console.error(`[Product Hub credentials] delete failed; target=${credentialTarget(service, account)}`, error);
|
|
78
|
+
throw error;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/** Error returned for Product Hub API, network, runtime, and verification failures. */
|
|
2
|
+
export declare class ProductHubError extends Error {
|
|
3
|
+
status?: number;
|
|
4
|
+
details?: any;
|
|
5
|
+
/**
|
|
6
|
+
* Create a Product Hub error.
|
|
7
|
+
*
|
|
8
|
+
* @param message - Human-readable failure description.
|
|
9
|
+
* @param status - Optional HTTP response status associated with the failure.
|
|
10
|
+
* @param details - Optional structured response or diagnostic details.
|
|
11
|
+
* @remarks API errors retain their HTTP status and response details when available.
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* throw new ProductHubError('Request failed', 500, { requestId: 'request-id' });
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
constructor(message: string, status?: number, details?: any);
|
|
18
|
+
}
|
|
19
|
+
/** Error indicating that Product Hub rejected authentication or authorization. */
|
|
20
|
+
export declare class NotAuthorizedError extends ProductHubError {
|
|
21
|
+
/**
|
|
22
|
+
* Create an authorization error with HTTP status 401.
|
|
23
|
+
*
|
|
24
|
+
* @param message - Human-readable failure description.
|
|
25
|
+
* @param details - Optional structured response or diagnostic details.
|
|
26
|
+
* @remarks The default message is `Not authorized` and the status is always 401.
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* throw new NotAuthorizedError('Invalid credentials');
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
constructor(message?: string, details?: any);
|
|
33
|
+
}
|
|
34
|
+
/** Error indicating that the device's Product Hub trial has expired. */
|
|
35
|
+
export declare class TrialExpiredError extends ProductHubError {
|
|
36
|
+
/**
|
|
37
|
+
* Create a trial-expiration error with HTTP status 403.
|
|
38
|
+
*
|
|
39
|
+
* @param message - Human-readable failure description.
|
|
40
|
+
* @param details - Optional structured response or diagnostic details.
|
|
41
|
+
* @remarks The default message is `Trial expired` and the status is always 403.
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* throw new TrialExpiredError();
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
constructor(message?: string, details?: any);
|
|
48
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TrialExpiredError = exports.NotAuthorizedError = exports.ProductHubError = void 0;
|
|
4
|
+
/** Error returned for Product Hub API, network, runtime, and verification failures. */
|
|
5
|
+
class ProductHubError extends Error {
|
|
6
|
+
/**
|
|
7
|
+
* Create a Product Hub error.
|
|
8
|
+
*
|
|
9
|
+
* @param message - Human-readable failure description.
|
|
10
|
+
* @param status - Optional HTTP response status associated with the failure.
|
|
11
|
+
* @param details - Optional structured response or diagnostic details.
|
|
12
|
+
* @remarks API errors retain their HTTP status and response details when available.
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* throw new ProductHubError('Request failed', 500, { requestId: 'request-id' });
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
constructor(message, status, details) {
|
|
19
|
+
super(message);
|
|
20
|
+
this.name = 'ProductHubError';
|
|
21
|
+
this.status = status;
|
|
22
|
+
this.details = details;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.ProductHubError = ProductHubError;
|
|
26
|
+
/** Error indicating that Product Hub rejected authentication or authorization. */
|
|
27
|
+
class NotAuthorizedError extends ProductHubError {
|
|
28
|
+
/**
|
|
29
|
+
* Create an authorization error with HTTP status 401.
|
|
30
|
+
*
|
|
31
|
+
* @param message - Human-readable failure description.
|
|
32
|
+
* @param details - Optional structured response or diagnostic details.
|
|
33
|
+
* @remarks The default message is `Not authorized` and the status is always 401.
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* throw new NotAuthorizedError('Invalid credentials');
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
constructor(message = 'Not authorized', details) {
|
|
40
|
+
super(message, 401, details);
|
|
41
|
+
this.name = 'NotAuthorizedError';
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.NotAuthorizedError = NotAuthorizedError;
|
|
45
|
+
/** Error indicating that the device's Product Hub trial has expired. */
|
|
46
|
+
class TrialExpiredError extends ProductHubError {
|
|
47
|
+
/**
|
|
48
|
+
* Create a trial-expiration error with HTTP status 403.
|
|
49
|
+
*
|
|
50
|
+
* @param message - Human-readable failure description.
|
|
51
|
+
* @param details - Optional structured response or diagnostic details.
|
|
52
|
+
* @remarks The default message is `Trial expired` and the status is always 403.
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* throw new TrialExpiredError();
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
constructor(message = 'Trial expired', details) {
|
|
59
|
+
super(message, 403, details);
|
|
60
|
+
this.name = 'TrialExpiredError';
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.TrialExpiredError = TrialExpiredError;
|
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Activation status values indicating the current state of plugin licensing.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* - `None`: No activation found
|
|
6
|
+
* - `Trial`: Active trial period
|
|
7
|
+
* - `TrialExpired`: Trial period has ended
|
|
8
|
+
* - `Licensed`: Valid perpetual license (Standard, NFR, or Free)
|
|
9
|
+
* - `LicenseExpired`: License has expired
|
|
10
|
+
* - `Subscription`: Valid subscription license
|
|
11
|
+
* - `SubscriptionExpired`: Subscription has expired
|
|
12
|
+
*/
|
|
13
|
+
export declare enum ActivationStatus {
|
|
14
|
+
None = "None",
|
|
15
|
+
Trial = "Trial",
|
|
16
|
+
TrialExpired = "TrialExpired",
|
|
17
|
+
Licensed = "Licensed",
|
|
18
|
+
LicenseExpired = "LicenseExpired",
|
|
19
|
+
Subscription = "Subscription",
|
|
20
|
+
SubscriptionExpired = "SubscriptionExpired"
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Status of the login session stored for this product and device.
|
|
24
|
+
*
|
|
25
|
+
* @remarks
|
|
26
|
+
* - `None`: No stored login session is available
|
|
27
|
+
* - `Valid`: The stored session is valid
|
|
28
|
+
* - `Invalid`: The session is malformed, expired, revoked, or belongs to another scope
|
|
29
|
+
*/
|
|
30
|
+
export declare enum SessionStatus {
|
|
31
|
+
None = "None",
|
|
32
|
+
Valid = "Valid",
|
|
33
|
+
Invalid = "Invalid"
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* License type values representing different categories of product licenses.
|
|
37
|
+
*
|
|
38
|
+
* @remarks
|
|
39
|
+
* - `Standard`: Standard perpetual license
|
|
40
|
+
* - `NFR`: Not-for-resale perpetual license (typically for partners/reviewers)
|
|
41
|
+
* - `Free`: Free perpetual license
|
|
42
|
+
* - `Subscription`: Time-limited subscription license
|
|
43
|
+
*/
|
|
44
|
+
export declare enum LicenseType {
|
|
45
|
+
Standard = "Standard",// our standard perpetual license
|
|
46
|
+
NFR = "NFR",// not-for-resale perpetual license
|
|
47
|
+
Free = "Free",// free license (perpetual)
|
|
48
|
+
Subscription = "Subscription"
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Configuration options for the APIClient.
|
|
52
|
+
*
|
|
53
|
+
* The APIClient provides low-level access to the Product Hub API endpoints
|
|
54
|
+
* for authentication, product activation, and trial management.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```typescript
|
|
58
|
+
* const apiClient = new ProductHub.APIClient({
|
|
59
|
+
* manufacturerId: "b7d86bee-7a7c-491b-a719-29cd99425fbe",
|
|
60
|
+
* productId: "6307d4da-cf56-4917-a793-0354f6ad235f"
|
|
61
|
+
* });
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export interface APIClientOptions {
|
|
65
|
+
/**
|
|
66
|
+
* Your manufacturer ID in Gorilla Engine Product Hub.
|
|
67
|
+
*
|
|
68
|
+
* @remarks
|
|
69
|
+
* You can find your manufacturer ID in the Product Hub web interface.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* "7222d546-9c72-43d5-8bd4-1667ce390ea4"
|
|
73
|
+
*/
|
|
74
|
+
manufacturerId: string;
|
|
75
|
+
/**
|
|
76
|
+
* The ID of the product in Gorilla Engine Product Hub.
|
|
77
|
+
*
|
|
78
|
+
* @remarks
|
|
79
|
+
* You can find your product ID in the Product Hub web interface.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* "1487a36d-9bc8-4220-ba31-9998d743071f"
|
|
83
|
+
*/
|
|
84
|
+
productId: string;
|
|
85
|
+
/**
|
|
86
|
+
* Optional hardware fingerprint override for testing purposes.
|
|
87
|
+
* When provided, this fingerprint will be used instead of generating
|
|
88
|
+
* one automatically. Useful for unit tests and development scenarios.
|
|
89
|
+
*
|
|
90
|
+
* @remarks
|
|
91
|
+
* In production, omit this parameter to use the automatically generated
|
|
92
|
+
* hardware fingerprint based on the user's system characteristics.
|
|
93
|
+
*/
|
|
94
|
+
hardwareFingerprint?: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Configuration options for the AudioPluginClient.
|
|
98
|
+
*
|
|
99
|
+
* The AudioPluginClient extends the APIClient with additional functionality
|
|
100
|
+
* specifically designed for audio plugin activation workflows, including
|
|
101
|
+
* automatic file persistence, signature verification, and hardware fingerprint management.
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```typescript
|
|
105
|
+
* const pluginClient = new ProductHub.AudioPluginClient({
|
|
106
|
+
* manufacturerId: "b7d86bee-7a7c-491b-a719-29cd99425fbe",
|
|
107
|
+
* productId: "6307d4da-cf56-4917-a793-0354f6ad235f",
|
|
108
|
+
* productName: "Your Product",
|
|
109
|
+
* productPublicKey: "-----BEGIN PUBLIC KEY-----\n...\n-----END PUBLIC KEY-----",
|
|
110
|
+
* userResourceBaseDirectory: "/Users/<username>/Library/Application Support/<manufacturername>"
|
|
111
|
+
* });
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
export interface AudioPluginClientOptions extends APIClientOptions {
|
|
115
|
+
/**
|
|
116
|
+
* The name of the product, exactly matching the name configured in Gorilla Compiler.
|
|
117
|
+
*
|
|
118
|
+
* @remarks
|
|
119
|
+
* Used for filename and path generation in regard to persisting activations and trials.
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* "Groove Master 3000"
|
|
123
|
+
*/
|
|
124
|
+
productName: string;
|
|
125
|
+
/**
|
|
126
|
+
* RSA public key in PEM format for signature verification.
|
|
127
|
+
* This key is used to verify activations and trials.
|
|
128
|
+
*
|
|
129
|
+
* @remarks
|
|
130
|
+
* You can obtain the public key from the product configuration page in the Product Hub web interface.
|
|
131
|
+
* It is automatically generated when creating a new product.
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```plaintext
|
|
135
|
+
* -----BEGIN PUBLIC KEY-----
|
|
136
|
+
* MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA...
|
|
137
|
+
* -----END PUBLIC KEY-----
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
productPublicKey: string;
|
|
141
|
+
/**
|
|
142
|
+
* Base directory where the product's folder containing the plugin's user specific settings, activations and other resources are stored.
|
|
143
|
+
* Typically this should point to the user-specific manufacturer's application support directory.
|
|
144
|
+
*
|
|
145
|
+
* @remarks
|
|
146
|
+
* The client will create e.g. `.ops` (activation) files or user specific settings files
|
|
147
|
+
* in `<userResourceBaseDirectory>/<productName>` to persist information locally.
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* "/Users/<username>/Library/Application Support/<manufacturername>" (macOS)
|
|
151
|
+
* "C:\\Users\\<username>\\AppData\\Roaming\\<manufacturername>" (Windows)
|
|
152
|
+
*/
|
|
153
|
+
userResourceBaseDirectory: string;
|
|
154
|
+
/**
|
|
155
|
+
* Optional hardware fingerprint override for testing purposes.
|
|
156
|
+
* When provided, this fingerprint will be used instead of generating
|
|
157
|
+
* one automatically. Useful for unit tests and development scenarios.
|
|
158
|
+
*
|
|
159
|
+
* @remarks
|
|
160
|
+
* In production, make sure the "Hardware fingerprinting" native module is enabled
|
|
161
|
+
* in Gorilla Compiler and omit this parameter to use the automatically generated
|
|
162
|
+
* hardware fingerprint based on the user's system characteristics.
|
|
163
|
+
*/
|
|
164
|
+
hardwareFingerprint?: string;
|
|
165
|
+
/**
|
|
166
|
+
* The current installed version of the product in semantic versioning format.
|
|
167
|
+
*
|
|
168
|
+
* @remarks
|
|
169
|
+
* Optional. Used for update checking. Format: "major.minor.revision" (e.g., "1.2.3")
|
|
170
|
+
* If not provided, update checking will be disabled (checkForUpdates will always return false,
|
|
171
|
+
* isUpdateAvailable will always return false).
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* "1.2.3"
|
|
175
|
+
*/
|
|
176
|
+
currentVersion?: string;
|
|
177
|
+
/**
|
|
178
|
+
* The current installed build number of the product.
|
|
179
|
+
*
|
|
180
|
+
* @remarks
|
|
181
|
+
* Optional. Used for update checking when comparing versions with equal major.minor.revision.
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* 456
|
|
185
|
+
*/
|
|
186
|
+
currentBuildNumber?: number;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Parameters for activating a product in the AudioPluginClient.
|
|
190
|
+
*/
|
|
191
|
+
export interface AudioPluginActivationParams {
|
|
192
|
+
/** The email the end user is registered with */
|
|
193
|
+
email: string;
|
|
194
|
+
/** End-user's password. */
|
|
195
|
+
password: string;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Parameters for activating a product using email + serial only (no login required).
|
|
199
|
+
*
|
|
200
|
+
* @remarks
|
|
201
|
+
* Only works when the manufacturer has "Authentication Type = None" and
|
|
202
|
+
* "Email+Serial Claiming" enabled in Product Hub. The license is claimed and
|
|
203
|
+
* activated in a single call — no separate claim step is needed.
|
|
204
|
+
*/
|
|
205
|
+
export interface AudioPluginActivationWithSerialParams {
|
|
206
|
+
/** The email address the end user used when purchasing. */
|
|
207
|
+
email: string;
|
|
208
|
+
/** The license serial number received after purchase. */
|
|
209
|
+
serial: string;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Parameters for claiming a reseller-purchased serial and activating in one call.
|
|
213
|
+
*
|
|
214
|
+
* @remarks
|
|
215
|
+
* Use this when an authenticated user (with SSO credentials) purchased a serial
|
|
216
|
+
* from a reseller and needs to add it to their account before activating.
|
|
217
|
+
* The serial is claimed to the account and then activated in a single call.
|
|
218
|
+
*/
|
|
219
|
+
export interface AudioPluginClaimAndActivateParams {
|
|
220
|
+
/** End-user's email address. */
|
|
221
|
+
email: string;
|
|
222
|
+
/** End-user's password. */
|
|
223
|
+
password: string;
|
|
224
|
+
/** The license serial number received from the reseller. */
|
|
225
|
+
serial: string;
|
|
226
|
+
}
|
|
227
|
+
/** Parameters for claiming a reseller serial with the active stored session. */
|
|
228
|
+
export interface AudioPluginStoredSessionSerialParams {
|
|
229
|
+
/** The license serial number received from the reseller. */
|
|
230
|
+
serial: string;
|
|
231
|
+
}
|
|
232
|
+
/** Non-sensitive details decoded from the active stored login session. */
|
|
233
|
+
export interface StoredSessionInfo {
|
|
234
|
+
email: string | null;
|
|
235
|
+
userId: string | null;
|
|
236
|
+
expiresAt: Date | null;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Authentication response containing the bearer token for subsequent
|
|
240
|
+
* protected Product Hub requests (e.g. product activation).
|
|
241
|
+
*
|
|
242
|
+
* @remarks Used by APIClient.loginUser()
|
|
243
|
+
*/
|
|
244
|
+
export interface LoginUserResponse {
|
|
245
|
+
/**
|
|
246
|
+
* JWT bearer token.
|
|
247
|
+
*/
|
|
248
|
+
token: string;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Parameters for product activation.
|
|
252
|
+
*
|
|
253
|
+
* @remarks Used by APIClient.activateProduct()
|
|
254
|
+
*/
|
|
255
|
+
export interface ActivateProductParams {
|
|
256
|
+
/** End-user email for login. */
|
|
257
|
+
email: string;
|
|
258
|
+
/** End-user password for login. */
|
|
259
|
+
password: string;
|
|
260
|
+
/**
|
|
261
|
+
* License serial number. When provided, this specific license is claimed
|
|
262
|
+
* (if not already owned) and activated instead of the priority-selected one.
|
|
263
|
+
*/
|
|
264
|
+
serial?: string;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Response from product activation.
|
|
268
|
+
*
|
|
269
|
+
* @remarks Returned by APIClient.activateProduct()
|
|
270
|
+
*/
|
|
271
|
+
export interface ActivateProductResponse {
|
|
272
|
+
type: LicenseType;
|
|
273
|
+
expires: Date | null;
|
|
274
|
+
signature: string;
|
|
275
|
+
serial: string;
|
|
276
|
+
user_id: string;
|
|
277
|
+
user_email: string;
|
|
278
|
+
product_id: string;
|
|
279
|
+
product_name: string;
|
|
280
|
+
manufacturer_id: string;
|
|
281
|
+
manufacturer_name: string;
|
|
282
|
+
hardware_fingerprint: string;
|
|
283
|
+
hardware_fingerprint_version: number;
|
|
284
|
+
signature_seed_version: number;
|
|
285
|
+
}
|
|
286
|
+
/** Result of attempting an activation request with the active stored session. */
|
|
287
|
+
export interface StoredSessionActivationResult {
|
|
288
|
+
sessionStatus: SessionStatus;
|
|
289
|
+
activation: ActivateProductResponse | null;
|
|
290
|
+
}
|
|
291
|
+
/** Result of restoring product activation with the active stored session. */
|
|
292
|
+
export interface ActivationRestoreResult {
|
|
293
|
+
sessionStatus: SessionStatus;
|
|
294
|
+
activationStatus: ActivationStatus;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Response from trial activation.
|
|
298
|
+
*
|
|
299
|
+
* @remarks Returned by APIClient.activateTrial()
|
|
300
|
+
*/
|
|
301
|
+
export interface ActivateTrialResponse {
|
|
302
|
+
signature: string;
|
|
303
|
+
timestamp: number;
|
|
304
|
+
trial_days: number;
|
|
305
|
+
product_id: string;
|
|
306
|
+
product_name: string;
|
|
307
|
+
manufacturer_id: string;
|
|
308
|
+
manufacturer_name: string;
|
|
309
|
+
hardware_fingerprint: string;
|
|
310
|
+
hardware_fingerprint_version: number;
|
|
311
|
+
signature_seed_version: number;
|
|
312
|
+
}
|
|
313
|
+
export interface VerifyActivationInput {
|
|
314
|
+
serial: string;
|
|
315
|
+
signature: string;
|
|
316
|
+
expires?: Date | null;
|
|
317
|
+
signature_seed_version?: number;
|
|
318
|
+
}
|
|
319
|
+
export interface VerifyTrialInput {
|
|
320
|
+
timestamp: number;
|
|
321
|
+
trial_days: number;
|
|
322
|
+
signature: string;
|
|
323
|
+
signature_seed_version?: number;
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Stored activation data with legacy compatibility.
|
|
327
|
+
* Allows null values for fields that might not exist in version 5 format.
|
|
328
|
+
*/
|
|
329
|
+
export interface StoredActivation extends Omit<ActivateProductResponse, 'user_id' | 'user_email' | 'manufacturer_id' | 'manufacturer_name'> {
|
|
330
|
+
user_id: string | null;
|
|
331
|
+
user_email: string | null;
|
|
332
|
+
manufacturer_id: string | null;
|
|
333
|
+
manufacturer_name: string | null;
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Stored trial data with legacy compatibility.
|
|
337
|
+
* Allows null values for fields that might not exist in version 5 format.
|
|
338
|
+
*/
|
|
339
|
+
export interface StoredTrial extends Omit<ActivateTrialResponse, 'manufacturer_id' | 'manufacturer_name'> {
|
|
340
|
+
manufacturer_id: string | null;
|
|
341
|
+
manufacturer_name: string | null;
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Options for writing an offline activation file.
|
|
345
|
+
*
|
|
346
|
+
* @remarks Used by AudioPluginClient.writeOfflineActivationFile()
|
|
347
|
+
*/
|
|
348
|
+
export interface OfflineActivationFileOptions {
|
|
349
|
+
/**
|
|
350
|
+
* Custom folder path where the activation file should be written.
|
|
351
|
+
* If not provided, uses the default installation directory.
|
|
352
|
+
*
|
|
353
|
+
* @example
|
|
354
|
+
* "/Users/username/Desktop" (macOS)
|
|
355
|
+
* "C:\\Users\\Username\\Desktop" (Windows)
|
|
356
|
+
*/
|
|
357
|
+
customFolderPath?: string;
|
|
358
|
+
/**
|
|
359
|
+
* Whether to overwrite an existing activation file.
|
|
360
|
+
* @default false
|
|
361
|
+
*/
|
|
362
|
+
overwriteExisting?: boolean;
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Build information from the Product Hub API.
|
|
366
|
+
*/
|
|
367
|
+
export interface ProductBuild {
|
|
368
|
+
/** The unique identifier for this build */
|
|
369
|
+
id: string;
|
|
370
|
+
/** The operating system this build is for */
|
|
371
|
+
os: 'any' | 'macOS' | 'Windows';
|
|
372
|
+
/** Major version number (0-255) */
|
|
373
|
+
major: number;
|
|
374
|
+
/** Minor version number (0-255) */
|
|
375
|
+
minor: number;
|
|
376
|
+
/** Revision version number (0-255) */
|
|
377
|
+
revision: number;
|
|
378
|
+
/** Build number (0 or greater, nullable) */
|
|
379
|
+
build_number: number | null;
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Response from the latest product version API endpoint.
|
|
383
|
+
*/
|
|
384
|
+
export interface LatestProductVersionResponse {
|
|
385
|
+
/** Array of builds from the latest release */
|
|
386
|
+
builds: ProductBuild[];
|
|
387
|
+
/** The URL to redirect users to for updates */
|
|
388
|
+
update_referral_url: string | null;
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Build file information from the Product Hub API.
|
|
392
|
+
*/
|
|
393
|
+
export interface BuildFile {
|
|
394
|
+
/** The unique identifier of this particular file */
|
|
395
|
+
id: string;
|
|
396
|
+
/** The name of the file */
|
|
397
|
+
name: string;
|
|
398
|
+
/** The size of the file in bytes */
|
|
399
|
+
size: number;
|
|
400
|
+
/** The SHA256 hash of the file */
|
|
401
|
+
sha256: string;
|
|
402
|
+
/** Indicates if the file was stored before the product hub existed */
|
|
403
|
+
legacy_storage: boolean;
|
|
404
|
+
/** The URL to download the file */
|
|
405
|
+
url: string;
|
|
406
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LicenseType = exports.SessionStatus = exports.ActivationStatus = void 0;
|
|
4
|
+
// prettier-ignore
|
|
5
|
+
/**
|
|
6
|
+
* Activation status values indicating the current state of plugin licensing.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* - `None`: No activation found
|
|
10
|
+
* - `Trial`: Active trial period
|
|
11
|
+
* - `TrialExpired`: Trial period has ended
|
|
12
|
+
* - `Licensed`: Valid perpetual license (Standard, NFR, or Free)
|
|
13
|
+
* - `LicenseExpired`: License has expired
|
|
14
|
+
* - `Subscription`: Valid subscription license
|
|
15
|
+
* - `SubscriptionExpired`: Subscription has expired
|
|
16
|
+
*/
|
|
17
|
+
var ActivationStatus;
|
|
18
|
+
(function (ActivationStatus) {
|
|
19
|
+
ActivationStatus["None"] = "None";
|
|
20
|
+
ActivationStatus["Trial"] = "Trial";
|
|
21
|
+
ActivationStatus["TrialExpired"] = "TrialExpired";
|
|
22
|
+
ActivationStatus["Licensed"] = "Licensed";
|
|
23
|
+
ActivationStatus["LicenseExpired"] = "LicenseExpired";
|
|
24
|
+
ActivationStatus["Subscription"] = "Subscription";
|
|
25
|
+
ActivationStatus["SubscriptionExpired"] = "SubscriptionExpired";
|
|
26
|
+
})(ActivationStatus || (exports.ActivationStatus = ActivationStatus = {}));
|
|
27
|
+
// prettier-ignore
|
|
28
|
+
/**
|
|
29
|
+
* Status of the login session stored for this product and device.
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* - `None`: No stored login session is available
|
|
33
|
+
* - `Valid`: The stored session is valid
|
|
34
|
+
* - `Invalid`: The session is malformed, expired, revoked, or belongs to another scope
|
|
35
|
+
*/
|
|
36
|
+
var SessionStatus;
|
|
37
|
+
(function (SessionStatus) {
|
|
38
|
+
SessionStatus["None"] = "None";
|
|
39
|
+
SessionStatus["Valid"] = "Valid";
|
|
40
|
+
SessionStatus["Invalid"] = "Invalid";
|
|
41
|
+
})(SessionStatus || (exports.SessionStatus = SessionStatus = {}));
|
|
42
|
+
// prettier-ignore
|
|
43
|
+
/**
|
|
44
|
+
* License type values representing different categories of product licenses.
|
|
45
|
+
*
|
|
46
|
+
* @remarks
|
|
47
|
+
* - `Standard`: Standard perpetual license
|
|
48
|
+
* - `NFR`: Not-for-resale perpetual license (typically for partners/reviewers)
|
|
49
|
+
* - `Free`: Free perpetual license
|
|
50
|
+
* - `Subscription`: Time-limited subscription license
|
|
51
|
+
*/
|
|
52
|
+
var LicenseType;
|
|
53
|
+
(function (LicenseType) {
|
|
54
|
+
LicenseType["Standard"] = "Standard";
|
|
55
|
+
LicenseType["NFR"] = "NFR";
|
|
56
|
+
LicenseType["Free"] = "Free";
|
|
57
|
+
LicenseType["Subscription"] = "Subscription";
|
|
58
|
+
})(LicenseType || (exports.LicenseType = LicenseType = {}));
|