@kwik-id/sdk-react-native 0.0.0-stage → 0.1.0-alpha.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/LICENSE +22 -0
- package/README.md +81 -2
- package/app.plugin.js +40 -0
- package/lib/commonjs/api/api-client.js +213 -0
- package/lib/commonjs/api/api-client.js.map +1 -0
- package/lib/commonjs/api/api-error.js +29 -0
- package/lib/commonjs/api/api-error.js.map +1 -0
- package/lib/commonjs/api/index.js +33 -0
- package/lib/commonjs/api/index.js.map +1 -0
- package/lib/commonjs/api/upload.js +74 -0
- package/lib/commonjs/api/upload.js.map +1 -0
- package/lib/commonjs/camera/camera-view.js +227 -0
- package/lib/commonjs/camera/camera-view.js.map +1 -0
- package/lib/commonjs/camera/index.js +20 -0
- package/lib/commonjs/camera/index.js.map +1 -0
- package/lib/commonjs/camera/photo-capture.js +50 -0
- package/lib/commonjs/camera/photo-capture.js.map +1 -0
- package/lib/commonjs/crypto/fingerprint.js +43 -0
- package/lib/commonjs/crypto/fingerprint.js.map +1 -0
- package/lib/commonjs/crypto/hmac.js +150 -0
- package/lib/commonjs/crypto/hmac.js.map +1 -0
- package/lib/commonjs/crypto/index.js +39 -0
- package/lib/commonjs/crypto/index.js.map +1 -0
- package/lib/commonjs/crypto/session-manager.js +173 -0
- package/lib/commonjs/crypto/session-manager.js.map +1 -0
- package/lib/commonjs/i18n/en.js +297 -0
- package/lib/commonjs/i18n/en.js.map +1 -0
- package/lib/commonjs/i18n/fr.js +294 -0
- package/lib/commonjs/i18n/fr.js.map +1 -0
- package/lib/commonjs/i18n/index.js +34 -0
- package/lib/commonjs/i18n/index.js.map +1 -0
- package/lib/commonjs/i18n/locale.js +20 -0
- package/lib/commonjs/i18n/locale.js.map +1 -0
- package/lib/commonjs/i18n/translator.js +37 -0
- package/lib/commonjs/i18n/translator.js.map +1 -0
- package/lib/commonjs/index.js +187 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/lib/device-detector.js +34 -0
- package/lib/commonjs/lib/device-detector.js.map +1 -0
- package/lib/commonjs/lib/event-emitter.js +85 -0
- package/lib/commonjs/lib/event-emitter.js.map +1 -0
- package/lib/commonjs/lib/index.js +63 -0
- package/lib/commonjs/lib/index.js.map +1 -0
- package/lib/commonjs/lib/kwik-id-rn-sdk.js +156 -0
- package/lib/commonjs/lib/kwik-id-rn-sdk.js.map +1 -0
- package/lib/commonjs/lib/verification-machine.js +276 -0
- package/lib/commonjs/lib/verification-machine.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/types/events.js +6 -0
- package/lib/commonjs/types/events.js.map +1 -0
- package/lib/commonjs/types/index.js +2 -0
- package/lib/commonjs/types/index.js.map +1 -0
- package/lib/commonjs/ui/components/KwikIDVerificationModal.js +407 -0
- package/lib/commonjs/ui/components/KwikIDVerificationModal.js.map +1 -0
- package/lib/commonjs/ui/components/screens.js +338 -0
- package/lib/commonjs/ui/components/screens.js.map +1 -0
- package/lib/commonjs/ui/context/kwik-id-provider.js +52 -0
- package/lib/commonjs/ui/context/kwik-id-provider.js.map +1 -0
- package/lib/commonjs/ui/hooks/use-kwik-verification.js +77 -0
- package/lib/commonjs/ui/hooks/use-kwik-verification.js.map +1 -0
- package/lib/commonjs/ui/index.js +33 -0
- package/lib/commonjs/ui/index.js.map +1 -0
- package/lib/module/api/api-client.js +208 -0
- package/lib/module/api/api-client.js.map +1 -0
- package/lib/module/api/api-error.js +24 -0
- package/lib/module/api/api-error.js.map +1 -0
- package/lib/module/api/index.js +6 -0
- package/lib/module/api/index.js.map +1 -0
- package/lib/module/api/upload.js +68 -0
- package/lib/module/api/upload.js.map +1 -0
- package/lib/module/camera/camera-view.js +222 -0
- package/lib/module/camera/camera-view.js.map +1 -0
- package/lib/module/camera/index.js +5 -0
- package/lib/module/camera/index.js.map +1 -0
- package/lib/module/camera/photo-capture.js +45 -0
- package/lib/module/camera/photo-capture.js.map +1 -0
- package/lib/module/crypto/fingerprint.js +37 -0
- package/lib/module/crypto/fingerprint.js.map +1 -0
- package/lib/module/crypto/hmac.js +143 -0
- package/lib/module/crypto/hmac.js.map +1 -0
- package/lib/module/crypto/index.js +6 -0
- package/lib/module/crypto/index.js.map +1 -0
- package/lib/module/crypto/session-manager.js +169 -0
- package/lib/module/crypto/session-manager.js.map +1 -0
- package/lib/module/i18n/en.js +293 -0
- package/lib/module/i18n/en.js.map +1 -0
- package/lib/module/i18n/fr.js +290 -0
- package/lib/module/i18n/fr.js.map +1 -0
- package/lib/module/i18n/index.js +11 -0
- package/lib/module/i18n/index.js.map +1 -0
- package/lib/module/i18n/locale.js +15 -0
- package/lib/module/i18n/locale.js.map +1 -0
- package/lib/module/i18n/translator.js +34 -0
- package/lib/module/i18n/translator.js.map +1 -0
- package/lib/module/index.js +30 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/lib/device-detector.js +26 -0
- package/lib/module/lib/device-detector.js.map +1 -0
- package/lib/module/lib/event-emitter.js +80 -0
- package/lib/module/lib/event-emitter.js.map +1 -0
- package/lib/module/lib/index.js +6 -0
- package/lib/module/lib/index.js.map +1 -0
- package/lib/module/lib/kwik-id-rn-sdk.js +150 -0
- package/lib/module/lib/kwik-id-rn-sdk.js.map +1 -0
- package/lib/module/lib/verification-machine.js +268 -0
- package/lib/module/lib/verification-machine.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/types/events.js +4 -0
- package/lib/module/types/events.js.map +1 -0
- package/lib/module/types/index.js +2 -0
- package/lib/module/types/index.js.map +1 -0
- package/lib/module/ui/components/KwikIDVerificationModal.js +402 -0
- package/lib/module/ui/components/KwikIDVerificationModal.js.map +1 -0
- package/lib/module/ui/components/screens.js +328 -0
- package/lib/module/ui/components/screens.js.map +1 -0
- package/lib/module/ui/context/kwik-id-provider.js +46 -0
- package/lib/module/ui/context/kwik-id-provider.js.map +1 -0
- package/lib/module/ui/hooks/use-kwik-verification.js +72 -0
- package/lib/module/ui/hooks/use-kwik-verification.js.map +1 -0
- package/lib/module/ui/index.js +6 -0
- package/lib/module/ui/index.js.map +1 -0
- package/lib/typescript/commonjs/api/api-client.d.ts +82 -0
- package/lib/typescript/commonjs/api/api-client.d.ts.map +1 -0
- package/lib/typescript/commonjs/api/api-error.d.ts +13 -0
- package/lib/typescript/commonjs/api/api-error.d.ts.map +1 -0
- package/lib/typescript/commonjs/api/index.d.ts +6 -0
- package/lib/typescript/commonjs/api/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/api/upload.d.ts +19 -0
- package/lib/typescript/commonjs/api/upload.d.ts.map +1 -0
- package/lib/typescript/commonjs/camera/camera-view.d.ts +25 -0
- package/lib/typescript/commonjs/camera/camera-view.d.ts.map +1 -0
- package/lib/typescript/commonjs/camera/index.d.ts +5 -0
- package/lib/typescript/commonjs/camera/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/camera/photo-capture.d.ts +9 -0
- package/lib/typescript/commonjs/camera/photo-capture.d.ts.map +1 -0
- package/lib/typescript/commonjs/crypto/fingerprint.d.ts +3 -0
- package/lib/typescript/commonjs/crypto/fingerprint.d.ts.map +1 -0
- package/lib/typescript/commonjs/crypto/hmac.d.ts +18 -0
- package/lib/typescript/commonjs/crypto/hmac.d.ts.map +1 -0
- package/lib/typescript/commonjs/crypto/index.d.ts +4 -0
- package/lib/typescript/commonjs/crypto/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/crypto/session-manager.d.ts +27 -0
- package/lib/typescript/commonjs/crypto/session-manager.d.ts.map +1 -0
- package/lib/typescript/commonjs/i18n/en.d.ts +291 -0
- package/lib/typescript/commonjs/i18n/en.d.ts.map +1 -0
- package/lib/typescript/commonjs/i18n/fr.d.ts +6 -0
- package/lib/typescript/commonjs/i18n/fr.d.ts.map +1 -0
- package/lib/typescript/commonjs/i18n/index.d.ts +10 -0
- package/lib/typescript/commonjs/i18n/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/i18n/locale.d.ts +4 -0
- package/lib/typescript/commonjs/i18n/locale.d.ts.map +1 -0
- package/lib/typescript/commonjs/i18n/translator.d.ts +15 -0
- package/lib/typescript/commonjs/i18n/translator.d.ts.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +24 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/lib/device-detector.d.ts +5 -0
- package/lib/typescript/commonjs/lib/device-detector.d.ts.map +1 -0
- package/lib/typescript/commonjs/lib/event-emitter.d.ts +19 -0
- package/lib/typescript/commonjs/lib/event-emitter.d.ts.map +1 -0
- package/lib/typescript/commonjs/lib/index.d.ts +5 -0
- package/lib/typescript/commonjs/lib/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/lib/kwik-id-rn-sdk.d.ts +43 -0
- package/lib/typescript/commonjs/lib/kwik-id-rn-sdk.d.ts.map +1 -0
- package/lib/typescript/commonjs/lib/verification-machine.d.ts +78 -0
- package/lib/typescript/commonjs/lib/verification-machine.d.ts.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/types/events.d.ts +94 -0
- package/lib/typescript/commonjs/types/events.d.ts.map +1 -0
- package/lib/typescript/commonjs/types/index.d.ts +242 -0
- package/lib/typescript/commonjs/types/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/KwikIDVerificationModal.d.ts +21 -0
- package/lib/typescript/commonjs/ui/components/KwikIDVerificationModal.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/screens.d.ts +46 -0
- package/lib/typescript/commonjs/ui/components/screens.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/context/kwik-id-provider.d.ts +19 -0
- package/lib/typescript/commonjs/ui/context/kwik-id-provider.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/hooks/use-kwik-verification.d.ts +29 -0
- package/lib/typescript/commonjs/ui/hooks/use-kwik-verification.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/index.d.ts +7 -0
- package/lib/typescript/commonjs/ui/index.d.ts.map +1 -0
- package/lib/typescript/module/api/api-client.d.ts +82 -0
- package/lib/typescript/module/api/api-client.d.ts.map +1 -0
- package/lib/typescript/module/api/api-error.d.ts +13 -0
- package/lib/typescript/module/api/api-error.d.ts.map +1 -0
- package/lib/typescript/module/api/index.d.ts +6 -0
- package/lib/typescript/module/api/index.d.ts.map +1 -0
- package/lib/typescript/module/api/upload.d.ts +19 -0
- package/lib/typescript/module/api/upload.d.ts.map +1 -0
- package/lib/typescript/module/camera/camera-view.d.ts +25 -0
- package/lib/typescript/module/camera/camera-view.d.ts.map +1 -0
- package/lib/typescript/module/camera/index.d.ts +5 -0
- package/lib/typescript/module/camera/index.d.ts.map +1 -0
- package/lib/typescript/module/camera/photo-capture.d.ts +9 -0
- package/lib/typescript/module/camera/photo-capture.d.ts.map +1 -0
- package/lib/typescript/module/crypto/fingerprint.d.ts +3 -0
- package/lib/typescript/module/crypto/fingerprint.d.ts.map +1 -0
- package/lib/typescript/module/crypto/hmac.d.ts +18 -0
- package/lib/typescript/module/crypto/hmac.d.ts.map +1 -0
- package/lib/typescript/module/crypto/index.d.ts +4 -0
- package/lib/typescript/module/crypto/index.d.ts.map +1 -0
- package/lib/typescript/module/crypto/session-manager.d.ts +27 -0
- package/lib/typescript/module/crypto/session-manager.d.ts.map +1 -0
- package/lib/typescript/module/i18n/en.d.ts +291 -0
- package/lib/typescript/module/i18n/en.d.ts.map +1 -0
- package/lib/typescript/module/i18n/fr.d.ts +6 -0
- package/lib/typescript/module/i18n/fr.d.ts.map +1 -0
- package/lib/typescript/module/i18n/index.d.ts +10 -0
- package/lib/typescript/module/i18n/index.d.ts.map +1 -0
- package/lib/typescript/module/i18n/locale.d.ts +4 -0
- package/lib/typescript/module/i18n/locale.d.ts.map +1 -0
- package/lib/typescript/module/i18n/translator.d.ts +15 -0
- package/lib/typescript/module/i18n/translator.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +24 -0
- package/lib/typescript/module/index.d.ts.map +1 -0
- package/lib/typescript/module/lib/device-detector.d.ts +5 -0
- package/lib/typescript/module/lib/device-detector.d.ts.map +1 -0
- package/lib/typescript/module/lib/event-emitter.d.ts +19 -0
- package/lib/typescript/module/lib/event-emitter.d.ts.map +1 -0
- package/lib/typescript/module/lib/index.d.ts +5 -0
- package/lib/typescript/module/lib/index.d.ts.map +1 -0
- package/lib/typescript/module/lib/kwik-id-rn-sdk.d.ts +43 -0
- package/lib/typescript/module/lib/kwik-id-rn-sdk.d.ts.map +1 -0
- package/lib/typescript/module/lib/verification-machine.d.ts +78 -0
- package/lib/typescript/module/lib/verification-machine.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/types/events.d.ts +94 -0
- package/lib/typescript/module/types/events.d.ts.map +1 -0
- package/lib/typescript/module/types/index.d.ts +242 -0
- package/lib/typescript/module/types/index.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/KwikIDVerificationModal.d.ts +21 -0
- package/lib/typescript/module/ui/components/KwikIDVerificationModal.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/screens.d.ts +46 -0
- package/lib/typescript/module/ui/components/screens.d.ts.map +1 -0
- package/lib/typescript/module/ui/context/kwik-id-provider.d.ts +19 -0
- package/lib/typescript/module/ui/context/kwik-id-provider.d.ts.map +1 -0
- package/lib/typescript/module/ui/hooks/use-kwik-verification.d.ts +29 -0
- package/lib/typescript/module/ui/hooks/use-kwik-verification.d.ts.map +1 -0
- package/lib/typescript/module/ui/index.d.ts +7 -0
- package/lib/typescript/module/ui/index.d.ts.map +1 -0
- package/package.json +121 -3
- package/src/api/api-client.ts +319 -0
- package/src/api/api-error.ts +28 -0
- package/src/api/index.ts +12 -0
- package/src/api/upload.ts +87 -0
- package/src/camera/camera-view.tsx +217 -0
- package/src/camera/index.ts +4 -0
- package/src/camera/photo-capture.ts +58 -0
- package/src/crypto/fingerprint.ts +46 -0
- package/src/crypto/hmac.ts +172 -0
- package/src/crypto/index.ts +3 -0
- package/src/crypto/session-manager.ts +200 -0
- package/src/i18n/en.ts +315 -0
- package/src/i18n/fr.ts +325 -0
- package/src/i18n/index.ts +9 -0
- package/src/i18n/locale.ts +15 -0
- package/src/i18n/translator.ts +37 -0
- package/src/index.ts +102 -0
- package/src/lib/device-detector.ts +32 -0
- package/src/lib/event-emitter.ts +90 -0
- package/src/lib/index.ts +15 -0
- package/src/lib/kwik-id-rn-sdk.ts +160 -0
- package/src/lib/verification-machine.ts +273 -0
- package/src/types/events.ts +75 -0
- package/src/types/index.ts +309 -0
- package/src/ui/components/KwikIDVerificationModal.tsx +450 -0
- package/src/ui/components/screens.tsx +283 -0
- package/src/ui/context/kwik-id-provider.tsx +72 -0
- package/src/ui/hooks/use-kwik-verification.ts +121 -0
- package/src/ui/index.ts +9 -0
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CameraView = CameraView;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
/**
|
|
11
|
+
* CameraView — vision-camera wrapper for still capture (Phase 1).
|
|
12
|
+
*
|
|
13
|
+
* Phase 1 is capture-only, so this uses `takePhoto` and does NOT run a frame
|
|
14
|
+
* processor (that lands in Phase 2 for liveness). Handles permission + device
|
|
15
|
+
* selection and reports a RawPhoto to the caller.
|
|
16
|
+
*
|
|
17
|
+
* vision-camera is required lazily: its NativeCameraModule throws at import time
|
|
18
|
+
* when the native module is missing (e.g. Expo Go), which would crash any import of
|
|
19
|
+
* this SDK before KwikIdRNSDK.initialize() can report a friendly runtime error.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
let visionCamera;
|
|
23
|
+
function loadVisionCamera() {
|
|
24
|
+
visionCamera ??= require("react-native-vision-camera");
|
|
25
|
+
return visionCamera;
|
|
26
|
+
}
|
|
27
|
+
function CameraView({
|
|
28
|
+
facing,
|
|
29
|
+
active,
|
|
30
|
+
primaryColor,
|
|
31
|
+
overlay,
|
|
32
|
+
instruction,
|
|
33
|
+
captureErrorText = "Could not capture the photo. Please try again.",
|
|
34
|
+
permissionTitle = "Camera access needed",
|
|
35
|
+
permissionBody = "Enable camera access in Settings to continue verification.",
|
|
36
|
+
openSettingsLabel = "Open Settings",
|
|
37
|
+
captureLabel = "Capture photo",
|
|
38
|
+
onCapture,
|
|
39
|
+
onPermissionDenied
|
|
40
|
+
}) {
|
|
41
|
+
const {
|
|
42
|
+
Camera,
|
|
43
|
+
useCameraDevice,
|
|
44
|
+
useCameraPermission
|
|
45
|
+
} = loadVisionCamera();
|
|
46
|
+
const camera = (0, _react.useRef)(null);
|
|
47
|
+
const device = useCameraDevice(facing);
|
|
48
|
+
const {
|
|
49
|
+
hasPermission,
|
|
50
|
+
requestPermission
|
|
51
|
+
} = useCameraPermission();
|
|
52
|
+
const [capturing, setCapturing] = (0, _react.useState)(false);
|
|
53
|
+
const [permissionChecked, setPermissionChecked] = (0, _react.useState)(false);
|
|
54
|
+
const [captureFailed, setCaptureFailed] = (0, _react.useState)(false);
|
|
55
|
+
(0, _react.useEffect)(() => {
|
|
56
|
+
let cancelled = false;
|
|
57
|
+
(async () => {
|
|
58
|
+
if (!hasPermission) {
|
|
59
|
+
const granted = await requestPermission();
|
|
60
|
+
if (!cancelled && !granted) {
|
|
61
|
+
onPermissionDenied?.(false);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (!cancelled) setPermissionChecked(true);
|
|
65
|
+
})();
|
|
66
|
+
return () => {
|
|
67
|
+
cancelled = true;
|
|
68
|
+
};
|
|
69
|
+
}, [hasPermission, requestPermission, onPermissionDenied]);
|
|
70
|
+
const takePhoto = async () => {
|
|
71
|
+
if (!camera.current || capturing) return;
|
|
72
|
+
setCapturing(true);
|
|
73
|
+
setCaptureFailed(false);
|
|
74
|
+
try {
|
|
75
|
+
const photo = await camera.current.takePhoto({
|
|
76
|
+
flash: "off"
|
|
77
|
+
});
|
|
78
|
+
await onCapture({
|
|
79
|
+
path: photo.path,
|
|
80
|
+
width: photo.width,
|
|
81
|
+
height: photo.height
|
|
82
|
+
});
|
|
83
|
+
} catch {
|
|
84
|
+
setCaptureFailed(true);
|
|
85
|
+
} finally {
|
|
86
|
+
setCapturing(false);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
if (!hasPermission && permissionChecked) {
|
|
90
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
91
|
+
style: styles.center,
|
|
92
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
93
|
+
style: styles.permTitle,
|
|
94
|
+
children: permissionTitle
|
|
95
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
96
|
+
style: styles.permBody,
|
|
97
|
+
children: permissionBody
|
|
98
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
99
|
+
style: [styles.settingsBtn, {
|
|
100
|
+
borderColor: primaryColor
|
|
101
|
+
}],
|
|
102
|
+
onPress: () => _reactNative.Linking.openSettings(),
|
|
103
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
104
|
+
style: [styles.settingsText, {
|
|
105
|
+
color: primaryColor
|
|
106
|
+
}],
|
|
107
|
+
children: openSettingsLabel
|
|
108
|
+
})
|
|
109
|
+
})]
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
if (!device || !permissionChecked) {
|
|
113
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
114
|
+
style: styles.center,
|
|
115
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ActivityIndicator, {
|
|
116
|
+
color: primaryColor
|
|
117
|
+
})
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
121
|
+
style: styles.fill,
|
|
122
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Camera, {
|
|
123
|
+
ref: camera,
|
|
124
|
+
style: _reactNative.StyleSheet.absoluteFill,
|
|
125
|
+
device: device,
|
|
126
|
+
isActive: active,
|
|
127
|
+
photo: true
|
|
128
|
+
}), overlay, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
129
|
+
style: styles.bottomBar,
|
|
130
|
+
children: [captureFailed ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
131
|
+
accessibilityRole: "alert",
|
|
132
|
+
style: [styles.instruction, styles.captureError],
|
|
133
|
+
children: captureErrorText
|
|
134
|
+
}) : instruction ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
135
|
+
style: styles.instruction,
|
|
136
|
+
children: instruction
|
|
137
|
+
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
138
|
+
accessibilityLabel: captureLabel,
|
|
139
|
+
style: styles.shutterOuter,
|
|
140
|
+
onPress: takePhoto,
|
|
141
|
+
disabled: capturing,
|
|
142
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
143
|
+
style: [styles.shutterInner, capturing && styles.shutterBusy],
|
|
144
|
+
children: capturing ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ActivityIndicator, {
|
|
145
|
+
color: "#fff"
|
|
146
|
+
}) : null
|
|
147
|
+
})
|
|
148
|
+
})]
|
|
149
|
+
})]
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
const styles = _reactNative.StyleSheet.create({
|
|
153
|
+
fill: {
|
|
154
|
+
flex: 1,
|
|
155
|
+
backgroundColor: "#000"
|
|
156
|
+
},
|
|
157
|
+
center: {
|
|
158
|
+
flex: 1,
|
|
159
|
+
alignItems: "center",
|
|
160
|
+
justifyContent: "center",
|
|
161
|
+
padding: 24,
|
|
162
|
+
backgroundColor: "#000"
|
|
163
|
+
},
|
|
164
|
+
bottomBar: {
|
|
165
|
+
position: "absolute",
|
|
166
|
+
bottom: 0,
|
|
167
|
+
left: 0,
|
|
168
|
+
right: 0,
|
|
169
|
+
alignItems: "center",
|
|
170
|
+
paddingBottom: 40
|
|
171
|
+
},
|
|
172
|
+
instruction: {
|
|
173
|
+
color: "#fff",
|
|
174
|
+
fontSize: 15,
|
|
175
|
+
marginBottom: 16,
|
|
176
|
+
textAlign: "center",
|
|
177
|
+
paddingHorizontal: 24
|
|
178
|
+
},
|
|
179
|
+
captureError: {
|
|
180
|
+
color: "#fca5a5",
|
|
181
|
+
fontWeight: "600"
|
|
182
|
+
},
|
|
183
|
+
shutterOuter: {
|
|
184
|
+
width: 76,
|
|
185
|
+
height: 76,
|
|
186
|
+
borderRadius: 38,
|
|
187
|
+
borderWidth: 4,
|
|
188
|
+
borderColor: "#fff",
|
|
189
|
+
alignItems: "center",
|
|
190
|
+
justifyContent: "center"
|
|
191
|
+
},
|
|
192
|
+
shutterInner: {
|
|
193
|
+
width: 58,
|
|
194
|
+
height: 58,
|
|
195
|
+
borderRadius: 29,
|
|
196
|
+
backgroundColor: "#fff",
|
|
197
|
+
alignItems: "center",
|
|
198
|
+
justifyContent: "center"
|
|
199
|
+
},
|
|
200
|
+
shutterBusy: {
|
|
201
|
+
backgroundColor: "#1E3A8A"
|
|
202
|
+
},
|
|
203
|
+
permTitle: {
|
|
204
|
+
color: "#fff",
|
|
205
|
+
fontSize: 18,
|
|
206
|
+
fontWeight: "600",
|
|
207
|
+
marginBottom: 8,
|
|
208
|
+
textAlign: "center"
|
|
209
|
+
},
|
|
210
|
+
permBody: {
|
|
211
|
+
color: "#ccc",
|
|
212
|
+
fontSize: 14,
|
|
213
|
+
textAlign: "center",
|
|
214
|
+
marginBottom: 20
|
|
215
|
+
},
|
|
216
|
+
settingsBtn: {
|
|
217
|
+
borderWidth: 1.5,
|
|
218
|
+
borderRadius: 10,
|
|
219
|
+
paddingVertical: 12,
|
|
220
|
+
paddingHorizontal: 24
|
|
221
|
+
},
|
|
222
|
+
settingsText: {
|
|
223
|
+
fontSize: 15,
|
|
224
|
+
fontWeight: "600"
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
//# sourceMappingURL=camera-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNative","_jsxRuntime","visionCamera","loadVisionCamera","CameraView","facing","active","primaryColor","overlay","instruction","captureErrorText","permissionTitle","permissionBody","openSettingsLabel","captureLabel","onCapture","onPermissionDenied","Camera","useCameraDevice","useCameraPermission","camera","useRef","device","hasPermission","requestPermission","capturing","setCapturing","useState","permissionChecked","setPermissionChecked","captureFailed","setCaptureFailed","useEffect","cancelled","granted","takePhoto","current","photo","flash","path","width","height","jsxs","View","style","styles","center","children","jsx","Text","permTitle","permBody","Pressable","settingsBtn","borderColor","onPress","Linking","openSettings","settingsText","color","ActivityIndicator","fill","ref","StyleSheet","absoluteFill","isActive","bottomBar","accessibilityRole","captureError","accessibilityLabel","shutterOuter","disabled","shutterInner","shutterBusy","create","flex","backgroundColor","alignItems","justifyContent","padding","position","bottom","left","right","paddingBottom","fontSize","marginBottom","textAlign","paddingHorizontal","fontWeight","borderRadius","borderWidth","paddingVertical"],"sourceRoot":"../../../src","sources":["camera/camera-view.tsx"],"mappings":";;;;;;AAWA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAD,OAAA;AAA6F,IAAAE,WAAA,GAAAF,OAAA;AAb7F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAUA,IAAIG,YAAsC;AAE1C,SAASC,gBAAgBA,CAAA,EAAiB;EACtCD,YAAY,KAAKH,OAAO,CAAC,4BAA4B,CAAiB;EACtE,OAAOG,YAAY;AACvB;AAyBO,SAASE,UAAUA,CAAC;EACvBC,MAAM;EACNC,MAAM;EACNC,YAAY;EACZC,OAAO;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,SAAS,EAAE,QAAQ;IACnBC,iBAAiB,EAAE;EACvB,CAAC;EACDpB,YAAY,EAAE;IAAET,KAAK,EAAE,SAAS;IAAE8B,UAAU,EAAE;EAAM,CAAC;EACrDnB,YAAY,EAAE;IACV9B,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE,EAAE;IACViD,YAAY,EAAE,EAAE;IAChBC,WAAW,EAAE,CAAC;IACdrC,WAAW,EAAE,MAAM;IACnBuB,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE;EACpB,CAAC;EACDN,YAAY,EAAE;IACVhC,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE,EAAE;IACViD,YAAY,EAAE,EAAE;IAChBd,eAAe,EAAE,MAAM;IACvBC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE;EACpB,CAAC;EACDL,WAAW,EAAE;IAAEG,eAAe,EAAE;EAAU,CAAC;EAC3C1B,SAAS,EAAE;IACPS,KAAK,EAAE,MAAM;IACb0B,QAAQ,EAAE,EAAE;IACZI,UAAU,EAAE,KAAK;IACjBH,YAAY,EAAE,CAAC;IACfC,SAAS,EAAE;EACf,CAAC;EACDpC,QAAQ,EAAE;IAAEQ,KAAK,EAAE,MAAM;IAAE0B,QAAQ,EAAE,EAAE;IAAEE,SAAS,EAAE,QAAQ;IAAED,YAAY,EAAE;EAAG,CAAC;EAChFjC,WAAW,EAAE;IAAEsC,WAAW,EAAE,GAAG;IAAED,YAAY,EAAE,EAAE;IAAEE,eAAe,EAAE,EAAE;IAAEJ,iBAAiB,EAAE;EAAG,CAAC;EAC/F9B,YAAY,EAAE;IAAE2B,QAAQ,EAAE,EAAE;IAAEI,UAAU,EAAE;EAAM;AACpD,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "CameraView", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _cameraView.CameraView;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "compressCapture", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _photoCapture.compressCapture;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _cameraView = require("./camera-view.js");
|
|
19
|
+
var _photoCapture = require("./photo-capture.js");
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_cameraView","require","_photoCapture"],"sourceRoot":"../../../src","sources":["camera/index.ts"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAEA,IAAAC,aAAA,GAAAD,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.compressCapture = compressCapture;
|
|
7
|
+
var _expoImageManipulator = require("expo-image-manipulator");
|
|
8
|
+
/**
|
|
9
|
+
* Normalize + compress a captured photo into a CaptureAsset ready for upload.
|
|
10
|
+
*
|
|
11
|
+
* Decoupled from vision-camera: callers pass a plain { path } (the camera hook maps
|
|
12
|
+
* VisionCamera's PhotoFile to this). Keeps the 10 MB server cap in mind by resizing
|
|
13
|
+
* the longest edge and compressing to JPEG.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const MAX_EDGE = 1600;
|
|
17
|
+
function toFileUri(path) {
|
|
18
|
+
return path.startsWith("file://") || path.startsWith("content://") ? path : `file://${path}`;
|
|
19
|
+
}
|
|
20
|
+
function fileName(type, ts) {
|
|
21
|
+
const base = type === "document_front" ? "front" : type === "document_back" ? "back" : "selfie";
|
|
22
|
+
return `${base}_${ts}.jpg`;
|
|
23
|
+
}
|
|
24
|
+
async function compressCapture(type, photo, timestamp) {
|
|
25
|
+
const uri = toFileUri(photo.path);
|
|
26
|
+
|
|
27
|
+
// Resize the longest edge to MAX_EDGE (only downscale) and compress to JPEG.
|
|
28
|
+
const longest = Math.max(photo.width ?? 0, photo.height ?? 0);
|
|
29
|
+
const resize = longest > MAX_EDGE ? (photo.width ?? 0) >= (photo.height ?? 0) ? [{
|
|
30
|
+
resize: {
|
|
31
|
+
width: MAX_EDGE
|
|
32
|
+
}
|
|
33
|
+
}] : [{
|
|
34
|
+
resize: {
|
|
35
|
+
height: MAX_EDGE
|
|
36
|
+
}
|
|
37
|
+
}] : [];
|
|
38
|
+
const result = await (0, _expoImageManipulator.manipulateAsync)(uri, resize, {
|
|
39
|
+
compress: 0.8,
|
|
40
|
+
format: _expoImageManipulator.SaveFormat.JPEG
|
|
41
|
+
});
|
|
42
|
+
return {
|
|
43
|
+
uri: result.uri,
|
|
44
|
+
name: fileName(type, timestamp),
|
|
45
|
+
type: "image/jpeg",
|
|
46
|
+
width: result.width,
|
|
47
|
+
height: result.height
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=photo-capture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_expoImageManipulator","require","MAX_EDGE","toFileUri","path","startsWith","fileName","type","ts","base","compressCapture","photo","timestamp","uri","longest","Math","max","width","height","resize","result","manipulateAsync","compress","format","SaveFormat","JPEG","name"],"sourceRoot":"../../../src","sources":["camera/photo-capture.ts"],"mappings":";;;;;;AAOA,IAAAA,qBAAA,GAAAC,OAAA;AAPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYA,MAAMC,QAAQ,GAAG,IAAI;AAErB,SAASC,SAASA,CAACC,IAAY,EAAU;EACrC,OAAOA,IAAI,CAACC,UAAU,CAAC,SAAS,CAAC,IAAID,IAAI,CAACC,UAAU,CAAC,YAAY,CAAC,GAAGD,IAAI,GAAG,UAAUA,IAAI,EAAE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
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.generateFingerprint = generateFingerprint;
|
|
7
|
+
var Device = _interopRequireWildcard(require("expo-device"));
|
|
8
|
+
var Localization = _interopRequireWildcard(require("expo-localization"));
|
|
9
|
+
var _reactNative = require("react-native");
|
|
10
|
+
var _hmac = require("./hmac.js");
|
|
11
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
12
|
+
/**
|
|
13
|
+
* Device fingerprint for RN (replaces the web SDK's canvas/WebGL fingerprint).
|
|
14
|
+
*
|
|
15
|
+
* Built from stable device + locale attributes available without extra permissions.
|
|
16
|
+
* Best-effort: the gateway does not currently require this header.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
function generateFingerprint() {
|
|
20
|
+
const platform = `${_reactNative.Platform.OS} ${String(_reactNative.Platform.Version)}`;
|
|
21
|
+
const osVersion = Device.osVersion ?? String(_reactNative.Platform.Version);
|
|
22
|
+
const deviceModel = [Device.brand, Device.modelName].filter(Boolean).join(" ") || "unknown";
|
|
23
|
+
const {
|
|
24
|
+
width,
|
|
25
|
+
height,
|
|
26
|
+
scale
|
|
27
|
+
} = _reactNative.Dimensions.get("screen");
|
|
28
|
+
const screenResolution = `${Math.round(width)}x${Math.round(height)}@${scale}`;
|
|
29
|
+
const timezone = Localization.getCalendars()[0]?.timeZone ?? "unknown";
|
|
30
|
+
const language = Localization.getLocales()[0]?.languageTag ?? "unknown";
|
|
31
|
+
const components = [platform, osVersion, deviceModel, screenResolution, timezone, language, Device.osName ?? ""];
|
|
32
|
+
const fingerprintHash = (0, _hmac.sha256Hex)(components.join("|"));
|
|
33
|
+
return {
|
|
34
|
+
platform,
|
|
35
|
+
osVersion,
|
|
36
|
+
deviceModel,
|
|
37
|
+
screenResolution,
|
|
38
|
+
timezone,
|
|
39
|
+
language,
|
|
40
|
+
fingerprintHash
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=fingerprint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Device","_interopRequireWildcard","require","Localization","_reactNative","_hmac","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","generateFingerprint","platform","Platform","OS","String","Version","osVersion","deviceModel","brand","modelName","filter","Boolean","join","width","height","scale","Dimensions","screenResolution","Math","round","timezone","getCalendars","timeZone","language","getLocales","languageTag","components","osName","fingerprintHash","sha256Hex"],"sourceRoot":"../../../src","sources":["crypto/fingerprint.ts"],"mappings":";;;;;;AAMA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAF,uBAAA,CAAAC,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAGA,IAAAG,KAAA,GAAAH,OAAA;AAAmC,SAAAD,wBAAAK,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAP,uBAAA,YAAAA,CAAAK,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAA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C,IAAIC,KAAK,EAAE;EAE9E,MAAMK,QAAQ,GAAG1C,YAAY,CAAC2C,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,EAAEC,QAAQ,IAAI,SAAS;EACtE,MAAMC,QAAQ,GAAG7C,YAAY,CAAC8C,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,EAAEC,WAAW,IAAI,SAAS;EAEvE,MAAMC,UAAU,GAAG,CACfzB,QAAQ,EACRK,SAAS,EACTC,WAAW,EACXU,gBAAgB,EAChBG,QAAQ,EACRG,QAAQ,EACRhD,MAAM,CAACoD,MAAM,IAAI,EAAE,CACtB;EAED,MAAMC,eAAe,GAAG,IAAAC,eAAS,EAACH,UAAU,CAACd,IAAI,CAAC,GAAG,CAAC,CAAC;EAEvD,OAAO;IACHX,QAAQ;IACRK,SAAS;IACTC,WAAW;IACXU,gBAAgB;IAChBG,QAAQ;IACRG,QAAQ;IACRK;EACJ,CAAC;AACL","ignoreList":[]}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.generateNonce = generateNonce;
|
|
7
|
+
exports.hmacSha256Hex = hmacSha256Hex;
|
|
8
|
+
exports.sha256Bytes = sha256Bytes;
|
|
9
|
+
exports.sha256Hex = sha256Hex;
|
|
10
|
+
/**
|
|
11
|
+
* Pure-JS SHA-256 and HMAC-SHA256.
|
|
12
|
+
*
|
|
13
|
+
* Self-contained (no native dependency) so it runs identically on device and in
|
|
14
|
+
* node tests, and never blocks the verification flow. The web SDK used
|
|
15
|
+
* `crypto.subtle`; expo-crypto exposes digests but not raw HMAC, so we implement
|
|
16
|
+
* the standard ipad/opad construction here. Signatures are best-effort — the
|
|
17
|
+
* KwikId gateway enforces only the Bearer token.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
const K = [0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2];
|
|
21
|
+
function rotr(x, n) {
|
|
22
|
+
return x >>> n | x << 32 - n;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** SHA-256 over raw bytes → 32-byte digest. */
|
|
26
|
+
function sha256Bytes(message) {
|
|
27
|
+
const h = [0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19];
|
|
28
|
+
|
|
29
|
+
// Pre-processing (padding).
|
|
30
|
+
const bitLen = message.length * 8;
|
|
31
|
+
const withOne = message.length + 1;
|
|
32
|
+
const totalLen = withOne + (56 - withOne % 64 + 64) % 64 + 8;
|
|
33
|
+
const padded = new Uint8Array(totalLen);
|
|
34
|
+
padded.set(message);
|
|
35
|
+
padded[message.length] = 0x80;
|
|
36
|
+
// Append 64-bit big-endian length (top 32 bits assumed 0 for our payload sizes).
|
|
37
|
+
const dv = new DataView(padded.buffer);
|
|
38
|
+
dv.setUint32(totalLen - 4, bitLen >>> 0, false);
|
|
39
|
+
dv.setUint32(totalLen - 8, Math.floor(bitLen / 0x100000000), false);
|
|
40
|
+
const w = new Uint32Array(64);
|
|
41
|
+
for (let offset = 0; offset < totalLen; offset += 64) {
|
|
42
|
+
for (let i = 0; i < 16; i++) {
|
|
43
|
+
w[i] = dv.getUint32(offset + i * 4, false);
|
|
44
|
+
}
|
|
45
|
+
for (let i = 16; i < 64; i++) {
|
|
46
|
+
const s0 = rotr(w[i - 15], 7) ^ rotr(w[i - 15], 18) ^ w[i - 15] >>> 3;
|
|
47
|
+
const s1 = rotr(w[i - 2], 17) ^ rotr(w[i - 2], 19) ^ w[i - 2] >>> 10;
|
|
48
|
+
w[i] = w[i - 16] + s0 + w[i - 7] + s1 >>> 0;
|
|
49
|
+
}
|
|
50
|
+
let [a, b, c, d, e, f, g, hh] = h;
|
|
51
|
+
for (let i = 0; i < 64; i++) {
|
|
52
|
+
const S1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25);
|
|
53
|
+
const ch = e & f ^ ~e & g;
|
|
54
|
+
const temp1 = hh + S1 + ch + K[i] + w[i] >>> 0;
|
|
55
|
+
const S0 = rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22);
|
|
56
|
+
const maj = a & b ^ a & c ^ b & c;
|
|
57
|
+
const temp2 = S0 + maj >>> 0;
|
|
58
|
+
hh = g;
|
|
59
|
+
g = f;
|
|
60
|
+
f = e;
|
|
61
|
+
e = d + temp1 >>> 0;
|
|
62
|
+
d = c;
|
|
63
|
+
c = b;
|
|
64
|
+
b = a;
|
|
65
|
+
a = temp1 + temp2 >>> 0;
|
|
66
|
+
}
|
|
67
|
+
h[0] = h[0] + a >>> 0;
|
|
68
|
+
h[1] = h[1] + b >>> 0;
|
|
69
|
+
h[2] = h[2] + c >>> 0;
|
|
70
|
+
h[3] = h[3] + d >>> 0;
|
|
71
|
+
h[4] = h[4] + e >>> 0;
|
|
72
|
+
h[5] = h[5] + f >>> 0;
|
|
73
|
+
h[6] = h[6] + g >>> 0;
|
|
74
|
+
h[7] = h[7] + hh >>> 0;
|
|
75
|
+
}
|
|
76
|
+
const out = new Uint8Array(32);
|
|
77
|
+
const outDv = new DataView(out.buffer);
|
|
78
|
+
for (let i = 0; i < 8; i++) outDv.setUint32(i * 4, h[i], false);
|
|
79
|
+
return out;
|
|
80
|
+
}
|
|
81
|
+
function utf8Bytes(str) {
|
|
82
|
+
// Minimal UTF-8 encoder (TextEncoder may be absent in some RN engines).
|
|
83
|
+
const bytes = [];
|
|
84
|
+
for (let i = 0; i < str.length; i++) {
|
|
85
|
+
let code = str.charCodeAt(i);
|
|
86
|
+
if (code < 0x80) {
|
|
87
|
+
bytes.push(code);
|
|
88
|
+
} else if (code < 0x800) {
|
|
89
|
+
bytes.push(0xc0 | code >> 6, 0x80 | code & 0x3f);
|
|
90
|
+
} else if (code >= 0xd800 && code <= 0xdbff) {
|
|
91
|
+
// Surrogate pair.
|
|
92
|
+
const hi = code;
|
|
93
|
+
const lo = str.charCodeAt(++i);
|
|
94
|
+
code = 0x10000 + (hi - 0xd800 << 10) + (lo - 0xdc00);
|
|
95
|
+
bytes.push(0xf0 | code >> 18, 0x80 | code >> 12 & 0x3f, 0x80 | code >> 6 & 0x3f, 0x80 | code & 0x3f);
|
|
96
|
+
} else {
|
|
97
|
+
bytes.push(0xe0 | code >> 12, 0x80 | code >> 6 & 0x3f, 0x80 | code & 0x3f);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return new Uint8Array(bytes);
|
|
101
|
+
}
|
|
102
|
+
function toHex(bytes) {
|
|
103
|
+
let hex = "";
|
|
104
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
105
|
+
hex += bytes[i].toString(16).padStart(2, "0");
|
|
106
|
+
}
|
|
107
|
+
return hex;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** SHA-256 of a UTF-8 string → lowercase hex. */
|
|
111
|
+
function sha256Hex(message) {
|
|
112
|
+
return toHex(sha256Bytes(utf8Bytes(message)));
|
|
113
|
+
}
|
|
114
|
+
const BLOCK_SIZE = 64;
|
|
115
|
+
|
|
116
|
+
/** HMAC-SHA256(message, key) → lowercase hex. */
|
|
117
|
+
function hmacSha256Hex(message, key) {
|
|
118
|
+
let keyBytes = utf8Bytes(key);
|
|
119
|
+
if (keyBytes.length > BLOCK_SIZE) {
|
|
120
|
+
keyBytes = sha256Bytes(keyBytes);
|
|
121
|
+
}
|
|
122
|
+
const block = new Uint8Array(BLOCK_SIZE);
|
|
123
|
+
block.set(keyBytes);
|
|
124
|
+
const ipad = new Uint8Array(BLOCK_SIZE);
|
|
125
|
+
const opad = new Uint8Array(BLOCK_SIZE);
|
|
126
|
+
for (let i = 0; i < BLOCK_SIZE; i++) {
|
|
127
|
+
ipad[i] = block[i] ^ 0x36;
|
|
128
|
+
opad[i] = block[i] ^ 0x5c;
|
|
129
|
+
}
|
|
130
|
+
const msgBytes = utf8Bytes(message);
|
|
131
|
+
const inner = new Uint8Array(BLOCK_SIZE + msgBytes.length);
|
|
132
|
+
inner.set(ipad);
|
|
133
|
+
inner.set(msgBytes, BLOCK_SIZE);
|
|
134
|
+
const innerHash = sha256Bytes(inner);
|
|
135
|
+
const outer = new Uint8Array(BLOCK_SIZE + innerHash.length);
|
|
136
|
+
outer.set(opad);
|
|
137
|
+
outer.set(innerHash, BLOCK_SIZE);
|
|
138
|
+
return toHex(sha256Bytes(outer));
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** Generate a hex nonce. Deterministic seed optional for tests. */
|
|
142
|
+
function generateNonce(length = 32, seed) {
|
|
143
|
+
const rand = seed ?? Math.random;
|
|
144
|
+
let hex = "";
|
|
145
|
+
for (let i = 0; i < length; i++) {
|
|
146
|
+
hex += Math.floor(rand() * 256).toString(16).padStart(2, "0");
|
|
147
|
+
}
|
|
148
|
+
return hex;
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=hmac.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["K","rotr","x","n","sha256Bytes","message","h","bitLen","length","withOne","totalLen","padded","Uint8Array","set","dv","DataView","buffer","setUint32","Math","floor","w","Uint32Array","offset","i","getUint32","s0","s1","a","b","c","d","e","f","g","hh","S1","ch","temp1","S0","maj","temp2","out","outDv","utf8Bytes","str","bytes","code","charCodeAt","push","hi","lo","toHex","hex","toString","padStart","sha256Hex","BLOCK_SIZE","hmacSha256Hex","key","keyBytes","block","ipad","opad","msgBytes","inner","innerHash","outer","generateNonce","seed","rand","random"],"sourceRoot":"../../../src","sources":["crypto/hmac.ts"],"mappings":";;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMA,CAAC,GAAG,CACN,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAC9F,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAC9F,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAC9F,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAC9F,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAC9F,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAC9F,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAC9F,UAAU,EAAE,UAAU,EAAE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EAAE4D,IAAmB,EAAU;EACpE,MAAMC,IAAI,GAAGD,IAAI,IAAIlD,IAAI,CAACoD,MAAM;EAChC,IAAIlB,GAAG,GAAG,EAAE;EACZ,KAAK,IAAI7B,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGf,MAAM,EAAEe,CAAC,EAAE,EAAE;IAC7B6B,GAAG,IAAIlC,IAAI,CAACC,KAAK,CAACkD,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,CAC1BhB,QAAQ,CAAC,EAAE,CAAC,CACZC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;EACzB;EACA,OAAOF,GAAG;AACd","ignoreList":[]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "SessionManager", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _sessionManager.SessionManager;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "generateFingerprint", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _fingerprint.generateFingerprint;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "generateNonce", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _hmac.generateNonce;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "hmacSha256Hex", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _hmac.hmacSha256Hex;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "sha256Hex", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _hmac.sha256Hex;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
var _sessionManager = require("./session-manager.js");
|
|
37
|
+
var _fingerprint = require("./fingerprint.js");
|
|
38
|
+
var _hmac = require("./hmac.js");
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_sessionManager","require","_fingerprint","_hmac"],"sourceRoot":"../../../src","sources":["crypto/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA","ignoreList":[]}
|