@licenseseat/js 0.1.0 → 0.2.0
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/README.md +674 -83
- package/dist/index.js +689 -1493
- package/dist/types/LicenseSeat.d.ts +288 -0
- package/dist/types/LicenseSeat.d.ts.map +1 -0
- package/dist/types/cache.d.ts +93 -0
- package/dist/types/cache.d.ts.map +1 -0
- package/dist/types/errors.d.ts +58 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/types.d.ts +321 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/utils.d.ts +54 -0
- package/dist/types/utils.d.ts.map +1 -0
- package/package.json +44 -8
- package/src/LicenseSeat.js +1163 -0
- package/src/cache.js +189 -0
- package/src/errors.js +77 -0
- package/src/index.js +62 -0
- package/src/types.js +144 -0
- package/src/utils.js +156 -0
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get or create the shared singleton instance
|
|
3
|
+
* @param {import('./types.js').LicenseSeatConfig} [config] - Configuration (only used on first call)
|
|
4
|
+
* @returns {LicenseSeatSDK} The shared instance
|
|
5
|
+
*/
|
|
6
|
+
export function getSharedInstance(config?: import("./types.js").LicenseSeatConfig): LicenseSeatSDK;
|
|
7
|
+
/**
|
|
8
|
+
* Configure the shared singleton instance
|
|
9
|
+
* @param {import('./types.js').LicenseSeatConfig} config - Configuration options
|
|
10
|
+
* @param {boolean} [force=false] - Force reconfiguration even if already configured
|
|
11
|
+
* @returns {LicenseSeatSDK} The configured shared instance
|
|
12
|
+
*/
|
|
13
|
+
export function configure(config: import("./types.js").LicenseSeatConfig, force?: boolean): LicenseSeatSDK;
|
|
14
|
+
/**
|
|
15
|
+
* Reset the shared singleton instance
|
|
16
|
+
* @returns {void}
|
|
17
|
+
*/
|
|
18
|
+
export function resetSharedInstance(): void;
|
|
19
|
+
/**
|
|
20
|
+
* LicenseSeat SDK Main Class
|
|
21
|
+
*
|
|
22
|
+
* Provides license activation, validation, and entitlement checking
|
|
23
|
+
* for client-side JavaScript applications.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```js
|
|
27
|
+
* const sdk = new LicenseSeatSDK({
|
|
28
|
+
* apiKey: 'your-api-key',
|
|
29
|
+
* debug: true
|
|
30
|
+
* });
|
|
31
|
+
*
|
|
32
|
+
* // Activate a license
|
|
33
|
+
* await sdk.activate('LICENSE-KEY-HERE');
|
|
34
|
+
*
|
|
35
|
+
* // Check entitlements
|
|
36
|
+
* if (sdk.hasEntitlement('pro-features')) {
|
|
37
|
+
* // Enable pro features
|
|
38
|
+
* }
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export class LicenseSeatSDK {
|
|
42
|
+
/**
|
|
43
|
+
* Create a new LicenseSeat SDK instance
|
|
44
|
+
* @param {import('./types.js').LicenseSeatConfig} [config={}] - Configuration options
|
|
45
|
+
*/
|
|
46
|
+
constructor(config?: import("./types.js").LicenseSeatConfig);
|
|
47
|
+
/**
|
|
48
|
+
* SDK configuration
|
|
49
|
+
* @type {import('./types.js').LicenseSeatConfig}
|
|
50
|
+
*/
|
|
51
|
+
config: import("./types.js").LicenseSeatConfig;
|
|
52
|
+
/**
|
|
53
|
+
* Event listeners map
|
|
54
|
+
* @type {Object<string, import('./types.js').EventCallback[]>}
|
|
55
|
+
* @private
|
|
56
|
+
*/
|
|
57
|
+
private eventListeners;
|
|
58
|
+
/**
|
|
59
|
+
* Auto-validation timer ID
|
|
60
|
+
* @type {number|null}
|
|
61
|
+
* @private
|
|
62
|
+
*/
|
|
63
|
+
private validationTimer;
|
|
64
|
+
/**
|
|
65
|
+
* License cache manager
|
|
66
|
+
* @type {LicenseCache}
|
|
67
|
+
* @private
|
|
68
|
+
*/
|
|
69
|
+
private cache;
|
|
70
|
+
/**
|
|
71
|
+
* Current online status
|
|
72
|
+
* @type {boolean}
|
|
73
|
+
* @private
|
|
74
|
+
*/
|
|
75
|
+
private online;
|
|
76
|
+
/**
|
|
77
|
+
* Current license key being auto-validated
|
|
78
|
+
* @type {string|null}
|
|
79
|
+
* @private
|
|
80
|
+
*/
|
|
81
|
+
private currentAutoLicenseKey;
|
|
82
|
+
/**
|
|
83
|
+
* Connectivity polling timer ID
|
|
84
|
+
* @type {number|null}
|
|
85
|
+
* @private
|
|
86
|
+
*/
|
|
87
|
+
private connectivityTimer;
|
|
88
|
+
/**
|
|
89
|
+
* Offline license refresh timer ID
|
|
90
|
+
* @type {number|null}
|
|
91
|
+
* @private
|
|
92
|
+
*/
|
|
93
|
+
private offlineRefreshTimer;
|
|
94
|
+
/**
|
|
95
|
+
* Last offline validation result (to avoid duplicate emits)
|
|
96
|
+
* @type {import('./types.js').ValidationResult|null}
|
|
97
|
+
* @private
|
|
98
|
+
*/
|
|
99
|
+
private lastOfflineValidation;
|
|
100
|
+
/**
|
|
101
|
+
* Initialize the SDK
|
|
102
|
+
* Loads cached license and starts auto-validation if configured.
|
|
103
|
+
* Called automatically unless autoInitialize is set to false.
|
|
104
|
+
* @returns {void}
|
|
105
|
+
*/
|
|
106
|
+
initialize(): void;
|
|
107
|
+
/**
|
|
108
|
+
* Activate a license
|
|
109
|
+
* @param {string} licenseKey - The license key to activate
|
|
110
|
+
* @param {import('./types.js').ActivationOptions} [options={}] - Activation options
|
|
111
|
+
* @returns {Promise<import('./types.js').CachedLicense>} Activation result with cached license data
|
|
112
|
+
* @throws {APIError} When the API request fails
|
|
113
|
+
*/
|
|
114
|
+
activate(licenseKey: string, options?: import("./types.js").ActivationOptions): Promise<import("./types.js").CachedLicense>;
|
|
115
|
+
/**
|
|
116
|
+
* Deactivate the current license
|
|
117
|
+
* @returns {Promise<Object>} Deactivation result from the API
|
|
118
|
+
* @throws {LicenseError} When no active license is found
|
|
119
|
+
* @throws {APIError} When the API request fails
|
|
120
|
+
*/
|
|
121
|
+
deactivate(): Promise<any>;
|
|
122
|
+
/**
|
|
123
|
+
* Validate a license
|
|
124
|
+
* @param {string} licenseKey - License key to validate
|
|
125
|
+
* @param {import('./types.js').ValidationOptions} [options={}] - Validation options
|
|
126
|
+
* @returns {Promise<import('./types.js').ValidationResult>} Validation result
|
|
127
|
+
* @throws {APIError} When the API request fails and offline fallback is not available
|
|
128
|
+
*/
|
|
129
|
+
validateLicense(licenseKey: string, options?: import("./types.js").ValidationOptions): Promise<import("./types.js").ValidationResult>;
|
|
130
|
+
/**
|
|
131
|
+
* Check if a specific entitlement is active (detailed version)
|
|
132
|
+
* @param {string} entitlementKey - The entitlement key to check
|
|
133
|
+
* @returns {import('./types.js').EntitlementCheckResult} Entitlement status with details
|
|
134
|
+
*/
|
|
135
|
+
checkEntitlement(entitlementKey: string): import("./types.js").EntitlementCheckResult;
|
|
136
|
+
/**
|
|
137
|
+
* Check if a specific entitlement is active (simple boolean version)
|
|
138
|
+
* This is a convenience method that returns a simple boolean.
|
|
139
|
+
* Use checkEntitlement() for detailed status information.
|
|
140
|
+
* @param {string} entitlementKey - The entitlement key to check
|
|
141
|
+
* @returns {boolean} True if the entitlement is active, false otherwise
|
|
142
|
+
*/
|
|
143
|
+
hasEntitlement(entitlementKey: string): boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Get offline license data from the server
|
|
146
|
+
* @returns {Promise<import('./types.js').SignedOfflineLicense>} Signed offline license data
|
|
147
|
+
* @throws {LicenseError} When no active license is found
|
|
148
|
+
* @throws {APIError} When the API request fails
|
|
149
|
+
*/
|
|
150
|
+
getOfflineLicense(): Promise<import("./types.js").SignedOfflineLicense>;
|
|
151
|
+
/**
|
|
152
|
+
* Fetch a public key from the server by key ID
|
|
153
|
+
* @param {string} keyId - The Key ID (kid) for which to fetch the public key
|
|
154
|
+
* @returns {Promise<string>} Base64-encoded public key
|
|
155
|
+
* @throws {Error} When keyId is not provided or the key is not found
|
|
156
|
+
*/
|
|
157
|
+
getPublicKey(keyId: string): Promise<string>;
|
|
158
|
+
/**
|
|
159
|
+
* Verify a signed offline license client-side using Ed25519
|
|
160
|
+
* @param {import('./types.js').SignedOfflineLicense} signedLicenseData - The signed license data
|
|
161
|
+
* @param {string} publicKeyB64 - Base64-encoded public Ed25519 key
|
|
162
|
+
* @returns {Promise<boolean>} True if verification is successful
|
|
163
|
+
* @throws {CryptoError} When crypto library is not available
|
|
164
|
+
* @throws {Error} When inputs are invalid
|
|
165
|
+
*/
|
|
166
|
+
verifyOfflineLicense(signedLicenseData: import("./types.js").SignedOfflineLicense, publicKeyB64: string): Promise<boolean>;
|
|
167
|
+
/**
|
|
168
|
+
* Get current license status
|
|
169
|
+
* @returns {import('./types.js').LicenseStatus} Current license status
|
|
170
|
+
*/
|
|
171
|
+
getStatus(): import("./types.js").LicenseStatus;
|
|
172
|
+
/**
|
|
173
|
+
* Test server authentication
|
|
174
|
+
* Useful for verifying API key/session is valid.
|
|
175
|
+
* @returns {Promise<Object>} Result from the server
|
|
176
|
+
* @throws {Error} When API key is not configured
|
|
177
|
+
* @throws {APIError} When authentication fails
|
|
178
|
+
*/
|
|
179
|
+
testAuth(): Promise<any>;
|
|
180
|
+
/**
|
|
181
|
+
* Clear all data and reset SDK state
|
|
182
|
+
* @returns {void}
|
|
183
|
+
*/
|
|
184
|
+
reset(): void;
|
|
185
|
+
/**
|
|
186
|
+
* Subscribe to an event
|
|
187
|
+
* @param {string} event - Event name
|
|
188
|
+
* @param {import('./types.js').EventCallback} callback - Event handler
|
|
189
|
+
* @returns {import('./types.js').EventUnsubscribe} Unsubscribe function
|
|
190
|
+
*/
|
|
191
|
+
on(event: string, callback: import("./types.js").EventCallback): import("./types.js").EventUnsubscribe;
|
|
192
|
+
/**
|
|
193
|
+
* Unsubscribe from an event
|
|
194
|
+
* @param {string} event - Event name
|
|
195
|
+
* @param {import('./types.js').EventCallback} callback - Event handler to remove
|
|
196
|
+
* @returns {void}
|
|
197
|
+
*/
|
|
198
|
+
off(event: string, callback: import("./types.js").EventCallback): void;
|
|
199
|
+
/**
|
|
200
|
+
* Emit an event
|
|
201
|
+
* @param {string} event - Event name
|
|
202
|
+
* @param {*} data - Event data
|
|
203
|
+
* @returns {void}
|
|
204
|
+
* @private
|
|
205
|
+
*/
|
|
206
|
+
private emit;
|
|
207
|
+
/**
|
|
208
|
+
* Start automatic license validation
|
|
209
|
+
* @param {string} licenseKey - License key to validate
|
|
210
|
+
* @returns {void}
|
|
211
|
+
* @private
|
|
212
|
+
*/
|
|
213
|
+
private startAutoValidation;
|
|
214
|
+
/**
|
|
215
|
+
* Stop automatic validation
|
|
216
|
+
* @returns {void}
|
|
217
|
+
* @private
|
|
218
|
+
*/
|
|
219
|
+
private stopAutoValidation;
|
|
220
|
+
/**
|
|
221
|
+
* Start connectivity polling (when offline)
|
|
222
|
+
* @returns {void}
|
|
223
|
+
* @private
|
|
224
|
+
*/
|
|
225
|
+
private startConnectivityPolling;
|
|
226
|
+
/**
|
|
227
|
+
* Stop connectivity polling
|
|
228
|
+
* @returns {void}
|
|
229
|
+
* @private
|
|
230
|
+
*/
|
|
231
|
+
private stopConnectivityPolling;
|
|
232
|
+
/**
|
|
233
|
+
* Fetch and cache offline license and public key
|
|
234
|
+
* @returns {Promise<void>}
|
|
235
|
+
* @private
|
|
236
|
+
*/
|
|
237
|
+
private syncOfflineAssets;
|
|
238
|
+
/**
|
|
239
|
+
* Schedule periodic offline license refresh
|
|
240
|
+
* @returns {void}
|
|
241
|
+
* @private
|
|
242
|
+
*/
|
|
243
|
+
private scheduleOfflineRefresh;
|
|
244
|
+
/**
|
|
245
|
+
* Verify cached offline license
|
|
246
|
+
* @returns {Promise<import('./types.js').ValidationResult>}
|
|
247
|
+
* @private
|
|
248
|
+
*/
|
|
249
|
+
private verifyCachedOffline;
|
|
250
|
+
/**
|
|
251
|
+
* Quick offline verification using only local data (no network)
|
|
252
|
+
* @returns {Promise<import('./types.js').ValidationResult|null>}
|
|
253
|
+
* @private
|
|
254
|
+
*/
|
|
255
|
+
private quickVerifyCachedOfflineLocal;
|
|
256
|
+
/**
|
|
257
|
+
* Make an API call with retry logic
|
|
258
|
+
* @param {string} endpoint - API endpoint (will be appended to apiBaseUrl)
|
|
259
|
+
* @param {Object} [options={}] - Fetch options
|
|
260
|
+
* @param {string} [options.method="GET"] - HTTP method
|
|
261
|
+
* @param {Object} [options.body] - Request body (will be JSON-stringified)
|
|
262
|
+
* @param {Object} [options.headers] - Additional headers
|
|
263
|
+
* @returns {Promise<Object>} API response data
|
|
264
|
+
* @throws {APIError} When the request fails after all retries
|
|
265
|
+
* @private
|
|
266
|
+
*/
|
|
267
|
+
private apiCall;
|
|
268
|
+
/**
|
|
269
|
+
* Determine if an error should be retried
|
|
270
|
+
* @param {Error} error - The error to check
|
|
271
|
+
* @returns {boolean} True if the error should trigger a retry
|
|
272
|
+
* @private
|
|
273
|
+
*/
|
|
274
|
+
private shouldRetryError;
|
|
275
|
+
/**
|
|
276
|
+
* Get CSRF token from meta tag
|
|
277
|
+
* @returns {string} CSRF token or empty string
|
|
278
|
+
*/
|
|
279
|
+
getCsrfToken(): string;
|
|
280
|
+
/**
|
|
281
|
+
* Log a message (if debug mode is enabled)
|
|
282
|
+
* @param {...*} args - Arguments to log
|
|
283
|
+
* @returns {void}
|
|
284
|
+
* @private
|
|
285
|
+
*/
|
|
286
|
+
private log;
|
|
287
|
+
}
|
|
288
|
+
//# sourceMappingURL=LicenseSeat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LicenseSeat.d.ts","sourceRoot":"","sources":["../../src/LicenseSeat.js"],"names":[],"mappings":"AAomCA;;;;GAIG;AACH,2CAHW,OAAO,YAAY,EAAE,iBAAiB,GACpC,cAAc,CAO1B;AAED;;;;;GAKG;AACH,kCAJW,OAAO,YAAY,EAAE,iBAAiB,UACtC,OAAO,GACL,cAAc,CAW1B;AAED;;;GAGG;AACH,uCAFa,IAAI,CAOhB;AAplCD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH;IACE;;;OAGG;IACH,qBAFW,OAAO,YAAY,EAAE,iBAAiB,EAiFhD;IA9EC;;;OAGG;IACH,QAFU,OAAO,YAAY,EAAE,iBAAiB,CAK/C;IAED;;;;OAIG;IACH,uBAAwB;IAExB;;;;OAIG;IACH,wBAA2B;IAE3B;;;;OAIG;IACH,cAAwD;IAExD;;;;OAIG;IACH,eAAkB;IAElB;;;;OAIG;IACH,8BAAiC;IAEjC;;;;OAIG;IACH,0BAA6B;IAE7B;;;;OAIG;IACH,4BAA+B;IAE/B;;;;OAIG;IACH,8BAAiC;IAiBnC;;;;;OAKG;IACH,cAFa,IAAI,CAkDhB;IAED;;;;;;OAMG;IACH,qBALW,MAAM,YACN,OAAO,YAAY,EAAE,iBAAiB,GACpC,OAAO,CAAC,OAAO,YAAY,EAAE,aAAa,CAAC,CA4CvD;IAED;;;;;OAKG;IACH,cAJa,OAAO,KAAQ,CA+B3B;IAED;;;;;;OAMG;IACH,4BALW,MAAM,YACN,OAAO,YAAY,EAAE,iBAAiB,GACpC,OAAO,CAAC,OAAO,YAAY,EAAE,gBAAgB,CAAC,CAkF1D;IAED;;;;OAIG;IACH,iCAHW,MAAM,GACJ,OAAO,YAAY,EAAE,sBAAsB,CA6BvD;IAED;;;;;;OAMG;IACH,+BAHW,MAAM,GACJ,OAAO,CAInB;IAED;;;;;OAKG;IACH,qBAJa,OAAO,CAAC,OAAO,YAAY,EAAE,oBAAoB,CAAC,CAmC9D;IAED;;;;;OAKG;IACH,oBAJW,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CAwB3B;IAED;;;;;;;OAOG;IACH,wCANW,OAAO,YAAY,EAAE,oBAAoB,gBACzC,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAuD5B;IAED;;;OAGG;IACH,aAFa,OAAO,YAAY,EAAE,aAAa,CA6C9C;IAED;;;;;;OAMG;IACH,YAJa,OAAO,KAAQ,CAoB3B;IAED;;;OAGG;IACH,SAFa,IAAI,CAOhB;IAMD;;;;;OAKG;IACH,UAJW,MAAM,YACN,OAAO,YAAY,EAAE,aAAa,GAChC,OAAO,YAAY,EAAE,gBAAgB,CAQjD;IAED;;;;;OAKG;IACH,WAJW,MAAM,YACN,OAAO,YAAY,EAAE,aAAa,GAChC,IAAI,CAQhB;IAED;;;;;;OAMG;IACH,aAWC;IAMD;;;;;OAKG;IACH,4BAqBC;IAED;;;;OAIG;IACH,2BAMC;IAED;;;;OAIG;IACH,iCA4BC;IAED;;;;OAIG;IACH,gCAKC;IAMD;;;;OAIG;IACH,0BA+BC;IAED;;;;OAIG;IACH,+BAMC;IAED;;;;OAIG;IACH,4BA0EC;IAED;;;;OAIG;IACH,sCAsBC;IAMD;;;;;;;;;;OAUG;IACH,gBAiFC;IAED;;;;;OAKG;IACH,yBAsBC;IAMD;;;OAGG;IACH,gBAFa,MAAM,CAIlB;IAED;;;;;OAKG;IACH,YAIC;CACF"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LicenseSeat SDK Cache Manager
|
|
3
|
+
* Handles persistent storage of license data, offline licenses, and public keys.
|
|
4
|
+
* @module cache
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* License Cache Manager
|
|
8
|
+
* Manages persistent storage of license data using localStorage.
|
|
9
|
+
*/
|
|
10
|
+
export class LicenseCache {
|
|
11
|
+
/**
|
|
12
|
+
* Create a LicenseCache instance
|
|
13
|
+
* @param {string} [prefix="licenseseat_"] - Prefix for all localStorage keys
|
|
14
|
+
*/
|
|
15
|
+
constructor(prefix?: string);
|
|
16
|
+
/** @type {string} */
|
|
17
|
+
prefix: string;
|
|
18
|
+
/** @type {string} */
|
|
19
|
+
publicKeyCacheKey: string;
|
|
20
|
+
/**
|
|
21
|
+
* Get the cached license data
|
|
22
|
+
* @returns {import('./types.js').CachedLicense|null} Cached license or null if not found
|
|
23
|
+
*/
|
|
24
|
+
getLicense(): import("./types.js").CachedLicense | null;
|
|
25
|
+
/**
|
|
26
|
+
* Store license data in cache
|
|
27
|
+
* @param {import('./types.js').CachedLicense} data - License data to cache
|
|
28
|
+
* @returns {void}
|
|
29
|
+
*/
|
|
30
|
+
setLicense(data: import("./types.js").CachedLicense): void;
|
|
31
|
+
/**
|
|
32
|
+
* Update the validation data for the cached license
|
|
33
|
+
* @param {import('./types.js').ValidationResult} validationData - Validation result to store
|
|
34
|
+
* @returns {void}
|
|
35
|
+
*/
|
|
36
|
+
updateValidation(validationData: import("./types.js").ValidationResult): void;
|
|
37
|
+
/**
|
|
38
|
+
* Get the device identifier from the cached license
|
|
39
|
+
* @returns {string|null} Device identifier or null if not found
|
|
40
|
+
*/
|
|
41
|
+
getDeviceId(): string | null;
|
|
42
|
+
/**
|
|
43
|
+
* Clear the cached license data
|
|
44
|
+
* @returns {void}
|
|
45
|
+
*/
|
|
46
|
+
clearLicense(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Get the cached offline license
|
|
49
|
+
* @returns {import('./types.js').SignedOfflineLicense|null} Offline license or null if not found
|
|
50
|
+
*/
|
|
51
|
+
getOfflineLicense(): import("./types.js").SignedOfflineLicense | null;
|
|
52
|
+
/**
|
|
53
|
+
* Store offline license data in cache
|
|
54
|
+
* @param {import('./types.js').SignedOfflineLicense} data - Signed offline license to cache
|
|
55
|
+
* @returns {void}
|
|
56
|
+
*/
|
|
57
|
+
setOfflineLicense(data: import("./types.js").SignedOfflineLicense): void;
|
|
58
|
+
/**
|
|
59
|
+
* Clear the cached offline license
|
|
60
|
+
* @returns {void}
|
|
61
|
+
*/
|
|
62
|
+
clearOfflineLicense(): void;
|
|
63
|
+
/**
|
|
64
|
+
* Get a cached public key by key ID
|
|
65
|
+
* @param {string} keyId - The key ID to look up
|
|
66
|
+
* @returns {string|null} Base64-encoded public key or null if not found
|
|
67
|
+
*/
|
|
68
|
+
getPublicKey(keyId: string): string | null;
|
|
69
|
+
/**
|
|
70
|
+
* Store a public key in cache
|
|
71
|
+
* @param {string} keyId - The key ID
|
|
72
|
+
* @param {string} publicKeyB64 - Base64-encoded public key
|
|
73
|
+
* @returns {void}
|
|
74
|
+
*/
|
|
75
|
+
setPublicKey(keyId: string, publicKeyB64: string): void;
|
|
76
|
+
/**
|
|
77
|
+
* Clear all LicenseSeat SDK data for this prefix
|
|
78
|
+
* @returns {void}
|
|
79
|
+
*/
|
|
80
|
+
clear(): void;
|
|
81
|
+
/**
|
|
82
|
+
* Get the last seen timestamp (for clock tamper detection)
|
|
83
|
+
* @returns {number|null} Unix timestamp in milliseconds or null if not set
|
|
84
|
+
*/
|
|
85
|
+
getLastSeenTimestamp(): number | null;
|
|
86
|
+
/**
|
|
87
|
+
* Store the last seen timestamp
|
|
88
|
+
* @param {number} ts - Unix timestamp in milliseconds
|
|
89
|
+
* @returns {void}
|
|
90
|
+
*/
|
|
91
|
+
setLastSeenTimestamp(ts: number): void;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/cache.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH;IACE;;;OAGG;IACH,qBAFW,MAAM,EAOhB;IAJC,qBAAqB;IACrB,QADW,MAAM,CACG;IACpB,qBAAqB;IACrB,mBADW,MAAM,CACmC;IAGtD;;;OAGG;IACH,cAFa,OAAO,YAAY,EAAE,aAAa,GAAC,IAAI,CAUnD;IAED;;;;OAIG;IACH,iBAHW,OAAO,YAAY,EAAE,aAAa,GAChC,IAAI,CAQhB;IAED;;;;OAIG;IACH,iCAHW,OAAO,YAAY,EAAE,gBAAgB,GACnC,IAAI,CAShB;IAED;;;OAGG;IACH,eAFa,MAAM,GAAC,IAAI,CAKvB;IAED;;;OAGG;IACH,gBAFa,IAAI,CAIhB;IAED;;;OAGG;IACH,qBAFa,OAAO,YAAY,EAAE,oBAAoB,GAAC,IAAI,CAU1D;IAED;;;;OAIG;IACH,wBAHW,OAAO,YAAY,EAAE,oBAAoB,GACvC,IAAI,CAWhB;IAED;;;OAGG;IACH,uBAFa,IAAI,CAIhB;IAED;;;;OAIG;IACH,oBAHW,MAAM,GACJ,MAAM,GAAC,IAAI,CAYvB;IAED;;;;;OAKG;IACH,oBAJW,MAAM,gBACN,MAAM,GACJ,IAAI,CAYhB;IAED;;;OAGG;IACH,SAFa,IAAI,CAUhB;IAED;;;OAGG;IACH,wBAFa,MAAM,GAAC,IAAI,CAKvB;IAED;;;;OAIG;IACH,yBAHW,MAAM,GACJ,IAAI,CAQhB;CACF"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LicenseSeat SDK Error Classes
|
|
3
|
+
* @module errors
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Custom API Error class for HTTP request failures
|
|
7
|
+
* @extends Error
|
|
8
|
+
*/
|
|
9
|
+
export class APIError extends Error {
|
|
10
|
+
/**
|
|
11
|
+
* Create an APIError
|
|
12
|
+
* @param {string} message - Error message
|
|
13
|
+
* @param {number} status - HTTP status code (0 for network failures)
|
|
14
|
+
* @param {import('./types.js').APIErrorData} [data] - Additional error data from the API response
|
|
15
|
+
*/
|
|
16
|
+
constructor(message: string, status: number, data?: import("./types.js").APIErrorData);
|
|
17
|
+
/** @type {number} */
|
|
18
|
+
status: number;
|
|
19
|
+
/** @type {import('./types.js').APIErrorData|undefined} */
|
|
20
|
+
data: import("./types.js").APIErrorData | undefined;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Error thrown when SDK operations are attempted without proper configuration
|
|
24
|
+
* @extends Error
|
|
25
|
+
*/
|
|
26
|
+
export class ConfigurationError extends Error {
|
|
27
|
+
/**
|
|
28
|
+
* Create a ConfigurationError
|
|
29
|
+
* @param {string} message - Error message
|
|
30
|
+
*/
|
|
31
|
+
constructor(message: string);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Error thrown when license operations fail
|
|
35
|
+
* @extends Error
|
|
36
|
+
*/
|
|
37
|
+
export class LicenseError extends Error {
|
|
38
|
+
/**
|
|
39
|
+
* Create a LicenseError
|
|
40
|
+
* @param {string} message - Error message
|
|
41
|
+
* @param {string} [code] - Machine-readable error code
|
|
42
|
+
*/
|
|
43
|
+
constructor(message: string, code?: string);
|
|
44
|
+
/** @type {string|undefined} */
|
|
45
|
+
code: string | undefined;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Error thrown when cryptographic operations fail
|
|
49
|
+
* @extends Error
|
|
50
|
+
*/
|
|
51
|
+
export class CryptoError extends Error {
|
|
52
|
+
/**
|
|
53
|
+
* Create a CryptoError
|
|
54
|
+
* @param {string} message - Error message
|
|
55
|
+
*/
|
|
56
|
+
constructor(message: string);
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH;IACE;;;;;OAKG;IACH,qBAJW,MAAM,UACN,MAAM,SACN,OAAO,YAAY,EAAE,YAAY,EAU3C;IAJC,qBAAqB;IACrB,QADW,MAAM,CACG;IACpB,0DAA0D;IAC1D,MADW,OAAO,YAAY,EAAE,YAAY,GAAC,SAAS,CACtC;CAEnB;AAED;;;GAGG;AACH;IACE;;;OAGG;IACH,qBAFW,MAAM,EAMhB;CACF;AAED;;;GAGG;AACH;IACE;;;;OAIG;IACH,qBAHW,MAAM,SACN,MAAM,EAQhB;IAFC,+BAA+B;IAC/B,MADW,MAAM,GAAC,SAAS,CACX;CAEnB;AAED;;;GAGG;AACH;IACE;;;OAGG;IACH,qBAFW,MAAM,EAMhB;CACF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { LicenseCache } from "./cache.js";
|
|
2
|
+
export default LicenseSeatSDK;
|
|
3
|
+
import { LicenseSeatSDK } from "./LicenseSeat.js";
|
|
4
|
+
export { LicenseSeatSDK, getSharedInstance, configure, resetSharedInstance } from "./LicenseSeat.js";
|
|
5
|
+
export { APIError, ConfigurationError, LicenseError, CryptoError } from "./errors.js";
|
|
6
|
+
export { parseActiveEntitlements, constantTimeEqual, canonicalJsonStringify, base64UrlDecode, generateDeviceId, getCsrfToken } from "./utils.js";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.js"],"names":[],"mappings":";;+BA4D+B,kBAAkB"}
|