@qr-platform/qr-code.js 0.11.10 → 0.20.1

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.
@@ -1,69 +0,0 @@
1
- import { type DecodedLicenseToken } from '../utils/token-validator';
2
- export declare const STORAGE_KEY = "QRCodeJsLicense";
3
- export type LicenseReasonCode = // Export the type
4
- 'DOMAIN_MISMATCH' | 'TOKEN_EXPIRED' | 'TOKEN_INVALID' | 'FETCH_FAILED' | 'KEY_INVALID';
5
- export interface ValidationResult {
6
- isValid: boolean;
7
- token: string | null;
8
- license: DecodedLicenseToken | null;
9
- reason?: LicenseReasonCode;
10
- }
11
- export declare class LicenseManager {
12
- private static _instance;
13
- private static _customLicenseApiUrl;
14
- private static _currentHostname;
15
- private _hls;
16
- private _decodedToken;
17
- private _licenseKey;
18
- private _isInitialized;
19
- private _initPromise;
20
- private _licenseFetcher;
21
- private constructor();
22
- /**
23
- * Gets the singleton instance of LicenseManager.
24
- */
25
- static get instance(): LicenseManager;
26
- /**
27
- * Sets the default URL used by the built-in license fetcher.
28
- * Call this *before* activating with a key if you are not providing a custom fetcher.
29
- * @param url The new default URL for fetching license tokens.
30
- */
31
- static setDefaultLicenseApiUrl(url: string): void;
32
- get hls(): boolean;
33
- get isInitialized(): boolean;
34
- getLicenseDetails(): DecodedLicenseToken | null;
35
- get licenseKey(): string | null;
36
- /**
37
- * Configures the function used to fetch a license token from a key.
38
- * @param fetcher A function that accepts a license key string and returns a Promise<string> (the token).
39
- */
40
- configureLicenseFetcher(fetcher: (licenseKey: string) => Promise<string>): void;
41
- initialize(): Promise<boolean>;
42
- private _performInitialization;
43
- /**
44
- * Resets the initialization state, forcing re-initialization on the next call to initialize().
45
- */
46
- resetInitialization(): void;
47
- /**
48
- * Resets the current license state (hls, decodedToken, licenseKey).
49
- */
50
- resetLicenseState(): void;
51
- /**
52
- * Activates the license using a pre-fetched JWT token.
53
- * Pass `null` to explicitly clear the current license state.
54
- * @param token The JWT token string, or null to clear the license.
55
- * @returns {Promise<ValidationResult>} The result of the validation.
56
- */
57
- activateWithToken(token: string | null): Promise<ValidationResult>;
58
- /**
59
- * Activates the license using a license key, fetching a token if necessary.
60
- * @param licenseKey The license key string.
61
- * @returns {Promise<ValidationResult>} The result of the validation.
62
- */
63
- activateWithKey(licenseKey: string): Promise<ValidationResult>;
64
- private _checkDomain;
65
- private _logValidationWarning;
66
- private _getStoredLicenseData;
67
- private _setStoredLicenseData;
68
- private _validateAndStoreToken;
69
- }
@@ -1,64 +0,0 @@
1
- import { type DecodedLicenseToken } from '../utils/token-validator';
2
- export interface ValidationResult {
3
- isValid: boolean;
4
- token: string | null;
5
- license: DecodedLicenseToken | null;
6
- }
7
- export declare class LicenseManagerNode {
8
- private static _instance;
9
- private static _defaultLicenseApiUrl;
10
- private _hls;
11
- private _decodedToken;
12
- private _licenseKey;
13
- private _storedToken;
14
- private _storedKey;
15
- private _isInitialized;
16
- private _initPromise;
17
- private _licenseFetcher;
18
- private constructor();
19
- /**
20
- * Gets the singleton instance of LicenseManagerNode.
21
- */
22
- static get instance(): LicenseManagerNode;
23
- /**
24
- * Sets the default absolute URL used by the built-in license fetcher.
25
- * MUST be called before activating with a key if not providing a custom fetcher.
26
- * @param url The new default absolute URL for fetching license tokens.
27
- */
28
- static setDefaultLicenseApiUrl(url: string): void;
29
- get hls(): boolean;
30
- get isInitialized(): boolean;
31
- getLicenseDetails(): DecodedLicenseToken | null;
32
- get licenseKey(): string | null;
33
- /**
34
- * Configures the function used to fetch a license token from a key.
35
- * @param fetcher A function that accepts a license key string and returns a Promise<string> (the token).
36
- */
37
- configureLicenseFetcher(fetcher: (licenseKey: string) => Promise<string>): void;
38
- initialize(): Promise<boolean>;
39
- private _performInitialization;
40
- /**
41
- * Resets the initialization state, forcing re-initialization on the next call to initialize().
42
- */
43
- resetInitialization(): void;
44
- /**
45
- * Resets the current license state (hls, decodedToken, licenseKey).
46
- */
47
- resetLicenseState(): void;
48
- /**
49
- * Activates the license using a pre-fetched JWT token.
50
- * Pass `null` to explicitly clear the current license state.
51
- * @param token The JWT token string, or null to clear the license.
52
- * @returns {Promise<ValidationResult>} The result of the validation.
53
- */
54
- activateWithToken(token: string | null): Promise<ValidationResult>;
55
- /**
56
- * Activates the license using a license key, fetching a token if necessary.
57
- * @param licenseKey The license key string.
58
- * @returns {Promise<ValidationResult>} The result of the validation.
59
- */
60
- activateWithKey(licenseKey: string): Promise<ValidationResult>;
61
- private _getStoredLicenseData;
62
- private _setStoredLicenseData;
63
- private _validateAndStoreToken;
64
- }
@@ -1,19 +0,0 @@
1
- /**
2
- * Represents the decoded payload of a valid license token.
3
- */
4
- export interface DecodedLicenseToken {
5
- sub: string;
6
- client: string;
7
- email?: string;
8
- domains?: string[];
9
- iat: number;
10
- exp: number;
11
- }
12
- /**
13
- * Validates a JWT access token using the public key.
14
- *
15
- * @param token The JWT token string to validate.
16
- * @returns The decoded token payload if the token is valid and not expired.
17
- * @throws {Error} If the token is invalid, expired, or verification fails for any other reason.
18
- */
19
- export declare function validateToken(token: string): Promise<DecodedLicenseToken>;
@@ -1,19 +0,0 @@
1
- /**
2
- * Represents the decoded payload of a valid license token.
3
- */
4
- export interface DecodedLicenseToken {
5
- sub: string;
6
- client: string;
7
- email?: string;
8
- domains?: string[];
9
- iat: number;
10
- exp: number;
11
- }
12
- /**
13
- * Validates a JWT access token using the public key.
14
- *
15
- * @param token The JWT token string to validate.
16
- * @returns The decoded token payload if the token is valid and not expired.
17
- * @throws {Error} If the token is invalid, expired, or verification fails for any other reason.
18
- */
19
- export declare function validateToken(token: string): Promise<DecodedLicenseToken>;