lucia-sdk 0.9.0 → 0.9.2
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/dist/__tests__/auto-init.test.d.ts +5 -5
- package/dist/__tests__/base/index.test.d.ts +1 -1
- package/dist/__tests__/core/index.test.d.ts +1 -1
- package/dist/__tests__/integration/auto-init-integration.test.d.ts +9 -9
- package/dist/__tests__/integration/auto-track-integration.test.d.ts +4 -4
- package/dist/__tests__/integration/sdk-integration.test.d.ts +1 -1
- package/dist/__tests__/utils/click-tracker.test.d.ts +4 -4
- package/dist/__tests__/utils/data.test.d.ts +7 -7
- package/dist/__tests__/utils/evm.test.d.ts +1 -1
- package/dist/__tests__/utils/http-client.test.d.ts +1 -1
- package/dist/__tests__/utils/privacy.test.d.ts +4 -4
- package/dist/__tests__/utils/session.test.d.ts +1 -1
- package/dist/__tests__/utils/solana.test.d.ts +1 -1
- package/dist/__tests__/utils/store.test.d.ts +1 -1
- package/dist/base/index.d.ts +12 -12
- package/dist/constants.d.ts +2 -2
- package/dist/core/index.d.ts +65 -64
- package/dist/index.d.ts +5 -6
- package/dist/index.es.js +1 -18
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1 -18
- package/dist/index.js.map +1 -1
- package/dist/package.json +37 -47
- package/dist/types.d.ts +100 -99
- package/dist/umd/lucia-sdk-0.9.2.min.js +1 -0
- package/dist/umd/lucia-sdk-latest.min.js +1 -18
- package/dist/utils/click-tracker.d.ts +100 -100
- package/dist/utils/data.d.ts +98 -99
- package/dist/utils/evm.d.ts +69 -75
- package/dist/utils/http-client.d.ts +17 -17
- package/dist/utils/logger.d.ts +7 -7
- package/dist/utils/privacy.d.ts +33 -33
- package/dist/utils/session.d.ts +51 -51
- package/dist/utils/solana.d.ts +50 -50
- package/dist/utils/store.d.ts +14 -14
- package/dist/version.d.ts +1 -1
- package/package.json +37 -47
- package/CHANGELOG.md +0 -186
- package/dist/umd/lucia-sdk-0.9.0.min.js +0 -18
package/dist/utils/data.d.ts
CHANGED
|
@@ -1,99 +1,98 @@
|
|
|
1
|
-
import { BrowserData, WalletData } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Collects static browser and hardware data that's unlikely to change during a session.
|
|
4
|
-
* This data can be cached for performance optimization.
|
|
5
|
-
*
|
|
6
|
-
* @returns {BrowserData} Static browser and hardware data including device capabilities,
|
|
7
|
-
* screen specifications, and browser features.
|
|
8
|
-
*/
|
|
9
|
-
export declare function getBrowserData(): BrowserData
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* @
|
|
35
|
-
* @param {
|
|
36
|
-
* @
|
|
37
|
-
* @
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
export declare function safeAccess<T>(fn: () => T): T
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* @
|
|
52
|
-
* @
|
|
53
|
-
* @
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
export declare function getColorGamut(): string[];
|
|
1
|
+
import { BrowserData, WalletData } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Collects static browser and hardware data that's unlikely to change during a session.
|
|
4
|
+
* This data can be cached for performance optimization.
|
|
5
|
+
*
|
|
6
|
+
* @returns {Promise<BrowserData>} Static browser and hardware data including device capabilities,
|
|
7
|
+
* screen specifications, and browser features.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getBrowserData(): Promise<BrowserData>;
|
|
10
|
+
/**
|
|
11
|
+
* Clears the browser data cache (useful for testing)
|
|
12
|
+
*/
|
|
13
|
+
export declare function clearBrowserDataCache(): void;
|
|
14
|
+
/**
|
|
15
|
+
* Collects dynamic wallet information that may change during a session.
|
|
16
|
+
* This data should be fetched each time it's needed for up-to-date values.
|
|
17
|
+
*
|
|
18
|
+
* @returns {Promise<WalletData>} Dynamic wallet data including addresses and provider information.
|
|
19
|
+
*/
|
|
20
|
+
export declare function getWalletData(): Promise<WalletData>;
|
|
21
|
+
/**
|
|
22
|
+
* Extracts tracking parameters from the current URL.
|
|
23
|
+
* Captures UTM parameters, ID-related values, and referrer information.
|
|
24
|
+
*
|
|
25
|
+
* @returns {Record<string, string>} An object containing all tracking parameters
|
|
26
|
+
* from the current URL as key-value pairs.
|
|
27
|
+
*/
|
|
28
|
+
export declare function getUtmParams(): Record<string, string>;
|
|
29
|
+
/**
|
|
30
|
+
* Safely executes a function and handles any exceptions that may occur.
|
|
31
|
+
* Provides type safety through function overloads.
|
|
32
|
+
*
|
|
33
|
+
* @template T - The return type of the function
|
|
34
|
+
* @param {() => T} fn - The function to execute safely
|
|
35
|
+
* @param {T} [fallback] - Optional fallback value to return if the function throws
|
|
36
|
+
* @returns {T | undefined} The result of the function or fallback/undefined if it throws
|
|
37
|
+
* @example
|
|
38
|
+
* // Returns 42 or undefined if window.answer doesn't exist
|
|
39
|
+
* const answer = safeAccess(() => window.answer);
|
|
40
|
+
*
|
|
41
|
+
* // Returns window.width or 800 if accessing window.width throws
|
|
42
|
+
* const width = safeAccess(() => window.width, 800);
|
|
43
|
+
*/
|
|
44
|
+
export declare function safeAccess<T>(fn: () => T): T | undefined;
|
|
45
|
+
export declare function safeAccess<T>(fn: () => T, fallback: T): T;
|
|
46
|
+
/**
|
|
47
|
+
* Filters an object by removing all falsy values (undefined, null, false, 0, '', NaN)
|
|
48
|
+
* from its properties.
|
|
49
|
+
*
|
|
50
|
+
* @template T - The type of the input object
|
|
51
|
+
* @param {T} obj - The object to filter
|
|
52
|
+
* @returns {Partial<T>} A new object containing only the properties with truthy values
|
|
53
|
+
* @example
|
|
54
|
+
* // Returns { name: 'John', age: 30 }
|
|
55
|
+
* filterObject({ name: 'John', age: 30, address: '', active: false });
|
|
56
|
+
*/
|
|
57
|
+
export declare function filterObject<T extends object>(obj: T): Partial<T>;
|
|
58
|
+
/**
|
|
59
|
+
* Generates a unique hash based on canvas rendering characteristics.
|
|
60
|
+
* Creates a canvas with specific shapes and colors, then generates a SHA-256 hash
|
|
61
|
+
* of the canvas data. This serves as a fingerprinting mechanism for the browser.
|
|
62
|
+
*
|
|
63
|
+
* @returns {Promise<string | undefined>} A SHA-256 hexadecimal hash string representing the canvas fingerprint,
|
|
64
|
+
* or undefined if canvas is not supported or operation fails
|
|
65
|
+
*/
|
|
66
|
+
export declare function getCanvasFingerprint(): Promise<string | undefined>;
|
|
67
|
+
/**
|
|
68
|
+
* Detects if the device supports touch events.
|
|
69
|
+
* Used to determine if the user is on a touch-enabled device.
|
|
70
|
+
*
|
|
71
|
+
* @returns {boolean} True if touch events are supported, false otherwise
|
|
72
|
+
*/
|
|
73
|
+
export declare function isTouchEnabled(): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Detects if Apple Pay is available in the current browser.
|
|
76
|
+
* Checks for the presence and functionality of the ApplePaySession API.
|
|
77
|
+
*
|
|
78
|
+
* @returns {boolean | undefined} True if Apple Pay is available, false if it's not,
|
|
79
|
+
* or undefined if detection fails
|
|
80
|
+
*/
|
|
81
|
+
export declare function getApplePayAvailable(): boolean | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* Detects the user's contrast preference setting from the browser.
|
|
84
|
+
* Uses the matchMedia API to determine if the user has specified any
|
|
85
|
+
* contrast preference in their system settings.
|
|
86
|
+
*
|
|
87
|
+
* @returns {string | undefined} The contrast preference ('None', 'More', 'Less', 'ForcedColors'),
|
|
88
|
+
* or undefined if detection fails
|
|
89
|
+
*/
|
|
90
|
+
export declare function getContrastPreference(): string | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* Detects the color gamuts supported by the user's device.
|
|
93
|
+
* Uses the matchMedia API to test for support of various color gamut formats.
|
|
94
|
+
*
|
|
95
|
+
* @returns {string[]} An array of supported color gamut identifiers
|
|
96
|
+
* (e.g., 'rec2020', 'p3', 'srgb', etc.)
|
|
97
|
+
*/
|
|
98
|
+
export declare function getColorGamut(): string[];
|
package/dist/utils/evm.d.ts
CHANGED
|
@@ -1,75 +1,69 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Checks if an Ethereum provider exists in the window object
|
|
3
|
-
* @returns boolean indicating if an Ethereum provider exists
|
|
4
|
-
*/
|
|
5
|
-
export declare function checkIfEthereumProviderExists(): boolean;
|
|
6
|
-
/**
|
|
7
|
-
* Gets the Ethereum address from the connected wallet
|
|
8
|
-
* @returns Promise resolving to the Ethereum address or null if not available
|
|
9
|
-
*/
|
|
10
|
-
export declare function getEthereumAddress(): Promise<string | null>;
|
|
11
|
-
/**
|
|
12
|
-
* Formats an Ethereum address for display by shortening it
|
|
13
|
-
* @param address The full Ethereum address
|
|
14
|
-
* @returns Shortened address in the format "0x1234...5678"
|
|
15
|
-
*/
|
|
16
|
-
export declare function formatEthereumAddress(address: string): string;
|
|
17
|
-
/**
|
|
18
|
-
* Sets up listeners for Ethereum account changes
|
|
19
|
-
* @param callback Function to call when accounts change
|
|
20
|
-
*/
|
|
21
|
-
export declare function setupEthereumAccountListeners(callback: (accounts: string[]) => void): void;
|
|
22
|
-
/**
|
|
23
|
-
* Gets the current Ethereum chain ID
|
|
24
|
-
* @returns Promise resolving to the chain ID or null if not available
|
|
25
|
-
*/
|
|
26
|
-
export declare function getEthereumChainId(): Promise<string | null>;
|
|
27
|
-
/**
|
|
28
|
-
* Checks if a wallet is connected and returns the address if it is
|
|
29
|
-
* @returns Promise resolving to the connected address or null
|
|
30
|
-
*/
|
|
31
|
-
export declare function getConnectedWalletAddress(): Promise<string | null>;
|
|
32
|
-
/**
|
|
33
|
-
* Checks if the connected wallet is MetaMask
|
|
34
|
-
* @returns boolean indicating if the connected wallet is MetaMask
|
|
35
|
-
*/
|
|
36
|
-
export declare function isMetaMask(): Promise<boolean>;
|
|
37
|
-
/**
|
|
38
|
-
* Gets the name of the connected wallet
|
|
39
|
-
* @returns Promise resolving to the name of the connected wallet, or null if not available
|
|
40
|
-
*/
|
|
41
|
-
export declare function getWalletName(): Promise<string | null>;
|
|
42
|
-
/**
|
|
43
|
-
* Provider information interface
|
|
44
|
-
*/
|
|
45
|
-
export interface ProviderInfo {
|
|
46
|
-
isMetaMask: boolean;
|
|
47
|
-
isCoinbaseWallet: boolean;
|
|
48
|
-
isWalletConnect: boolean;
|
|
49
|
-
isTrust: boolean;
|
|
50
|
-
isImToken: boolean;
|
|
51
|
-
isBraveWallet: boolean;
|
|
52
|
-
isTokenPocket: boolean;
|
|
53
|
-
isStatus: boolean;
|
|
54
|
-
isTally: boolean;
|
|
55
|
-
isAlphaWallet: boolean;
|
|
56
|
-
isOpera: boolean;
|
|
57
|
-
isCoin98: boolean;
|
|
58
|
-
isMathWallet: boolean;
|
|
59
|
-
isOneInch: boolean;
|
|
60
|
-
isRainbow: boolean;
|
|
61
|
-
isBinanceChainWallet: boolean;
|
|
62
|
-
isFrame: boolean;
|
|
63
|
-
userAgent: string;
|
|
64
|
-
chainId?: string;
|
|
65
|
-
networkVersion?: string;
|
|
66
|
-
name: string;
|
|
67
|
-
isPossiblyGenericInjectedProvider?: boolean;
|
|
68
|
-
}
|
|
69
|
-
declare
|
|
70
|
-
interface Window {
|
|
71
|
-
BinanceChain?: any;
|
|
72
|
-
ethereum?: any;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
export declare function getExtendedProviderInfo(): Promise<ProviderInfo | null>;
|
|
1
|
+
/**
|
|
2
|
+
* Checks if an Ethereum provider exists in the window object
|
|
3
|
+
* @returns boolean indicating if an Ethereum provider exists
|
|
4
|
+
*/
|
|
5
|
+
export declare function checkIfEthereumProviderExists(): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Gets the Ethereum address from the connected wallet
|
|
8
|
+
* @returns Promise resolving to the Ethereum address or null if not available
|
|
9
|
+
*/
|
|
10
|
+
export declare function getEthereumAddress(): Promise<string | null>;
|
|
11
|
+
/**
|
|
12
|
+
* Formats an Ethereum address for display by shortening it
|
|
13
|
+
* @param address The full Ethereum address
|
|
14
|
+
* @returns Shortened address in the format "0x1234...5678"
|
|
15
|
+
*/
|
|
16
|
+
export declare function formatEthereumAddress(address: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Sets up listeners for Ethereum account changes
|
|
19
|
+
* @param callback Function to call when accounts change
|
|
20
|
+
*/
|
|
21
|
+
export declare function setupEthereumAccountListeners(callback: (accounts: string[]) => void): void;
|
|
22
|
+
/**
|
|
23
|
+
* Gets the current Ethereum chain ID
|
|
24
|
+
* @returns Promise resolving to the chain ID or null if not available
|
|
25
|
+
*/
|
|
26
|
+
export declare function getEthereumChainId(): Promise<string | null>;
|
|
27
|
+
/**
|
|
28
|
+
* Checks if a wallet is connected and returns the address if it is
|
|
29
|
+
* @returns Promise resolving to the connected address or null
|
|
30
|
+
*/
|
|
31
|
+
export declare function getConnectedWalletAddress(): Promise<string | null>;
|
|
32
|
+
/**
|
|
33
|
+
* Checks if the connected wallet is MetaMask
|
|
34
|
+
* @returns boolean indicating if the connected wallet is MetaMask
|
|
35
|
+
*/
|
|
36
|
+
export declare function isMetaMask(): Promise<boolean>;
|
|
37
|
+
/**
|
|
38
|
+
* Gets the name of the connected wallet
|
|
39
|
+
* @returns Promise resolving to the name of the connected wallet, or null if not available
|
|
40
|
+
*/
|
|
41
|
+
export declare function getWalletName(): Promise<string | null>;
|
|
42
|
+
/**
|
|
43
|
+
* Provider information interface
|
|
44
|
+
*/
|
|
45
|
+
export interface ProviderInfo {
|
|
46
|
+
isMetaMask: boolean;
|
|
47
|
+
isCoinbaseWallet: boolean;
|
|
48
|
+
isWalletConnect: boolean;
|
|
49
|
+
isTrust: boolean;
|
|
50
|
+
isImToken: boolean;
|
|
51
|
+
isBraveWallet: boolean;
|
|
52
|
+
isTokenPocket: boolean;
|
|
53
|
+
isStatus: boolean;
|
|
54
|
+
isTally: boolean;
|
|
55
|
+
isAlphaWallet: boolean;
|
|
56
|
+
isOpera: boolean;
|
|
57
|
+
isCoin98: boolean;
|
|
58
|
+
isMathWallet: boolean;
|
|
59
|
+
isOneInch: boolean;
|
|
60
|
+
isRainbow: boolean;
|
|
61
|
+
isBinanceChainWallet: boolean;
|
|
62
|
+
isFrame: boolean;
|
|
63
|
+
userAgent: string;
|
|
64
|
+
chainId?: string;
|
|
65
|
+
networkVersion?: string;
|
|
66
|
+
name: string;
|
|
67
|
+
isPossiblyGenericInjectedProvider?: boolean;
|
|
68
|
+
}
|
|
69
|
+
export declare function getExtendedProviderInfo(): Promise<ProviderInfo | null>;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import Logger from './logger';
|
|
2
|
-
import Store from './store';
|
|
3
|
-
declare class HttpClient {
|
|
4
|
-
store: typeof Store.store;
|
|
5
|
-
baseURL: string;
|
|
6
|
-
logger: Logger;
|
|
7
|
-
private requestQueue;
|
|
8
|
-
private isProcessingQueue;
|
|
9
|
-
private initComplete;
|
|
10
|
-
constructor(store: typeof Store.store);
|
|
11
|
-
private getBaseURL;
|
|
12
|
-
get<T extends unknown>(url: string): Promise<T | null>;
|
|
13
|
-
post<T extends unknown>(url: string, data: unknown, fireAndForget?: boolean): Promise<T | null>;
|
|
14
|
-
private processQueue;
|
|
15
|
-
private executePost;
|
|
16
|
-
}
|
|
17
|
-
export default HttpClient;
|
|
1
|
+
import Logger from './logger';
|
|
2
|
+
import Store from './store';
|
|
3
|
+
declare class HttpClient {
|
|
4
|
+
store: typeof Store.store;
|
|
5
|
+
baseURL: string;
|
|
6
|
+
logger: Logger;
|
|
7
|
+
private requestQueue;
|
|
8
|
+
private isProcessingQueue;
|
|
9
|
+
private initComplete;
|
|
10
|
+
constructor(store: typeof Store.store);
|
|
11
|
+
private getBaseURL;
|
|
12
|
+
get<T extends unknown>(url: string): Promise<T | null>;
|
|
13
|
+
post<T extends unknown>(url: string, data: unknown, fireAndForget?: boolean): Promise<T | null>;
|
|
14
|
+
private processQueue;
|
|
15
|
+
private executePost;
|
|
16
|
+
}
|
|
17
|
+
export default HttpClient;
|
package/dist/utils/logger.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import Store from './store';
|
|
2
|
-
declare class Logger {
|
|
3
|
-
store: typeof Store.store;
|
|
4
|
-
constructor(store: typeof Store.store);
|
|
5
|
-
log(level: 'log' | 'error' | 'warn' | 'info', ...args: unknown[]): void;
|
|
6
|
-
}
|
|
7
|
-
export default Logger;
|
|
1
|
+
import Store from './store';
|
|
2
|
+
declare class Logger {
|
|
3
|
+
store: typeof Store.store;
|
|
4
|
+
constructor(store: typeof Store.store);
|
|
5
|
+
log(level: 'log' | 'error' | 'warn' | 'info', ...args: unknown[]): void;
|
|
6
|
+
}
|
|
7
|
+
export default Logger;
|
package/dist/utils/privacy.d.ts
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Privacy utilities for automated click tracking
|
|
3
|
-
* Handles sensitive element detection and text sanitization
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Privacy guard class for detecting sensitive elements and content
|
|
7
|
-
*/
|
|
8
|
-
export declare class PrivacyGuard {
|
|
9
|
-
private sensitiveSelectors;
|
|
10
|
-
constructor(additionalSelectors?: string[]);
|
|
11
|
-
/**
|
|
12
|
-
* Check if an element or its ancestors are sensitive
|
|
13
|
-
* @param element Element to check
|
|
14
|
-
* @returns true if element should not be tracked
|
|
15
|
-
*/
|
|
16
|
-
isSensitive(element: Element): boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Check if text content contains sensitive patterns
|
|
19
|
-
* @param text Text to check
|
|
20
|
-
* @returns true if text appears to contain sensitive data
|
|
21
|
-
*/
|
|
22
|
-
containsSensitiveData(text: string): boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Sanitize text by removing or masking potentially sensitive content
|
|
25
|
-
* @param text Text to sanitize
|
|
26
|
-
* @returns Sanitized text
|
|
27
|
-
*/
|
|
28
|
-
sanitizeText(text: string): string;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Default privacy guard instance
|
|
32
|
-
*/
|
|
33
|
-
export declare const defaultPrivacyGuard: PrivacyGuard;
|
|
1
|
+
/**
|
|
2
|
+
* Privacy utilities for automated click tracking
|
|
3
|
+
* Handles sensitive element detection and text sanitization
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Privacy guard class for detecting sensitive elements and content
|
|
7
|
+
*/
|
|
8
|
+
export declare class PrivacyGuard {
|
|
9
|
+
private sensitiveSelectors;
|
|
10
|
+
constructor(additionalSelectors?: string[]);
|
|
11
|
+
/**
|
|
12
|
+
* Check if an element or its ancestors are sensitive
|
|
13
|
+
* @param element Element to check
|
|
14
|
+
* @returns true if element should not be tracked
|
|
15
|
+
*/
|
|
16
|
+
isSensitive(element: Element): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Check if text content contains sensitive patterns
|
|
19
|
+
* @param text Text to check
|
|
20
|
+
* @returns true if text appears to contain sensitive data
|
|
21
|
+
*/
|
|
22
|
+
containsSensitiveData(text: string): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Sanitize text by removing or masking potentially sensitive content
|
|
25
|
+
* @param text Text to sanitize
|
|
26
|
+
* @returns Sanitized text
|
|
27
|
+
*/
|
|
28
|
+
sanitizeText(text: string): string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Default privacy guard instance
|
|
32
|
+
*/
|
|
33
|
+
export declare const defaultPrivacyGuard: PrivacyGuard;
|
package/dist/utils/session.d.ts
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Retrieves session data from sessionStorage
|
|
3
|
-
* @returns Session data object or null if no session exists
|
|
4
|
-
*/
|
|
5
|
-
export declare function getSessionData(): {
|
|
6
|
-
id: string;
|
|
7
|
-
hash?: string;
|
|
8
|
-
timestamp: number;
|
|
9
|
-
} | null;
|
|
10
|
-
/**
|
|
11
|
-
* Stores a new client session ID in sessionStorage (before init call)
|
|
12
|
-
* No hash is generated - hash comes from backend after init
|
|
13
|
-
* @returns The newly created session object
|
|
14
|
-
*/
|
|
15
|
-
export declare function storeSessionID(): {
|
|
16
|
-
id: string;
|
|
17
|
-
timestamp: number;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Updates session storage with server-provided session data (after init call)
|
|
21
|
-
* @param serverSession Server session object containing hash and id
|
|
22
|
-
* @returns The updated session object
|
|
23
|
-
*/
|
|
24
|
-
export declare function updateSessionFromServer(serverSession: {
|
|
25
|
-
hash: string;
|
|
26
|
-
id: string;
|
|
27
|
-
}): {
|
|
28
|
-
id: string;
|
|
29
|
-
hash: string;
|
|
30
|
-
timestamp: number;
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* Checks if the current session is valid (exists in sessionStorage)
|
|
34
|
-
* @returns Boolean indicating if the session is valid
|
|
35
|
-
*/
|
|
36
|
-
export declare function isSessionValid(): boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Generates a new session ID using UUID
|
|
39
|
-
* @returns Unique session ID
|
|
40
|
-
*/
|
|
41
|
-
export declare function generateSessionID(): string;
|
|
42
|
-
/**
|
|
43
|
-
* Retrieves the LuciaID data from localStorage
|
|
44
|
-
* @returns LuciaID string or null if not found
|
|
45
|
-
*/
|
|
46
|
-
export declare function getLidData(): string | null;
|
|
47
|
-
/**
|
|
48
|
-
* Gets the current user ID from localStorage
|
|
49
|
-
* @returns User ID or null if not found
|
|
50
|
-
*/
|
|
51
|
-
export declare function getUser(): string | null;
|
|
1
|
+
/**
|
|
2
|
+
* Retrieves session data from sessionStorage
|
|
3
|
+
* @returns Session data object or null if no session exists
|
|
4
|
+
*/
|
|
5
|
+
export declare function getSessionData(): {
|
|
6
|
+
id: string;
|
|
7
|
+
hash?: string;
|
|
8
|
+
timestamp: number;
|
|
9
|
+
} | null;
|
|
10
|
+
/**
|
|
11
|
+
* Stores a new client session ID in sessionStorage (before init call)
|
|
12
|
+
* No hash is generated - hash comes from backend after init
|
|
13
|
+
* @returns The newly created session object
|
|
14
|
+
*/
|
|
15
|
+
export declare function storeSessionID(): {
|
|
16
|
+
id: string;
|
|
17
|
+
timestamp: number;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Updates session storage with server-provided session data (after init call)
|
|
21
|
+
* @param serverSession Server session object containing hash and id
|
|
22
|
+
* @returns The updated session object
|
|
23
|
+
*/
|
|
24
|
+
export declare function updateSessionFromServer(serverSession: {
|
|
25
|
+
hash: string;
|
|
26
|
+
id: string;
|
|
27
|
+
}): {
|
|
28
|
+
id: string;
|
|
29
|
+
hash: string;
|
|
30
|
+
timestamp: number;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Checks if the current session is valid (exists in sessionStorage)
|
|
34
|
+
* @returns Boolean indicating if the session is valid
|
|
35
|
+
*/
|
|
36
|
+
export declare function isSessionValid(): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Generates a new session ID using UUID
|
|
39
|
+
* @returns Unique session ID
|
|
40
|
+
*/
|
|
41
|
+
export declare function generateSessionID(): string;
|
|
42
|
+
/**
|
|
43
|
+
* Retrieves the LuciaID data from localStorage
|
|
44
|
+
* @returns LuciaID string or null if not found
|
|
45
|
+
*/
|
|
46
|
+
export declare function getLidData(): string | null;
|
|
47
|
+
/**
|
|
48
|
+
* Gets the current user ID from localStorage
|
|
49
|
+
* @returns User ID or null if not found
|
|
50
|
+
*/
|
|
51
|
+
export declare function getUser(): string | null;
|