react-native-usesense 2.0.0 → 2.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.
- package/android/build.gradle +6 -6
- package/android/src/main/java/com/usesense/reactnative/UseSenseFlowsModule.kt +72 -0
- package/android/src/main/java/com/usesense/reactnative/UseSenseModule.kt +76 -0
- package/android/src/main/java/com/usesense/reactnative/UseSensePackage.kt +6 -1
- package/ios/UseSenseFlowsModule.m +20 -0
- package/ios/UseSenseFlowsModule.swift +111 -0
- package/ios/UseSenseModule.m +5 -0
- package/ios/UseSenseModule.swift +55 -1
- package/ios/V4BridgeDelegate.swift +62 -0
- package/lib/commonjs/flows.js +105 -0
- package/lib/commonjs/flows.js.map +1 -0
- package/lib/commonjs/index.js +55 -3
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/flows.js +99 -0
- package/lib/module/flows.js.map +1 -0
- package/lib/module/index.js +43 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/flows.d.ts +72 -0
- package/lib/typescript/src/flows.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +56 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +3 -1
- package/react-native-usesense.podspec +1 -1
- package/src/flows.ts +159 -0
- package/src/index.ts +96 -0
package/src/index.ts
CHANGED
|
@@ -72,6 +72,27 @@ export interface UseSenseConfig {
|
|
|
72
72
|
apiEndpoint?: string;
|
|
73
73
|
/** SDK-level branding overrides. */
|
|
74
74
|
branding?: BrandingConfig;
|
|
75
|
+
/**
|
|
76
|
+
* Opt in to the on-device antispoof classifier (v4.2). When enabled the
|
|
77
|
+
* native layer runs the bundled CelebA-Spoof model during capture and
|
|
78
|
+
* attaches per-frame spoof probabilities to the uploaded metadata. When
|
|
79
|
+
* disabled (default), the watchtower backend runs the classifier server-side.
|
|
80
|
+
* See `docs/sdk-specs/antispoof-classifier-sdk-spec.md` in the watchtower
|
|
81
|
+
* repo for the rollout plan and crosscheck policy.
|
|
82
|
+
*/
|
|
83
|
+
antispoofOnDeviceEnabled?: boolean;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Opt the session into the LiveSense v4 capture flow. When true the native
|
|
87
|
+
* layer:
|
|
88
|
+
* - sends `x-usesense-sdk-version: v4` on session creation
|
|
89
|
+
* - inserts a constitutive zoom-motion phase between baseline and the
|
|
90
|
+
* active challenge (additive, not a replacement)
|
|
91
|
+
* - tags every captured frame with its capture phase
|
|
92
|
+
* The org must also have `livesense_v4_enabled` set in its features map
|
|
93
|
+
* server-side.
|
|
94
|
+
*/
|
|
95
|
+
liveSenseV4Enabled?: boolean;
|
|
75
96
|
}
|
|
76
97
|
|
|
77
98
|
/**
|
|
@@ -241,6 +262,8 @@ export class UseSense {
|
|
|
241
262
|
environment: config.environment ?? 'auto',
|
|
242
263
|
apiEndpoint: config.apiEndpoint,
|
|
243
264
|
branding: config.branding,
|
|
265
|
+
antispoofOnDeviceEnabled: config.antispoofOnDeviceEnabled ?? false,
|
|
266
|
+
liveSenseV4Enabled: config.liveSenseV4Enabled ?? false,
|
|
244
267
|
});
|
|
245
268
|
}
|
|
246
269
|
|
|
@@ -304,6 +327,79 @@ export class UseSense {
|
|
|
304
327
|
static async isInitialized(): Promise<boolean> {
|
|
305
328
|
return UseSenseModule.isInitialized();
|
|
306
329
|
}
|
|
330
|
+
|
|
331
|
+
// ─── LiveSense v4 ─────────────────────────────────────────────────────
|
|
332
|
+
// Phase 1 ticket R-1.
|
|
333
|
+
//
|
|
334
|
+
// v4 runs the perspective-distortion zoom-motion capture. Passthrough
|
|
335
|
+
// to the native SDK's startV4Session (iOS) / startV4Verification
|
|
336
|
+
// (Android). The returned promise resolves with the opaque verdict;
|
|
337
|
+
// sub-scores and pillar verdicts are never exposed.
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Start a LiveSense v4 session.
|
|
341
|
+
*
|
|
342
|
+
* The session must already have been created on your backend and the
|
|
343
|
+
* session_token + nonce forwarded to the client. The native SDK drives
|
|
344
|
+
* the camera, signs the frame hash chain with the platform-attested
|
|
345
|
+
* key, uploads, and returns the opaque verdict.
|
|
346
|
+
*/
|
|
347
|
+
static async startV4Verification(
|
|
348
|
+
request: V4VerificationRequest,
|
|
349
|
+
): Promise<V4Verdict> {
|
|
350
|
+
return UseSenseModule.startV4Verification({
|
|
351
|
+
sessionId: request.sessionId,
|
|
352
|
+
sessionToken: request.sessionToken,
|
|
353
|
+
nonce: request.nonce,
|
|
354
|
+
apiBaseUrl: request.apiBaseUrl,
|
|
355
|
+
environment: request.environment ?? 'production',
|
|
356
|
+
displayName: request.displayName,
|
|
357
|
+
brandPrimaryColor: request.brandPrimaryColor,
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
// ─── LiveSense v4 types (R-1) ─────────────────────────────────────────────
|
|
363
|
+
|
|
364
|
+
export interface V4VerificationRequest {
|
|
365
|
+
sessionId: string;
|
|
366
|
+
sessionToken: string;
|
|
367
|
+
nonce: string;
|
|
368
|
+
apiBaseUrl: string;
|
|
369
|
+
environment?: UseSenseEnvironment;
|
|
370
|
+
displayName?: string;
|
|
371
|
+
brandPrimaryColor?: string;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
export type V4Decision = 'pass' | 'fail' | 'review';
|
|
375
|
+
export type V4Confidence = 'high' | 'medium' | 'low';
|
|
376
|
+
export type V4AssuranceLevel = 'mobile_hardware' | 'web_attested' | 'web_unattested';
|
|
377
|
+
export type V4CaptureChannel = 'ios' | 'android' | 'rn' | 'flutter' | 'web';
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Opaque verdict from POST /v1/sessions/:id/result. Matches the server
|
|
381
|
+
* contract exactly; no sub-scores leak through.
|
|
382
|
+
*/
|
|
383
|
+
export interface V4Verdict {
|
|
384
|
+
session_id: string;
|
|
385
|
+
verdict: V4Decision;
|
|
386
|
+
confidence: V4Confidence;
|
|
387
|
+
assurance_level_achieved: V4AssuranceLevel;
|
|
388
|
+
capture_channel: V4CaptureChannel;
|
|
389
|
+
match_sense_embedding_id: string | null;
|
|
390
|
+
timestamp: string;
|
|
307
391
|
}
|
|
308
392
|
|
|
309
393
|
export default UseSense;
|
|
394
|
+
|
|
395
|
+
// Slice 5d: Flows. A parallel surface to Sessions — host apps choose one
|
|
396
|
+
// per call. See guides/flows/sessions-vs-flows in the API docs.
|
|
397
|
+
export {
|
|
398
|
+
UseSenseFlows,
|
|
399
|
+
FlowError,
|
|
400
|
+
type FlowErrorCode,
|
|
401
|
+
type FlowOutcome,
|
|
402
|
+
type FlowRunResult,
|
|
403
|
+
type FlowRunState,
|
|
404
|
+
type RunFlowOptions,
|
|
405
|
+
} from './flows';
|