@striae-org/striae 3.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.
Files changed (223) hide show
  1. package/.env.example +100 -0
  2. package/LICENSE +190 -0
  3. package/NOTICE +18 -0
  4. package/README.md +133 -0
  5. package/app/components/actions/case-export/core-export.ts +328 -0
  6. package/app/components/actions/case-export/data-processing.ts +167 -0
  7. package/app/components/actions/case-export/download-handlers.ts +900 -0
  8. package/app/components/actions/case-export/index.ts +41 -0
  9. package/app/components/actions/case-export/metadata-helpers.ts +107 -0
  10. package/app/components/actions/case-export/types-constants.ts +56 -0
  11. package/app/components/actions/case-export/validation-utils.ts +25 -0
  12. package/app/components/actions/case-export.ts +4 -0
  13. package/app/components/actions/case-import/annotation-import.ts +35 -0
  14. package/app/components/actions/case-import/confirmation-import.ts +363 -0
  15. package/app/components/actions/case-import/image-operations.ts +61 -0
  16. package/app/components/actions/case-import/index.ts +39 -0
  17. package/app/components/actions/case-import/orchestrator.ts +420 -0
  18. package/app/components/actions/case-import/storage-operations.ts +270 -0
  19. package/app/components/actions/case-import/validation.ts +189 -0
  20. package/app/components/actions/case-import/zip-processing.ts +413 -0
  21. package/app/components/actions/case-manage.ts +524 -0
  22. package/app/components/actions/case-review.ts +4 -0
  23. package/app/components/actions/confirm-export.ts +351 -0
  24. package/app/components/actions/generate-pdf.ts +210 -0
  25. package/app/components/actions/image-manage.ts +385 -0
  26. package/app/components/actions/notes-manage.ts +33 -0
  27. package/app/components/actions/signout.module.css +15 -0
  28. package/app/components/actions/signout.tsx +50 -0
  29. package/app/components/audit/user-audit-viewer.tsx +975 -0
  30. package/app/components/audit/user-audit.module.css +568 -0
  31. package/app/components/auth/auth-provider.tsx +78 -0
  32. package/app/components/auth/mfa-enrollment.module.css +268 -0
  33. package/app/components/auth/mfa-enrollment.tsx +398 -0
  34. package/app/components/auth/mfa-verification.module.css +251 -0
  35. package/app/components/auth/mfa-verification.tsx +295 -0
  36. package/app/components/button/button.module.css +63 -0
  37. package/app/components/button/button.tsx +46 -0
  38. package/app/components/canvas/box-annotations/box-annotations.module.css +170 -0
  39. package/app/components/canvas/box-annotations/box-annotations.tsx +634 -0
  40. package/app/components/canvas/canvas.module.css +314 -0
  41. package/app/components/canvas/canvas.tsx +449 -0
  42. package/app/components/canvas/confirmation/confirmation.module.css +187 -0
  43. package/app/components/canvas/confirmation/confirmation.tsx +214 -0
  44. package/app/components/colors/colors.module.css +59 -0
  45. package/app/components/colors/colors.tsx +68 -0
  46. package/app/components/form/base-form.tsx +21 -0
  47. package/app/components/form/form-button.tsx +28 -0
  48. package/app/components/form/form-field.tsx +53 -0
  49. package/app/components/form/form-message.tsx +17 -0
  50. package/app/components/form/form-toggle.tsx +23 -0
  51. package/app/components/form/form.module.css +427 -0
  52. package/app/components/form/index.ts +6 -0
  53. package/app/components/icon/icon.module.css +3 -0
  54. package/app/components/icon/icon.tsx +27 -0
  55. package/app/components/icon/icons.svg +102 -0
  56. package/app/components/icon/manifest.json +110 -0
  57. package/app/components/sidebar/case-export/case-export.module.css +386 -0
  58. package/app/components/sidebar/case-export/case-export.tsx +317 -0
  59. package/app/components/sidebar/case-import/case-import.module.css +626 -0
  60. package/app/components/sidebar/case-import/case-import.tsx +404 -0
  61. package/app/components/sidebar/case-import/components/CasePreviewSection.tsx +72 -0
  62. package/app/components/sidebar/case-import/components/ConfirmationDialog.tsx +72 -0
  63. package/app/components/sidebar/case-import/components/ConfirmationPreviewSection.tsx +71 -0
  64. package/app/components/sidebar/case-import/components/ExistingCaseSection.tsx +40 -0
  65. package/app/components/sidebar/case-import/components/FileSelector.tsx +161 -0
  66. package/app/components/sidebar/case-import/components/ProgressSection.tsx +46 -0
  67. package/app/components/sidebar/case-import/hooks/useFilePreview.ts +101 -0
  68. package/app/components/sidebar/case-import/hooks/useImportExecution.ts +152 -0
  69. package/app/components/sidebar/case-import/hooks/useImportState.ts +88 -0
  70. package/app/components/sidebar/case-import/index.ts +18 -0
  71. package/app/components/sidebar/case-import/utils/file-validation.ts +43 -0
  72. package/app/components/sidebar/cases/case-sidebar.tsx +827 -0
  73. package/app/components/sidebar/cases/cases-modal.module.css +166 -0
  74. package/app/components/sidebar/cases/cases-modal.tsx +201 -0
  75. package/app/components/sidebar/cases/cases.module.css +713 -0
  76. package/app/components/sidebar/files/files-modal.module.css +209 -0
  77. package/app/components/sidebar/files/files-modal.tsx +239 -0
  78. package/app/components/sidebar/hash/hash-utility.module.css +366 -0
  79. package/app/components/sidebar/hash/hash-utility.tsx +982 -0
  80. package/app/components/sidebar/notes/notes-modal.tsx +51 -0
  81. package/app/components/sidebar/notes/notes-sidebar.tsx +491 -0
  82. package/app/components/sidebar/notes/notes.module.css +360 -0
  83. package/app/components/sidebar/sidebar-container.tsx +149 -0
  84. package/app/components/sidebar/sidebar.module.css +321 -0
  85. package/app/components/sidebar/sidebar.tsx +215 -0
  86. package/app/components/sidebar/upload/image-upload-zone.module.css +123 -0
  87. package/app/components/sidebar/upload/image-upload-zone.tsx +330 -0
  88. package/app/components/theme-provider/theme-provider.tsx +131 -0
  89. package/app/components/theme-provider/theme.ts +155 -0
  90. package/app/components/toast/toast.module.css +137 -0
  91. package/app/components/toast/toast.tsx +56 -0
  92. package/app/components/toolbar/toolbar-color-selector.module.css +171 -0
  93. package/app/components/toolbar/toolbar-color-selector.tsx +129 -0
  94. package/app/components/toolbar/toolbar.module.css +42 -0
  95. package/app/components/toolbar/toolbar.tsx +167 -0
  96. package/app/components/user/delete-account.module.css +274 -0
  97. package/app/components/user/delete-account.tsx +471 -0
  98. package/app/components/user/inactivity-warning.module.css +145 -0
  99. package/app/components/user/inactivity-warning.tsx +84 -0
  100. package/app/components/user/manage-profile.module.css +190 -0
  101. package/app/components/user/manage-profile.tsx +253 -0
  102. package/app/components/user/mfa-phone-update.tsx +739 -0
  103. package/app/config-example/admin-service.json +13 -0
  104. package/app/config-example/config.json +17 -0
  105. package/app/config-example/firebase.ts +21 -0
  106. package/app/config-example/inactivity.ts +13 -0
  107. package/app/config-example/meta-config.json +6 -0
  108. package/app/contexts/auth.context.ts +12 -0
  109. package/app/entry.client.tsx +12 -0
  110. package/app/entry.server.tsx +44 -0
  111. package/app/hooks/useInactivityTimeout.ts +110 -0
  112. package/app/root.tsx +170 -0
  113. package/app/routes/_index.tsx +16 -0
  114. package/app/routes/auth/emailActionHandler.module.css +232 -0
  115. package/app/routes/auth/emailActionHandler.tsx +405 -0
  116. package/app/routes/auth/emailVerification.tsx +120 -0
  117. package/app/routes/auth/login.module.css +523 -0
  118. package/app/routes/auth/login.tsx +654 -0
  119. package/app/routes/auth/passwordReset.module.css +274 -0
  120. package/app/routes/auth/passwordReset.tsx +154 -0
  121. package/app/routes/auth/route.ts +16 -0
  122. package/app/routes/mobile-prevented/mobilePrevented.module.css +47 -0
  123. package/app/routes/mobile-prevented/mobilePrevented.tsx +26 -0
  124. package/app/routes/mobile-prevented/route.ts +14 -0
  125. package/app/routes/striae/striae.module.css +30 -0
  126. package/app/routes/striae/striae.tsx +417 -0
  127. package/app/services/audit-export.service.ts +755 -0
  128. package/app/services/audit.service.ts +1454 -0
  129. package/app/services/firebase-errors.ts +106 -0
  130. package/app/services/firebase.ts +15 -0
  131. package/app/styles/legal-pages.module.css +113 -0
  132. package/app/styles/root.module.css +146 -0
  133. package/app/tailwind.css +225 -0
  134. package/app/types/annotations.ts +45 -0
  135. package/app/types/audit.ts +301 -0
  136. package/app/types/case.ts +90 -0
  137. package/app/types/export.ts +8 -0
  138. package/app/types/file.ts +30 -0
  139. package/app/types/import.ts +107 -0
  140. package/app/types/index.ts +24 -0
  141. package/app/types/user.ts +38 -0
  142. package/app/utils/SHA256.ts +461 -0
  143. package/app/utils/annotation-timestamp.ts +25 -0
  144. package/app/utils/audit-export-signature.ts +117 -0
  145. package/app/utils/auth-action-settings.ts +48 -0
  146. package/app/utils/auth.ts +34 -0
  147. package/app/utils/batch-operations.ts +135 -0
  148. package/app/utils/confirmation-signature.ts +193 -0
  149. package/app/utils/data-operations.ts +871 -0
  150. package/app/utils/device-detection.ts +5 -0
  151. package/app/utils/html-sanitizer.ts +80 -0
  152. package/app/utils/id-generator.ts +36 -0
  153. package/app/utils/meta.ts +48 -0
  154. package/app/utils/mfa-phone.ts +97 -0
  155. package/app/utils/mfa.ts +79 -0
  156. package/app/utils/password-policy.ts +28 -0
  157. package/app/utils/permissions.ts +562 -0
  158. package/app/utils/signature-utils.ts +160 -0
  159. package/app/utils/style.ts +83 -0
  160. package/app/utils/version.ts +5 -0
  161. package/firebase.json +11 -0
  162. package/functions/[[path]].ts +10 -0
  163. package/package.json +138 -0
  164. package/postcss.config.js +6 -0
  165. package/public/.well-known/publickey.info@striae.org.asc +17 -0
  166. package/public/.well-known/security.txt +7 -0
  167. package/public/_headers +28 -0
  168. package/public/_routes.json +13 -0
  169. package/public/assets/striae.jpg +0 -0
  170. package/public/clear.jpg +0 -0
  171. package/public/favicon.ico +0 -0
  172. package/public/favicon.svg +9 -0
  173. package/public/icon-256.png +0 -0
  174. package/public/icon-512.png +0 -0
  175. package/public/logo-dark.png +0 -0
  176. package/public/manifest.json +25 -0
  177. package/public/oin-badge.png +0 -0
  178. package/public/shortcut.png +0 -0
  179. package/public/social-image.png +0 -0
  180. package/public/striae-ascii.txt +10 -0
  181. package/scripts/deploy-all.sh +100 -0
  182. package/scripts/deploy-config.sh +940 -0
  183. package/scripts/deploy-pages.sh +34 -0
  184. package/scripts/deploy-worker-secrets.sh +215 -0
  185. package/scripts/dev.cjs +23 -0
  186. package/scripts/install-workers.sh +88 -0
  187. package/scripts/run-eslint.cjs +35 -0
  188. package/scripts/update-compatibility-dates.cjs +124 -0
  189. package/scripts/update-markdown-versions.cjs +43 -0
  190. package/tailwind.config.ts +22 -0
  191. package/tsconfig.json +33 -0
  192. package/vite.config.ts +35 -0
  193. package/worker-configuration.d.ts +7490 -0
  194. package/workers/audit-worker/package.json +17 -0
  195. package/workers/audit-worker/src/audit-worker.example.ts +195 -0
  196. package/workers/audit-worker/worker-configuration.d.ts +7448 -0
  197. package/workers/audit-worker/wrangler.jsonc.example +29 -0
  198. package/workers/data-worker/package.json +17 -0
  199. package/workers/data-worker/src/data-worker.example.ts +267 -0
  200. package/workers/data-worker/src/signature-utils.ts +79 -0
  201. package/workers/data-worker/src/signing-payload-utils.ts +290 -0
  202. package/workers/data-worker/worker-configuration.d.ts +7448 -0
  203. package/workers/data-worker/wrangler.jsonc.example +30 -0
  204. package/workers/image-worker/package.json +17 -0
  205. package/workers/image-worker/src/image-worker.example.ts +180 -0
  206. package/workers/image-worker/worker-configuration.d.ts +7447 -0
  207. package/workers/image-worker/wrangler.jsonc.example +22 -0
  208. package/workers/keys-worker/package.json +17 -0
  209. package/workers/keys-worker/src/keys.example.ts +66 -0
  210. package/workers/keys-worker/src/keys.ts +66 -0
  211. package/workers/keys-worker/worker-configuration.d.ts +7447 -0
  212. package/workers/keys-worker/wrangler.jsonc.example +22 -0
  213. package/workers/pdf-worker/package.json +17 -0
  214. package/workers/pdf-worker/src/format-striae.ts +534 -0
  215. package/workers/pdf-worker/src/pdf-worker.example.ts +119 -0
  216. package/workers/pdf-worker/src/report-types.ts +69 -0
  217. package/workers/pdf-worker/worker-configuration.d.ts +7448 -0
  218. package/workers/pdf-worker/wrangler.jsonc.example +26 -0
  219. package/workers/user-worker/package.json +17 -0
  220. package/workers/user-worker/src/user-worker.example.ts +636 -0
  221. package/workers/user-worker/worker-configuration.d.ts +7448 -0
  222. package/workers/user-worker/wrangler.jsonc.example +29 -0
  223. package/wrangler.toml.example +8 -0
@@ -0,0 +1,301 @@
1
+ // Audit trail types for comprehensive forensic accountability framework
2
+ // Tracks all user actions and system events throughout the application
3
+
4
+ export type AuditAction =
5
+ // Case Management Actions
6
+ | 'case-create' | 'case-rename' | 'case-delete'
7
+ // Confirmation Workflow Actions
8
+ | 'case-export' | 'case-import' | 'confirmation-create' | 'confirmation-export' | 'confirmation-import'
9
+ // File Operations
10
+ | 'file-upload' | 'file-delete' | 'file-access'
11
+ // Annotation Operations
12
+ | 'annotation-create' | 'annotation-edit' | 'annotation-delete'
13
+ // User & Session Management
14
+ | 'user-login' | 'user-logout' | 'user-profile-update' | 'user-password-reset' | 'user-account-delete'
15
+ // NEW: User Registration & Authentication
16
+ | 'user-registration' | 'email-verification' | 'mfa-enrollment' | 'mfa-authentication'
17
+ // Document Generation
18
+ | 'pdf-generate'
19
+ // Security & Monitoring
20
+ | 'security-violation'
21
+ // Legacy actions (for backward compatibility)
22
+ | 'import' | 'export' | 'confirm' | 'validate';
23
+
24
+ export type AuditResult = 'success' | 'failure' | 'warning' | 'blocked' | 'pending';
25
+
26
+ export type AuditFileType =
27
+ | 'case-package' | 'confirmation-data' | 'image-file' | 'pdf-document'
28
+ | 'json-data' | 'csv-export' | 'log-file' | 'unknown';
29
+
30
+ /**
31
+ * Core audit entry structure for all validation events
32
+ * Based on the specification in confirmations-guide.md
33
+ */
34
+ export interface ValidationAuditEntry {
35
+ timestamp: string;
36
+ userId: string;
37
+ userEmail: string;
38
+ action: AuditAction;
39
+ result: AuditResult;
40
+ details: AuditDetails;
41
+ }
42
+
43
+ /**
44
+ * Detailed information for each audit entry
45
+ * Contains action-specific data and metadata
46
+ */
47
+ export interface AuditDetails {
48
+ // Core identification
49
+ fileName?: string;
50
+ fileType?: AuditFileType;
51
+ caseNumber?: string;
52
+ confirmationId?: string;
53
+
54
+ // Validation & Security
55
+ hashValid?: boolean;
56
+ validationErrors: string[];
57
+ securityChecks?: SecurityCheckResults;
58
+
59
+ // Context & Workflow
60
+ originalExaminerUid?: string;
61
+ reviewingExaminerUid?: string;
62
+ workflowPhase?: WorkflowPhase;
63
+
64
+ // Performance & Metrics
65
+ performanceMetrics?: PerformanceMetrics;
66
+
67
+ // Case Management Details
68
+ caseDetails?: CaseAuditDetails;
69
+
70
+ // File Operation Details
71
+ fileDetails?: FileAuditDetails;
72
+
73
+ // Annotation Details
74
+ annotationDetails?: AnnotationAuditDetails;
75
+
76
+ // User Session Details
77
+ sessionDetails?: SessionAuditDetails;
78
+
79
+ // Security Incident Details
80
+ securityDetails?: SecurityAuditDetails;
81
+
82
+ // User Profile & Authentication Details
83
+ userProfileDetails?: UserProfileAuditDetails;
84
+ }
85
+
86
+ /**
87
+ * Workflow phases for tracking different types of forensic activities
88
+ */
89
+ export type WorkflowPhase =
90
+ | 'casework' // All case, notes, image, and pdf related actions
91
+ | 'case-export' // Only case exporting
92
+ | 'case-import' // Only case importing
93
+ | 'confirmation' // Only confirmation-related activity
94
+ | 'user-management'; // User login, logout, profile management, account activities
95
+
96
+ /**
97
+ * Security validation results
98
+ */
99
+ export interface SecurityCheckResults {
100
+ selfConfirmationPrevented: boolean;
101
+ fileIntegrityValid: boolean;
102
+ exporterUidValidated?: boolean;
103
+ manifestSignaturePresent?: boolean;
104
+ manifestSignatureValid?: boolean;
105
+ manifestSignatureKeyId?: string;
106
+ }
107
+
108
+ /**
109
+ * Performance and operational metrics
110
+ */
111
+ export interface PerformanceMetrics {
112
+ processingTimeMs: number;
113
+ fileSizeBytes: number;
114
+ validationStepsCompleted?: number;
115
+ validationStepsFailed?: number;
116
+ }
117
+
118
+ /**
119
+ * Complete audit trail for a case or workflow
120
+ */
121
+ export interface AuditTrail {
122
+ caseNumber: string;
123
+ workflowId: string; // Unique identifier linking related audit entries
124
+ entries: ValidationAuditEntry[];
125
+ summary: AuditSummary;
126
+ }
127
+
128
+ /**
129
+ * Summary of audit trail for reporting and compliance
130
+ */
131
+ export interface AuditSummary {
132
+ totalEvents: number;
133
+ successfulEvents: number;
134
+ failedEvents: number;
135
+ warningEvents: number;
136
+ workflowPhases: WorkflowPhase[];
137
+ participatingUsers: string[]; // User IDs
138
+ startTimestamp: string;
139
+ endTimestamp: string;
140
+ complianceStatus: 'compliant' | 'non-compliant' | 'pending';
141
+ securityIncidents: number;
142
+ }
143
+
144
+ /**
145
+ * Audit entry creation parameters
146
+ */
147
+ export interface CreateAuditEntryParams {
148
+ userId: string;
149
+ userEmail: string;
150
+ action: AuditAction;
151
+ result: AuditResult;
152
+ fileName?: string;
153
+ fileType?: AuditFileType;
154
+ hashValid?: boolean;
155
+ validationErrors?: string[];
156
+ caseNumber?: string;
157
+ confirmationId?: string;
158
+ workflowPhase?: WorkflowPhase;
159
+ securityChecks?: SecurityCheckResults;
160
+ performanceMetrics?: PerformanceMetrics;
161
+ originalExaminerUid?: string;
162
+ reviewingExaminerUid?: string;
163
+ // Extended detail fields
164
+ caseDetails?: CaseAuditDetails;
165
+ fileDetails?: FileAuditDetails;
166
+ annotationDetails?: AnnotationAuditDetails;
167
+ sessionDetails?: SessionAuditDetails;
168
+ securityDetails?: SecurityAuditDetails;
169
+ userProfileDetails?: UserProfileAuditDetails;
170
+ }
171
+
172
+ /**
173
+ * Query parameters for retrieving audit entries
174
+ */
175
+ export interface AuditQueryParams {
176
+ caseNumber?: string;
177
+ workflowId?: string;
178
+ userId?: string;
179
+ action?: AuditAction;
180
+ result?: AuditResult;
181
+ workflowPhase?: WorkflowPhase;
182
+ startDate?: string;
183
+ endDate?: string;
184
+ limit?: number;
185
+ offset?: number;
186
+ }
187
+
188
+ // =============================================================================
189
+ // SPECIALIZED AUDIT DETAIL INTERFACES
190
+ // =============================================================================
191
+
192
+ /**
193
+ * Case management specific audit details
194
+ */
195
+ export interface CaseAuditDetails {
196
+ oldCaseName?: string;
197
+ newCaseName?: string;
198
+ totalFiles?: number;
199
+ totalAnnotations?: number;
200
+ createdDate?: string;
201
+ lastModified?: string;
202
+ deleteReason?: string;
203
+ backupCreated?: boolean;
204
+ }
205
+
206
+ /**
207
+ * File operation specific audit details
208
+ */
209
+ export interface FileAuditDetails {
210
+ fileId?: string;
211
+ originalFileName?: string;
212
+ fileSize: number;
213
+ mimeType?: string;
214
+ uploadMethod?: 'drag-drop' | 'file-picker' | 'api' | 'import';
215
+ processingTime?: number;
216
+ thumbnailGenerated?: boolean;
217
+ deleteReason?: string;
218
+ sourceLocation?: string;
219
+ }
220
+
221
+ /**
222
+ * Annotation operation specific audit details
223
+ */
224
+ export interface AnnotationAuditDetails {
225
+ annotationId?: string;
226
+ annotationType?: 'measurement' | 'identification' | 'comparison' | 'note' | 'region';
227
+ annotationData?: any; // The actual annotation data structure
228
+ canvasPosition?: { x: number; y: number };
229
+ annotationSize?: { width: number; height: number };
230
+ previousValue?: any; // For edit operations
231
+ tool?: string; // Which tool was used to create/edit
232
+ }
233
+
234
+ /**
235
+ * User session specific audit details
236
+ */
237
+ export interface SessionAuditDetails {
238
+ sessionId?: string;
239
+ userAgent?: string;
240
+ sessionDuration?: number;
241
+ loginMethod?: 'firebase' | 'sso' | 'api-key' | 'manual';
242
+ logoutReason?: 'user-initiated' | 'timeout' | 'security' | 'error';
243
+ }
244
+
245
+ /**
246
+ * Security incident specific audit details
247
+ */
248
+ export interface SecurityAuditDetails {
249
+ incidentType?: 'unauthorized-access' | 'data-breach' | 'malware' | 'injection' | 'brute-force' | 'privilege-escalation';
250
+ severity?: 'low' | 'medium' | 'high' | 'critical';
251
+ targetResource?: string;
252
+ blockedBySystem?: boolean;
253
+ investigationId?: string;
254
+ reportedToAuthorities?: boolean;
255
+ mitigationSteps?: string[];
256
+ // MFA specific fields
257
+ mfaMethod?: 'sms' | 'totp' | 'hardware-key';
258
+ phoneNumber?: string; // Masked phone number for privacy
259
+ enrollmentAttempts?: number;
260
+ enrollmentDate?: string;
261
+ mandatoryEnrollment?: boolean;
262
+ backupCodesGenerated?: boolean;
263
+ verificationAttempts?: number;
264
+ authenticationDate?: string;
265
+ loginFlowStep?: 'first-factor' | 'second-factor';
266
+ }
267
+
268
+ /**
269
+ * User profile and authentication specific audit details
270
+ */
271
+ export interface UserProfileAuditDetails {
272
+ profileField?: 'displayName' | 'email' | 'organization' | 'role' | 'preferences' | 'avatar';
273
+ oldValue?: string;
274
+ newValue?: string;
275
+ resetMethod?: 'email' | 'sms' | 'security-questions' | 'admin-reset';
276
+ resetToken?: string; // Partial token for tracking (last 4 chars)
277
+ verificationMethod?: 'email-link' | 'sms-code' | 'totp' | 'backup-codes' | 'admin-verification';
278
+ verificationAttempts?: number;
279
+ passwordComplexityMet?: boolean;
280
+ previousPasswordReused?: boolean;
281
+ // Account deletion specific fields
282
+ deletionReason?: 'user-requested' | 'admin-initiated' | 'policy-violation' | 'inactive-account';
283
+ dataRetentionPeriod?: number; // Days before permanent deletion
284
+ confirmationMethod?: 'uid-email' | 'password' | 'admin-override';
285
+ casesCount?: number; // Number of cases deleted with account
286
+ filesCount?: number; // Number of files deleted with account
287
+ // NEW: User registration specific fields
288
+ registrationMethod?: 'email-password' | 'sso' | 'admin-created' | 'api';
289
+ firstName?: string;
290
+ lastName?: string;
291
+ company?: string;
292
+ emailVerificationRequired?: boolean;
293
+ mfaEnrollmentRequired?: boolean;
294
+ // NEW: Email verification specific fields
295
+ verificationDate?: string;
296
+ emailVerified?: boolean;
297
+ emailNotificationSent?: boolean;
298
+ // NEW: Retroactive verification fields
299
+ retroactiveVerification?: boolean;
300
+ retroactiveReason?: string;
301
+ }
@@ -0,0 +1,90 @@
1
+ import { FileData } from './file';
2
+ import { AnnotationData, ConfirmationData } from './annotations';
3
+
4
+ // Case-related types and interfaces
5
+
6
+ export type CaseActionType = 'loaded' | 'created' | 'deleted' | null;
7
+
8
+ export interface CaseData {
9
+ createdAt: string;
10
+ caseNumber: string;
11
+ files: FileData[];
12
+ }
13
+
14
+ export interface ReadOnlyCaseData extends CaseData {
15
+ isReadOnly?: boolean;
16
+ }
17
+
18
+ export interface CasesToDelete {
19
+ casesToDelete: string[];
20
+ }
21
+
22
+ export interface CaseExportData {
23
+ metadata: {
24
+ caseNumber: string;
25
+ caseCreatedDate: string;
26
+ exportDate: string;
27
+ exportedBy: string | null;
28
+ exportedByUid: string;
29
+ exportedByName: string;
30
+ exportedByCompany: string;
31
+ striaeExportSchemaVersion: string;
32
+ totalFiles: number;
33
+ };
34
+ files: Array<{
35
+ fileData: FileData;
36
+ annotations?: AnnotationData;
37
+ hasAnnotations: boolean;
38
+ }>;
39
+ summary?: {
40
+ filesWithAnnotations: number;
41
+ filesWithoutAnnotations: number;
42
+ totalBoxAnnotations: number;
43
+ filesWithConfirmations?: number;
44
+ filesWithConfirmationsRequested?: number;
45
+ lastModified?: string;
46
+ earliestAnnotationDate?: string;
47
+ latestAnnotationDate?: string;
48
+ exportError?: string;
49
+ };
50
+ }
51
+
52
+ export interface AllCasesExportData {
53
+ metadata: {
54
+ exportDate: string;
55
+ exportedBy: string | null;
56
+ exportedByUid: string;
57
+ exportedByName: string;
58
+ exportedByCompany: string;
59
+ striaeExportSchemaVersion: string;
60
+ totalCases: number;
61
+ totalFiles: number;
62
+ totalAnnotations: number;
63
+ totalConfirmations: number;
64
+ totalConfirmationsRequested: number;
65
+ };
66
+ cases: CaseExportData[];
67
+ summary?: {
68
+ casesWithFiles: number;
69
+ casesWithAnnotations: number;
70
+ casesWithoutFiles: number;
71
+ lastModified?: string;
72
+ earliestAnnotationDate?: string;
73
+ latestAnnotationDate?: string;
74
+ };
75
+ }
76
+
77
+ // Confirmation-related case types
78
+ export interface CaseConfirmations {
79
+ [originalImageId: string]: ConfirmationData[];
80
+ }
81
+
82
+ export interface CaseDataWithConfirmations {
83
+ createdAt: string;
84
+ caseNumber: string;
85
+ files: any[];
86
+ isReadOnly?: boolean;
87
+ importedAt?: string;
88
+ originalImageIds?: { [originalId: string]: string };
89
+ confirmations?: CaseConfirmations;
90
+ }
@@ -0,0 +1,8 @@
1
+ // Export-related types and interfaces
2
+
3
+ export interface ExportOptions {
4
+ format?: 'json' | 'csv';
5
+ includeMetadata?: boolean;
6
+ includeUserInfo?: boolean;
7
+ protectForensicData?: boolean; // Enable read-only protection
8
+ }
@@ -0,0 +1,30 @@
1
+ // File-related types and interfaces
2
+
3
+ export interface FileData {
4
+ id: string;
5
+ originalFilename: string;
6
+ uploadedAt: string;
7
+ }
8
+
9
+ export interface FileUploadResponse {
10
+ success: boolean;
11
+ result: {
12
+ id: string;
13
+ filename: string;
14
+ uploaded: string;
15
+ requireSignedURLs: boolean;
16
+ variants: string[];
17
+ };
18
+ errors: Array<{
19
+ code: number;
20
+ message: string;
21
+ }>;
22
+ messages: string[];
23
+ }
24
+
25
+ export interface ImageUploadResponse {
26
+ success: boolean;
27
+ result: FileUploadResponse['result'];
28
+ errors: FileUploadResponse['errors'];
29
+ messages: FileUploadResponse['messages'];
30
+ }
@@ -0,0 +1,107 @@
1
+ // Import-related types and interfaces
2
+
3
+ export interface ImportOptions {
4
+ overwriteExisting?: boolean;
5
+ validateIntegrity?: boolean;
6
+ preserveTimestamps?: boolean;
7
+ }
8
+
9
+ export interface ImportResult {
10
+ success: boolean;
11
+ caseNumber: string;
12
+ isReadOnly: boolean;
13
+ filesImported: number;
14
+ annotationsImported: number;
15
+ errors?: string[];
16
+ warnings?: string[];
17
+ }
18
+
19
+ export interface ReadOnlyCaseMetadata {
20
+ caseNumber: string;
21
+ importedAt: string;
22
+ originalExportDate: string;
23
+ originalExportedBy: string;
24
+ sourceHash?: string;
25
+ sourceManifestVersion?: string;
26
+ sourceSignatureKeyId?: string;
27
+ sourceSignatureValid?: boolean;
28
+ isReadOnly: true;
29
+ }
30
+
31
+ export interface ConfirmationImportResult {
32
+ success: boolean;
33
+ caseNumber: string;
34
+ confirmationsImported: number;
35
+ imagesUpdated: number;
36
+ errors?: string[];
37
+ warnings?: string[];
38
+ }
39
+
40
+ export interface R2ObjectMetadata {
41
+ lastModified: string;
42
+ size: number;
43
+ etag: string;
44
+ }
45
+
46
+ export interface ConfirmationImportData {
47
+ metadata: {
48
+ caseNumber: string;
49
+ exportDate: string;
50
+ exportedBy: string;
51
+ exportedByUid: string;
52
+ exportedByName: string;
53
+ exportedByCompany: string;
54
+ totalConfirmations: number;
55
+ version: string;
56
+ hash: string;
57
+ signatureVersion?: string;
58
+ signature?: {
59
+ algorithm: string;
60
+ keyId: string;
61
+ signedAt: string;
62
+ value: string;
63
+ };
64
+ originalExportCreatedAt?: string;
65
+ };
66
+ confirmations: {
67
+ [originalImageId: string]: Array<{
68
+ fullName: string;
69
+ badgeId: string;
70
+ timestamp: string;
71
+ confirmationId: string;
72
+ confirmedBy: string;
73
+ confirmedByEmail: string;
74
+ confirmedByCompany: string;
75
+ confirmedAt: string;
76
+ }>;
77
+ };
78
+ }
79
+
80
+ export interface CaseImportPreview {
81
+ caseNumber: string;
82
+ exportedBy: string | null;
83
+ exportedByName: string | null;
84
+ exportedByCompany: string | null;
85
+ exportDate: string;
86
+ totalFiles: number;
87
+ caseCreatedDate?: string;
88
+ hashValid?: boolean;
89
+ hashError?: string;
90
+ expectedHash?: string;
91
+ actualHash?: string;
92
+ hasAnnotations: boolean;
93
+ validationSummary: string;
94
+ errors?: string[];
95
+ // Enhanced validation details
96
+ validationDetails?: {
97
+ hasForensicManifest: boolean;
98
+ dataValid?: boolean;
99
+ imageValidation?: { [filename: string]: boolean };
100
+ manifestValid?: boolean;
101
+ signatureValid?: boolean;
102
+ signatureKeyId?: string;
103
+ signatureError?: string;
104
+ validationSummary?: string;
105
+ integrityErrors?: string[];
106
+ };
107
+ }
@@ -0,0 +1,24 @@
1
+ // Barrel export for all application types
2
+ // This allows importing multiple types from a single location
3
+ // Example: import { UserData, FileData, AnnotationData } from '~/types';
4
+
5
+ // Annotation types
6
+ export * from './annotations';
7
+
8
+ // User types
9
+ export * from './user';
10
+
11
+ // File types
12
+ export * from './file';
13
+
14
+ // Case types
15
+ export * from './case';
16
+
17
+ // Import types
18
+ export * from './import';
19
+
20
+ // Export types
21
+ export * from './export';
22
+
23
+ // Audit types
24
+ export * from './audit';
@@ -0,0 +1,38 @@
1
+ // User-related types and interfaces
2
+
3
+ import { ReadOnlyCaseMetadata } from './import';
4
+
5
+ export interface UserData {
6
+ uid: string;
7
+ email: string | null;
8
+ firstName: string;
9
+ lastName: string;
10
+ company: string;
11
+ permitted: boolean;
12
+ cases: Array<{
13
+ caseNumber: string;
14
+ createdAt: string;
15
+ }>;
16
+ readOnlyCases?: Array<{
17
+ caseNumber: string;
18
+ importedAt: string;
19
+ originalExportDate: string;
20
+ originalExportedBy: string;
21
+ sourceHash?: string;
22
+ sourceManifestVersion?: string;
23
+ sourceSignatureKeyId?: string;
24
+ sourceSignatureValid?: boolean;
25
+ isReadOnly: true;
26
+ }>;
27
+ createdAt: string;
28
+ updatedAt?: string;
29
+ }
30
+
31
+ export interface ExtendedUserData extends UserData {
32
+ readOnlyCases?: ReadOnlyCaseMetadata[];
33
+ }
34
+
35
+ export interface UserLimits {
36
+ maxCases: number;
37
+ maxFilesPerCase: number;
38
+ }