interview-widget 1.0.3 → 1.0.5

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 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) Install (React apps)
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
@@ -2,5 +2,8 @@ interface Props {
2
2
  children: React.ReactNode;
3
3
  onDisqualify?: (() => void) | undefined;
4
4
  }
5
- export declare const InterviewProctoring: ({ children, onDisqualify }: Props) => import("react/jsx-runtime").JSX.Element;
5
+ export interface InterviewProctoringHandle {
6
+ exitFullScreenIntentionally: () => Promise<void>;
7
+ }
8
+ export declare const InterviewProctoring: import('react').ForwardRefExoticComponent<Props & import('react').RefAttributes<InterviewProctoringHandle>>;
6
9
  export {};
@@ -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,9 @@
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
+ export declare function encryptForStorage(data: unknown, seed?: string): Promise<string>;
9
+ export declare function decryptFromStorage<T = unknown>(encryptedData: string, seed?: string): Promise<T>;