@jarvis-security/sdk 1.0.0 → 2.0.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.
- package/dist/index.cjs +10 -10
- package/dist/index.d.mts +208 -161
- package/dist/index.d.ts +208 -161
- package/dist/index.mjs +10 -10
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,161 +1,208 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
|
|
4
|
-
type AuthStatus = "idle" | "loading" | "authenticated" | "unauthenticated" | "error";
|
|
5
|
-
type BiometricMethod = "passkey" | "retina" | "voice" | "fingerprint";
|
|
6
|
-
type ClearanceLevel = "Level 1" | "Level 2" | "Level 3" | "Admin";
|
|
7
|
-
interface UserProfile {
|
|
8
|
-
uid: string;
|
|
9
|
-
email: string;
|
|
10
|
-
fullName: string;
|
|
11
|
-
clearanceLevel: ClearanceLevel;
|
|
12
|
-
hasBiometrics: boolean;
|
|
13
|
-
createdAt?: string;
|
|
14
|
-
lastLoginAt?: string;
|
|
15
|
-
}
|
|
16
|
-
interface AuthResult {
|
|
17
|
-
success: boolean;
|
|
18
|
-
user?: UserProfile;
|
|
19
|
-
error?: string;
|
|
20
|
-
errorCode?: string;
|
|
21
|
-
}
|
|
22
|
-
interface AuthAdapter {
|
|
23
|
-
readonly name: string;
|
|
24
|
-
register(email: string, passkey: string, fullName: string): Promise<AuthResult>;
|
|
25
|
-
login(email: string, passkey: string): Promise<AuthResult>;
|
|
26
|
-
logout(): Promise<AuthResult>;
|
|
27
|
-
resetPassword(email: string): Promise<AuthResult>;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
interface
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
interface
|
|
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
|
-
private
|
|
77
|
-
|
|
78
|
-
private
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
declare function
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
type AuthStatus = "idle" | "loading" | "authenticated" | "unauthenticated" | "error";
|
|
5
|
+
type BiometricMethod = "passkey" | "retina" | "voice" | "fingerprint";
|
|
6
|
+
type ClearanceLevel = "Level 1" | "Level 2" | "Level 3" | "Admin";
|
|
7
|
+
interface UserProfile {
|
|
8
|
+
uid: string;
|
|
9
|
+
email: string;
|
|
10
|
+
fullName: string;
|
|
11
|
+
clearanceLevel: ClearanceLevel;
|
|
12
|
+
hasBiometrics: boolean;
|
|
13
|
+
createdAt?: string;
|
|
14
|
+
lastLoginAt?: string;
|
|
15
|
+
}
|
|
16
|
+
interface AuthResult {
|
|
17
|
+
success: boolean;
|
|
18
|
+
user?: UserProfile;
|
|
19
|
+
error?: string;
|
|
20
|
+
errorCode?: string;
|
|
21
|
+
}
|
|
22
|
+
interface AuthAdapter {
|
|
23
|
+
readonly name: string;
|
|
24
|
+
register(email: string, passkey: string, fullName: string): Promise<AuthResult>;
|
|
25
|
+
login(email: string, passkey: string): Promise<AuthResult>;
|
|
26
|
+
logout(): Promise<AuthResult>;
|
|
27
|
+
resetPassword(email: string): Promise<AuthResult>;
|
|
28
|
+
/** Device face auth via WebAuthn platform authenticator (Windows Hello / Face ID). */
|
|
29
|
+
verifyFace(): Promise<AuthResult>;
|
|
30
|
+
/** Voice auth via real DSP voiceprint matching against an enrolled sample. */
|
|
31
|
+
verifyVoice(audioBlob: Blob): Promise<AuthResult>;
|
|
32
|
+
/** Device fingerprint auth via WebAuthn platform authenticator (Touch ID / Windows Hello). */
|
|
33
|
+
verifyFingerprint(): Promise<AuthResult>;
|
|
34
|
+
/** Enroll device biometric (WebAuthn platform authenticator). */
|
|
35
|
+
enrollBiometrics(userId: string): Promise<AuthResult>;
|
|
36
|
+
/** Enroll a voiceprint from a recorded sample. */
|
|
37
|
+
enrollVoice(audioBlob: Blob): Promise<AuthResult>;
|
|
38
|
+
verifyPasskey(email?: string): Promise<AuthResult>;
|
|
39
|
+
getCurrentUser(): Promise<UserProfile | null>;
|
|
40
|
+
onAuthStateChanged(callback: (user: UserProfile | null) => void): () => void;
|
|
41
|
+
}
|
|
42
|
+
interface TelemetryData {
|
|
43
|
+
cpu: number;
|
|
44
|
+
memory: string;
|
|
45
|
+
authState: "CONNECTED" | "DISCONNECTED";
|
|
46
|
+
power: number;
|
|
47
|
+
}
|
|
48
|
+
interface TerminalMessage {
|
|
49
|
+
id: string;
|
|
50
|
+
text: string;
|
|
51
|
+
timestamp: Date;
|
|
52
|
+
type: "info" | "success" | "error" | "warning";
|
|
53
|
+
}
|
|
54
|
+
interface AccessModalState {
|
|
55
|
+
open: boolean;
|
|
56
|
+
isSuccess: boolean;
|
|
57
|
+
title: string;
|
|
58
|
+
message: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
declare function __resetMockAdapterStateForTests(): void;
|
|
62
|
+
declare class MockAuthAdapter implements AuthAdapter {
|
|
63
|
+
readonly name = "MockAuthAdapter";
|
|
64
|
+
private listeners;
|
|
65
|
+
private currentUser;
|
|
66
|
+
constructor();
|
|
67
|
+
private emit;
|
|
68
|
+
register(email: string, passkey: string, fullName: string): Promise<AuthResult>;
|
|
69
|
+
login(email: string, passkey: string): Promise<AuthResult>;
|
|
70
|
+
logout(): Promise<AuthResult>;
|
|
71
|
+
resetPassword(email: string): Promise<AuthResult>;
|
|
72
|
+
/** Resolve a full profile for an email (falls back to a minimal profile). */
|
|
73
|
+
private resolveUserByEmail;
|
|
74
|
+
/** Stamp, persist and broadcast an authenticated user. */
|
|
75
|
+
private commitUser;
|
|
76
|
+
private markBiometricsEnrolled;
|
|
77
|
+
/** Shared real WebAuthn platform-biometric login gate (face + fingerprint). */
|
|
78
|
+
private platformBiometricLogin;
|
|
79
|
+
verifyFace(): Promise<AuthResult>;
|
|
80
|
+
verifyVoice(audioBlob: Blob): Promise<AuthResult>;
|
|
81
|
+
verifyFingerprint(): Promise<AuthResult>;
|
|
82
|
+
enrollBiometrics(_userId: string): Promise<AuthResult>;
|
|
83
|
+
enrollVoice(audioBlob: Blob): Promise<AuthResult>;
|
|
84
|
+
verifyPasskey(_email?: string): Promise<AuthResult>;
|
|
85
|
+
getCurrentUser(): Promise<UserProfile | null>;
|
|
86
|
+
onAuthStateChanged(callback: (user: UserProfile | null) => void): () => void;
|
|
87
|
+
}
|
|
88
|
+
declare class BackendAuthAdapter implements AuthAdapter {
|
|
89
|
+
readonly name = "BackendAuthAdapter";
|
|
90
|
+
private listeners;
|
|
91
|
+
private currentUser;
|
|
92
|
+
private baseUrl;
|
|
93
|
+
constructor(baseUrl?: string);
|
|
94
|
+
private emit;
|
|
95
|
+
private request;
|
|
96
|
+
register(email: string, passkey: string, fullName: string): Promise<AuthResult>;
|
|
97
|
+
login(email: string, passkey: string): Promise<AuthResult>;
|
|
98
|
+
logout(): Promise<AuthResult>;
|
|
99
|
+
resetPassword(email: string): Promise<AuthResult>;
|
|
100
|
+
/** Establish a session with the backend after a successful local biometric gate. */
|
|
101
|
+
private biometricLogin;
|
|
102
|
+
verifyFace(): Promise<AuthResult>;
|
|
103
|
+
verifyVoice(audioBlob: Blob): Promise<AuthResult>;
|
|
104
|
+
verifyFingerprint(): Promise<AuthResult>;
|
|
105
|
+
enrollBiometrics(_userId: string): Promise<AuthResult>;
|
|
106
|
+
enrollVoice(audioBlob: Blob): Promise<AuthResult>;
|
|
107
|
+
verifyPasskey(_email?: string): Promise<AuthResult>;
|
|
108
|
+
getCurrentUser(): Promise<UserProfile | null>;
|
|
109
|
+
onAuthStateChanged(callback: (user: UserProfile | null) => void): () => void;
|
|
110
|
+
}
|
|
111
|
+
type AuthAdapterName = "mock" | "backend" | "firebase";
|
|
112
|
+
declare function createAuthAdapter(kind?: AuthAdapterName, options?: {
|
|
113
|
+
baseUrl?: string;
|
|
114
|
+
}): AuthAdapter;
|
|
115
|
+
|
|
116
|
+
interface AuthContextValue {
|
|
117
|
+
user: UserProfile | null;
|
|
118
|
+
status: AuthStatus;
|
|
119
|
+
error: string | null;
|
|
120
|
+
adapter: AuthAdapter;
|
|
121
|
+
adapterName: AuthAdapterName;
|
|
122
|
+
audioEnabled: boolean;
|
|
123
|
+
activeMethod: BiometricMethod;
|
|
124
|
+
isRegisterMode: boolean;
|
|
125
|
+
terminalText: string;
|
|
126
|
+
modal: AccessModalState;
|
|
127
|
+
login: (email: string, passkey: string) => Promise<void>;
|
|
128
|
+
register: (email: string, passkey: string, fullName: string) => Promise<void>;
|
|
129
|
+
logout: () => Promise<void>;
|
|
130
|
+
resetPassword: (email: string) => Promise<void>;
|
|
131
|
+
verifyFace: () => Promise<void>;
|
|
132
|
+
verifyVoice: (audioBlob: Blob) => Promise<void>;
|
|
133
|
+
verifyFingerprint: () => Promise<void>;
|
|
134
|
+
enrollBiometrics: () => Promise<void>;
|
|
135
|
+
enrollVoice: (audioBlob: Blob) => Promise<void>;
|
|
136
|
+
verifyPasskey: () => Promise<AuthResult>;
|
|
137
|
+
setActiveMethod: (method: BiometricMethod) => void;
|
|
138
|
+
toggleMode: () => void;
|
|
139
|
+
toggleAudio: () => void;
|
|
140
|
+
updateTerminal: (msg: string) => void;
|
|
141
|
+
showModal: (isSuccess: boolean, title: string, message: string) => void;
|
|
142
|
+
closeModal: () => void;
|
|
143
|
+
playBeep: (freq?: number, type?: OscillatorType, duration?: number) => void;
|
|
144
|
+
playSuccess: () => void;
|
|
145
|
+
playError: () => void;
|
|
146
|
+
}
|
|
147
|
+
declare function AuthProvider({ children, adapter: adapterArg, adapterOptions, }: {
|
|
148
|
+
children: ReactNode;
|
|
149
|
+
adapter?: AuthAdapterName | AuthAdapter;
|
|
150
|
+
adapterOptions?: {
|
|
151
|
+
baseUrl?: string;
|
|
152
|
+
};
|
|
153
|
+
}): react.JSX.Element;
|
|
154
|
+
declare function useAuth(): AuthContextValue;
|
|
155
|
+
|
|
156
|
+
declare class SoundEngine {
|
|
157
|
+
private ctx;
|
|
158
|
+
private ensureContext;
|
|
159
|
+
playBeep(freq?: number, type?: OscillatorType, duration?: number, gain?: number): void;
|
|
160
|
+
playSuccess(): void;
|
|
161
|
+
playError(): void;
|
|
162
|
+
unlock(): void;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
declare function AuthPortal(): react.JSX.Element;
|
|
166
|
+
|
|
167
|
+
declare function ArcReactorHud(): react.JSX.Element;
|
|
168
|
+
|
|
169
|
+
declare function CanvasBackground(): react.JSX.Element;
|
|
170
|
+
|
|
171
|
+
declare function PasskeyForm(): react.JSX.Element;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Real device face authentication.
|
|
175
|
+
*
|
|
176
|
+
* This does NOT do a fake camera capture. It invokes the OS-level WebAuthn
|
|
177
|
+
* platform authenticator (Windows Hello / Face ID), which owns the camera and
|
|
178
|
+
* performs the genuine biometric match. The raw face data never reaches this
|
|
179
|
+
* app — the OS returns a signed cryptographic assertion instead.
|
|
180
|
+
*/
|
|
181
|
+
declare function FacialScanner(): react.JSX.Element;
|
|
182
|
+
|
|
183
|
+
interface VoiceScannerProps {
|
|
184
|
+
/**
|
|
185
|
+
* "enroll" extracts and stores a new voiceprint for the signed-in user.
|
|
186
|
+
* "verify" extracts a probe voiceprint and matches it against enrolled ones.
|
|
187
|
+
*/
|
|
188
|
+
mode?: "enroll" | "verify";
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Real voice authentication using client-side DSP.
|
|
192
|
+
*
|
|
193
|
+
* Records a genuine microphone sample, extracts an MFCC voiceprint entirely on
|
|
194
|
+
* device, and either stores it (enroll) or matches it 1:N against enrolled
|
|
195
|
+
* voiceprints (verify). No audio or voiceprint ever leaves the device.
|
|
196
|
+
*/
|
|
197
|
+
declare function VoiceScanner({ mode }: VoiceScannerProps): react.JSX.Element;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Real device fingerprint authentication.
|
|
201
|
+
*
|
|
202
|
+
* This does NOT fabricate a scan string. It invokes the OS-level WebAuthn
|
|
203
|
+
* platform authenticator (Windows Hello fingerprint / Touch ID), which owns the
|
|
204
|
+
* sensor and performs the genuine match. The raw print never leaves the device.
|
|
205
|
+
*/
|
|
206
|
+
declare function FingerprintPad(): react.JSX.Element;
|
|
207
|
+
|
|
208
|
+
export { type AccessModalState, ArcReactorHud, type AuthAdapter, type AuthAdapterName, type AuthContextValue, AuthPortal, AuthProvider, type AuthResult, type AuthStatus, BackendAuthAdapter, type BiometricMethod, CanvasBackground, type ClearanceLevel, FacialScanner, FingerprintPad, MockAuthAdapter, PasskeyForm, SoundEngine, type TelemetryData, type TerminalMessage, type UserProfile, VoiceScanner, __resetMockAdapterStateForTests, createAuthAdapter, useAuth };
|