@devlider001/washlab-backend 1.0.8 → 1.1.0

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.
@@ -57,16 +57,37 @@ export declare function getCurrentCustomer(ctx: QueryCtx | MutationCtx): Promise
57
57
  export declare function getCurrentAttendant(ctx: QueryCtx | MutationCtx): Promise<{
58
58
  _id: import("convex/values").GenericId<"attendants">;
59
59
  _creationTime: number;
60
+ clerkUserId?: string | undefined;
60
61
  lastLoginAt?: number | undefined;
61
- passcode?: string | undefined;
62
+ passcodeHash?: string | undefined;
63
+ authenticationMethods?: ("biometric_face" | "biometric_hand" | "pin" | "password")[] | undefined;
64
+ enrollmentTokenHash?: string | undefined;
65
+ enrollmentTokenExpiresAt?: number | undefined;
66
+ enrolledAt?: number | undefined;
67
+ enrolledBy?: import("convex/values").GenericId<"admins"> | undefined;
68
+ biometricTemplateHash?: string | undefined;
69
+ biometricDataEncrypted?: string | undefined;
70
+ biometricCaptureMetadata?: {
71
+ deviceInfo?: string | undefined;
72
+ captureType: "face" | "hand";
73
+ anglesCaptured: string[];
74
+ captureQuality: number;
75
+ livenessPassed: boolean;
76
+ captureTimestamp: number;
77
+ } | undefined;
78
+ lastVerificationAt?: number | undefined;
79
+ lastVerificationSuccess?: boolean | undefined;
80
+ verificationTimeoutAt?: number | undefined;
62
81
  phoneNumber: string;
63
82
  email: string;
64
83
  name: string;
65
- clerkUserId: string;
66
84
  createdAt: number;
67
85
  isDeleted: boolean;
68
86
  branchId: import("convex/values").GenericId<"branches">;
69
87
  isActive: boolean;
88
+ enrollmentStatus: "active" | "suspended" | "invited" | "enrolling" | "locked";
89
+ consecutiveFailures: number;
90
+ createdBy: import("convex/values").GenericId<"admins">;
70
91
  }>;
71
92
  /**
72
93
  * Get current admin from Clerk identity
@@ -105,15 +126,36 @@ export declare function getSuperAdmin(ctx: QueryCtx | MutationCtx): Promise<{
105
126
  export declare function verifyAttendantBranch(ctx: QueryCtx | MutationCtx, attendantId: Id<"attendants">, branchId: Id<"branches">): Promise<{
106
127
  _id: import("convex/values").GenericId<"attendants">;
107
128
  _creationTime: number;
129
+ clerkUserId?: string | undefined;
108
130
  lastLoginAt?: number | undefined;
109
- passcode?: string | undefined;
131
+ passcodeHash?: string | undefined;
132
+ authenticationMethods?: ("biometric_face" | "biometric_hand" | "pin" | "password")[] | undefined;
133
+ enrollmentTokenHash?: string | undefined;
134
+ enrollmentTokenExpiresAt?: number | undefined;
135
+ enrolledAt?: number | undefined;
136
+ enrolledBy?: import("convex/values").GenericId<"admins"> | undefined;
137
+ biometricTemplateHash?: string | undefined;
138
+ biometricDataEncrypted?: string | undefined;
139
+ biometricCaptureMetadata?: {
140
+ deviceInfo?: string | undefined;
141
+ captureType: "face" | "hand";
142
+ anglesCaptured: string[];
143
+ captureQuality: number;
144
+ livenessPassed: boolean;
145
+ captureTimestamp: number;
146
+ } | undefined;
147
+ lastVerificationAt?: number | undefined;
148
+ lastVerificationSuccess?: boolean | undefined;
149
+ verificationTimeoutAt?: number | undefined;
110
150
  phoneNumber: string;
111
151
  email: string;
112
152
  name: string;
113
- clerkUserId: string;
114
153
  createdAt: number;
115
154
  isDeleted: boolean;
116
155
  branchId: import("convex/values").GenericId<"branches">;
117
156
  isActive: boolean;
157
+ enrollmentStatus: "active" | "suspended" | "invited" | "enrolling" | "locked";
158
+ consecutiveFailures: number;
159
+ createdBy: import("convex/values").GenericId<"admins">;
118
160
  }>;
119
161
  //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Biometric Comparison Utilities
3
+ *
4
+ * Provides functions to compare live biometric data with stored templates.
5
+ */
6
+ export interface BiometricData {
7
+ landmarks: number[][];
8
+ angles: {
9
+ headLeft?: number;
10
+ headRight?: number;
11
+ headUp?: number;
12
+ headDown?: number;
13
+ handLeft?: number;
14
+ handRight?: number;
15
+ handUp?: number;
16
+ handDown?: number;
17
+ };
18
+ features: number[];
19
+ }
20
+ /**
21
+ * Compare two biometric templates and return confidence score (0-1)
22
+ */
23
+ export declare function compareBiometricData(live: BiometricData, stored: BiometricData): number;
24
+ /**
25
+ * Compare biometric templates (wrapper for stored vs live comparison)
26
+ */
27
+ export declare function compareBiometricTemplates(storedTemplate: BiometricData, liveData: {
28
+ features: number[];
29
+ measurements: any;
30
+ angles: string[];
31
+ }, options: {
32
+ captureQuality: number;
33
+ type: "face" | "hand";
34
+ }): Promise<{
35
+ confidence: number;
36
+ match: boolean;
37
+ }>;
38
+ //# sourceMappingURL=biometricComparison.d.ts.map
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Biometric Data Encryption Utilities
3
+ *
4
+ * Provides encryption and decryption for biometric templates.
5
+ * Uses base64 encoding for now (placeholder for proper encryption).
6
+ *
7
+ * NOTE: In Convex, we use base64 encoding for now.
8
+ * For production, implement proper encryption using environment variables
9
+ * or an external encryption service.
10
+ */
11
+ export interface BiometricData {
12
+ landmarks: number[][];
13
+ angles: {
14
+ headLeft?: number;
15
+ headRight?: number;
16
+ headUp?: number;
17
+ headDown?: number;
18
+ handLeft?: number;
19
+ handRight?: number;
20
+ handUp?: number;
21
+ handDown?: number;
22
+ };
23
+ features: number[];
24
+ }
25
+ /**
26
+ * Encrypt biometric data
27
+ * Returns encrypted data, IV, and auth tag as base64 strings
28
+ *
29
+ * IMPORTANT: In production, use proper encryption library or service
30
+ * This is a placeholder that should be replaced with actual encryption
31
+ */
32
+ export declare function encryptBiometricData(data: BiometricData): {
33
+ encryptedData: string;
34
+ iv: string;
35
+ authTag: string;
36
+ };
37
+ /**
38
+ * Decrypt biometric data
39
+ *
40
+ * IMPORTANT: In production, use proper decryption library or service
41
+ * This is a placeholder that should be replaced with actual decryption
42
+ */
43
+ export declare function decryptBiometricData(encryptedData: string, iv: string, authTag: string): BiometricData;
44
+ /**
45
+ * Hash biometric template for quick comparison
46
+ * Uses Web Crypto API (available in Convex V8 runtime)
47
+ */
48
+ export declare function hashBiometricTemplate(data: BiometricData): Promise<string>;
49
+ //# sourceMappingURL=biometricEncryption.d.ts.map
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Password/PIN Hashing Utilities
3
+ *
4
+ * Provides secure password/PIN hashing using Web Crypto API.
5
+ * Uses PBKDF2 for password hashing (more secure than SHA-256 for passwords).
6
+ */
7
+ /**
8
+ * Hash a password or PIN using PBKDF2
9
+ * This is more secure than SHA-256 for passwords as it's designed for this purpose
10
+ */
11
+ export declare function hashPassword(password: string, salt?: string): Promise<{
12
+ hash: string;
13
+ salt: string;
14
+ }>;
15
+ /**
16
+ * Verify a password or PIN against its hash
17
+ */
18
+ export declare function verifyPassword(password: string, hash: string, salt: string): Promise<boolean>;
19
+ /**
20
+ * Simple PIN hashing (4-6 digits) - uses SHA-256 with salt for simplicity
21
+ * PINs are less secure, so we use a simpler approach but still with salt
22
+ */
23
+ export declare function hashPIN(pin: string, salt?: string): Promise<{
24
+ hash: string;
25
+ salt: string;
26
+ }>;
27
+ /**
28
+ * Verify a PIN against its hash
29
+ */
30
+ export declare function verifyPIN(pin: string, hash: string, salt: string): Promise<boolean>;
31
+ //# sourceMappingURL=passwordHashing.d.ts.map
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Token Hashing Utilities
3
+ *
4
+ * Provides secure token hashing and verification.
5
+ * Used for enrollment tokens, session tokens, and OTP codes.
6
+ *
7
+ * Uses Web Crypto API (available in Convex V8 runtime)
8
+ */
9
+ /**
10
+ * Hash a token using SHA-256 (for enrollment tokens and challenges)
11
+ * Uses Web Crypto API which is available in Convex V8 runtime
12
+ */
13
+ export declare function hashToken(token: string): Promise<string>;
14
+ /**
15
+ * Verify a token against its hash
16
+ */
17
+ export declare function verifyToken(token: string, hash: string): Promise<boolean>;
18
+ /**
19
+ * Generate a secure random token
20
+ */
21
+ export declare function generateSecureToken(length?: number): string;
22
+ /**
23
+ * Generate a challenge string for biometric verification
24
+ */
25
+ export declare function generateChallenge(): string;
26
+ //# sourceMappingURL=tokenHashing.d.ts.map
@@ -76,6 +76,8 @@ export declare const getAllNotifications: import("convex/server").RegisteredQuer
76
76
  };
77
77
  }, Promise<{
78
78
  page: {
79
+ isRead: boolean;
80
+ readAt: number | undefined;
79
81
  _id: import("convex/values").GenericId<"notifications">;
80
82
  _creationTime: number;
81
83
  branchId?: import("convex/values").GenericId<"branches"> | undefined;
@@ -83,7 +85,6 @@ export declare const getAllNotifications: import("convex/server").RegisteredQuer
83
85
  entityId?: string | undefined;
84
86
  actionUrl?: string | undefined;
85
87
  actionLabel?: string | undefined;
86
- readAt?: number | undefined;
87
88
  senderId?: string | undefined;
88
89
  senderType?: "admin" | "attendant" | "system" | undefined;
89
90
  expiresAt?: number | undefined;
@@ -97,7 +98,6 @@ export declare const getAllNotifications: import("convex/server").RegisteredQuer
97
98
  title: string;
98
99
  message: string;
99
100
  priority: "low" | "normal" | "high" | "urgent";
100
- isRead: boolean;
101
101
  }[];
102
102
  isDone: boolean;
103
103
  continueCursor: string;