interview-widget 1.0.3 → 1.0.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/README.md +28 -1
- package/dist/utils/constants.d.ts +7 -0
- package/dist/utils/crypto.d.ts +21 -0
- package/dist/widget.es.js +785 -722
- package/dist/widget.umd.js +7 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,7 +17,34 @@ A modern React interview experience widget with built‑in timer flow, STT (spee
|
|
|
17
17
|
|
|
18
18
|
## Quick Start
|
|
19
19
|
|
|
20
|
-
### 1)
|
|
20
|
+
### 1) Environment Setup
|
|
21
|
+
|
|
22
|
+
The Interview Widget uses encryption for session storage integrity. Set up your encryption secret based on your environment:
|
|
23
|
+
|
|
24
|
+
#### Vite React
|
|
25
|
+
|
|
26
|
+
```env
|
|
27
|
+
# .env
|
|
28
|
+
VITE_IW_SECRET=your-secure-encryption-seed-here
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
#### Next.js
|
|
32
|
+
|
|
33
|
+
```env
|
|
34
|
+
# .env.local
|
|
35
|
+
NEXT_PUBLIC_IW_SECRET=your-secure-encryption-seed-here
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
#### Vanilla JS / Custom Framework
|
|
39
|
+
|
|
40
|
+
```html
|
|
41
|
+
<script>
|
|
42
|
+
// Define the secret before loading your widget
|
|
43
|
+
window.__IW_SECRET__ = "your-secure-encryption-seed-here";
|
|
44
|
+
</script>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 2) Install (React apps)
|
|
21
48
|
|
|
22
49
|
```bash
|
|
23
50
|
npm install interview-widget
|
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
import { InterviewWidgetConfig } from '../types';
|
|
2
2
|
export declare const defaultConfig: Required<InterviewWidgetConfig>;
|
|
3
|
+
export declare const STORAGE_KEY = "iw-storage";
|
|
4
|
+
/**
|
|
5
|
+
* Get encryption seed from various sources depending on the environment
|
|
6
|
+
* Works with: Vite React, Next.js, Vanilla JS
|
|
7
|
+
*/
|
|
8
|
+
export declare function getEncryptionSeed(): string;
|
|
9
|
+
export declare const ENCRYPTION_SEED: string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Encrypt data with AES-GCM
|
|
3
|
+
* @param data - The data to encrypt (will be JSON stringified if not a string)
|
|
4
|
+
* @param seed - A seed string to derive the encryption key (e.g., session ID, user ID)
|
|
5
|
+
* @returns Base64 encoded encrypted data (IV + ciphertext + tag)
|
|
6
|
+
*/
|
|
7
|
+
export declare function encrypt(data: unknown, seed?: string): Promise<string>;
|
|
8
|
+
/**
|
|
9
|
+
* Encrypt and serialize data for storage
|
|
10
|
+
* @param data - Data to encrypt
|
|
11
|
+
* @param seed - Seed for key derivation
|
|
12
|
+
* @returns Promise resolving to encrypted base64 string
|
|
13
|
+
*/
|
|
14
|
+
export declare function encryptForStorage(data: unknown, seed?: string): Promise<string>;
|
|
15
|
+
/**
|
|
16
|
+
* Decrypt and parse stored data
|
|
17
|
+
* @param encryptedData - Encrypted base64 string from storage
|
|
18
|
+
* @param seed - Seed for key derivation
|
|
19
|
+
* @returns Promise resolving to decrypted data (parsed as JSON if possible)
|
|
20
|
+
*/
|
|
21
|
+
export declare function decryptFromStorage<T = unknown>(encryptedData: string, seed?: string): Promise<T>;
|